
// HELP POPUPS

var arrTimeouts = new Array();

function helpPopup_Show(helpDiv, popupID) 
{
	helpDiv.style.visibility = "visible";
	arrTimeouts[popupID] = window.setTimeout("helpPopup_Hide(" + popupID + ");", 2000);
}

function helpPopup_Hide(popupID) 
{
	helpDiv = document.getElementById("help_" + popupID);
	helpDiv.style.visibility = "hidden";
}

function helpPopup_MOver(popupID) 
{
	helpDiv = document.getElementById("help_" + popupID);
	window.clearTimeout(arrTimeouts[popupID]);
}

function helpPopup_MOut(popupID) 
{	
	helpDiv = document.getElementById("help_" + popupID);
	arrTimeouts[popupID] = window.setTimeout("helpPopup_Hide(" + popupID + ");", 1000);
}

function helpPopup(imgHelp, popupID)
{
	helpDiv = document.getElementById("help_" + popupID);
	//helpDiv.style.left = getAbsX(imgHelp)+8;
	helpDiv.style.left = getAbsX(imgHelp) - (helpDiv.offsetWidth/2) + 8;	
	helpDiv.style.top = getAbsY(imgHelp)+8;
	window.status = popupID;
	window.clearTimeout(arrTimeouts[popupID]);
	helpPopup_Show(helpDiv, popupID);	
}

/*
var docBody=document.getElementsByTagName("body").item(0);
	
	// dont need to do this every mouse over the ?
	helpDiv = document.createElement("div");
	helpDiv.setAttribute("id", "help1");
	helpDiv.className = "adminHelp";
	helpDiv.style.left = getAbsX(docPopup)+8;
	helpDiv.style.top = getAbsY(docPopup)+8;
	helpDiv.style.visibility = "hidden";
	helpDiv.onmouseover = function() { helpPopup_MOver(helpDiv); }
	helpDiv.onmouseout = function() { helpPopup_MOut(helpDiv); }
	helpDiv.innerHTML = strHelpText;
	docBody.appendChild(helpDiv); 
	helpPopup_Show(helpDiv);	
*/

var imgs=document.images;

function loadIt(imgObj,imgSrc) {
if(imgs){
	eval(imgObj+' = new Image()');
	eval(imgObj+'.src = "'+imgSrc+'"');
	}
}

// MENU
//loadIt('home_On','../_images/m_home_on.gif');
//loadIt('home_Off','../_images/m_home.gif');
		
function swapImage(imgNam,anImg) {
	document.images[imgNam].src = eval(anImg+'.src');
}

function fadeImage(imgNam,anImg) {
	if (document.all) {		
		// hello IE!
		document.images[imgNam].filters.blendTrans.Apply();
		document.images[imgNam].src = eval(anImg + '.src');
		document.images[imgNam].filters.blendTrans.Play();
	} else {
		// hello everything else
		if (imgs){
			document.images[imgNam].src = eval(anImg+'.src')
		}
	}
}

window.name = "wndMain"; 
function popUp(strPage, intWidth, intHeight){
	// central calcs
	intScreenWidth = screen.width;
	intScreenHeight = screen.height;
	intPopupLeft = (intScreenWidth/2) - (intWidth/2);
	intPopupTop = (intScreenHeight/2) - (intHeight/2);	
	// exec popUp
	pagePopup = window.open(strPage,"pagePopup",'toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,menubar=nocopyhistory=no,width='+intWidth+',height='+intHeight+',left='+intPopupLeft+',top='+intPopupTop);
}

function togglePanel(blockName) {
	docControl = document.getElementById(blockName + '_control');
	docBlock = document.getElementById(blockName + '_block');
	
	if (docBlock.style.display=="block") {
		// HIDE
		docBlock.style.display = "none";
		docControl.src = "../_images/menu_expand.gif";								
	} else {
		// SHOW
		docBlock.style.display = "block";
		docControl.src = "../_images/menu_contract.gif";								
	}
	
}

function getAbsX(elt) { return (elt.x) ? elt.x : getAbsPos(elt,"Left"); }
function getAbsY(elt) { return (elt.y) ? elt.y : getAbsPos(elt,"Top"); }
function getAbsPos(elt,which) {
	iPos = 0;
	while (elt != null) {
		iPos += elt["offset" + which];
		elt = elt.offsetParent;
	}
	return iPos;
}
