/**
*	Interactive Poster Utilities 1.0
*
*	Mark Lindros, Oracle Corporation
*
*/

//Global variables for convenience functions
var mapz_maps = [];
var hotspotdata = null;
var subsystem = null;
var currentTab = null;
var debug = false;

//This function is always called by the main Mapz $(window).resize event handler
//Just put: $(window).trigger('resize'); in the code to call this function
//If user resizes browser window, then adjust hotspot window height
function posterresize() {
    if (debug == true) console.log("posterresize() was called");
    adjustHotSpotHeight();
    centerHomeLinks();
    resetPerfDBTables();
    resetDBAViewTables();
    resetBGProcsTables();
    return false;
}

$(window).resize(function() {
    resetCurrentMap(); //Reset map first because everything else depends on its settings
    posterresize();
});

function getHotspotDataWindow() {
    $('ul.tabs').find('a').each(function() {
		if ($(this).hasClass('current')) {
			hotspotdata = $($(this).attr('href')).find("div.hotspot-data");
            return hotspotdata;
		}
	});
    return null;
}

function getCurrentTab() {
    $('ul.tabs').find('a').each(function() {
        if ($(this).hasClass('current')) {
            currentTab = $($(this).attr('href'));
        }
    });
}

function getCurrentSubsystem() {
    getCurrentTab();
    $(currentTab).find('ul.breadcrumbs a').each(function() {
        if ($(this).hasClass('current')) { subsystem = $(this).attr('href'); }
    });
}

function escapeChars(inputStr) {
    return inputStr.replace(/([ #;?%&,.+*~\':"!^$[\]()=>|\/@])/g,'\\$1');
}