/*
	The scripts in this file require /js/browserDetect.js to be loaded first.
*/


function showHide(divID,bulletImgPrefix) {
	// 'bulletImgPrefix' is the bullet image before the link and defaults to 'arrowDot' if not passed.
	// There should be a 'left' image and a 'down' image.  
	// Don't ask why the left image is not called 'right', since it points to the right...
	// ex: arrowDot_left.gif and arrotDot_down.gif
	//
	if (bulletImgPrefix) {
		myImgPrefix = bulletImgPrefix;
	}
	else {
		myImgPrefix = 'arrowDot';
	}
	
	myDiv = document.getElementById(divID).style;
	myDivStatus = myDiv.visibility;
	myDivArrow = document.getElementById(divID + '_arrow');
	
	if (myDivStatus == 'hidden') {
		myDiv.visibility = 'visible';
		myDiv.display = 'inline';
		myDivArrow.src = '/images/' + myImgPrefix + '_down.gif';
	}
	else {
		myDiv.visibility = 'hidden';
		myDiv.display = 'none';
		myDivArrow.src = '/images/' + myImgPrefix + '_left.gif';
	}
}



// This adjusts the position for the popup.
// This is needed because the popup div is a child of another div (contentArea1) that wraps around all page content.
// When the browser window is wider than the page content, the left offset for the popup will be wrong without adjusting 
// for the white space to the left of the page content.
meover = 0;
function showPopup(popData,x,y) {
	if (BrowserDetect.browser != 'Safari') {
		var leftPos = x - document.getElementById('contentArea1').offsetLeft - 30;
		var topPos = y - document.getElementById('contentArea1').offsetTop;
		getPopup(popData,leftPos,topPos);
	}
	else {
		// Safari rapidly fires multiple times when mouse is moved across link, so we limit it here to once every half second.
		if (meover == 0) {
			var leftPos = x - document.getElementById('contentArea1').offsetLeft - 30;
			var topPos = y - document.getElementById('contentArea1').offsetTop;
			getPopup(popData,leftPos,topPos);
		}
	}
}

function showPopup2(cssLayout,popContainer,popData,x,y) { 
	// x & y are no longer used.
	var myPos = findPosition(document.getElementById(popContainer))
	var myPosX = myPos[0];
	var myPosY = myPos[1];
	
	if (cssLayout == 0) {
		myPosX = myPosX - document.getElementById('contentArea1').offsetLeft - 20;
		myPosY = myPosY - document.getElementById('contentArea1').offsetTop;
	}
	if (popData.indexOf('map') >= 0) {
		var myPosX = myPosX + 60;
	}
	getPopup(popData,myPosX,myPosY);
}



function hidePopupOld() {
	if (BrowserDetect.browser != 'Safari') {
		// For Safari browser, don't do this.  User will have to hover over popup and then move pointer away to close popup.
		hideDetail();
	}
}

function hidePopup() {
		hideDetail();
}
