/*
	This script contains all client-side functions that may be required for the PRODUCTION ENVIRONMENT ONLY.
	Do not put any code in here that is used for the authroing environment.
	
	This script file will be included in every page by the master template so will be universably accessible.
	
*/

	window.status = "HMI" ;
	
	// global variable is the current displayed menu
	var strCurrentMenu = '';

function hideCurrentMenu(){
	
		//check to see if menu selected	
		if (strCurrentMenu !=''){
			var objSubMenu = document.all(strCurrentMenu);
			objSubMenu.className = "hiddenmenu";
			objSubMenu.style.display = "none";
		}
	}

function doCancelBubble(){
	
		window.event.cancelBubble = true;
	}
	
function getPositionSrc(objElement, bFlag)
	{
		var intFinalTop = objElement.offsetTop + objElement.clientTop;
		var intFinalLeft = objElement.offsetLeft + objElement.clientLeft;
		var objOffsetParent = objElement.offsetParent;


		//cycle through to the BODY adding on the offset heights
		while (objOffsetParent.tagName.toUpperCase() != "BODY") {
			intFinalTop += objOffsetParent.offsetTop + objOffsetParent.clientTop;
			intFinalLeft += objOffsetParent.offsetLeft + objOffsetParent.clientLeft;
			objOffsetParent = objOffsetParent.offsetParent;
		}

		return (bFlag ? intFinalTop : intFinalLeft);
	}

function showhiddenmenu(strParent, strMyID)
{
// display the correct menu

var iTop;
var iLeft;
var objMainMenu;
var objPopMenu;

// first hide the current one
hideCurrentMenu();

objMainMenu = document.all.item(strParent);
objPopMenu = document.all.item(strMyID);

// use for non absolute
iTop = getPositionSrc(objMainMenu, true) + objMainMenu.offsetHeight - 1;  
iLeft = getPositionSrc(objMainMenu, false);

objPopMenu.style.position = "absolute";
objPopMenu.style.top = iTop;
objPopMenu.style.left = iLeft;
objPopMenu.style.display = "";
objPopMenu.className = "showdropdown";

strCurrentMenu = strMyID;

doCancelBubble();
}
// stefanos function to open modal window

function openNewWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}

function ToggleExpand(divsec, abutton)
{
  if(document.all.item(divsec).style.display == 'none')
  {
    document.all.item(divsec).style.display = 'block';
    document.all.item(abutton).src = '/images/bullets/minus.jpg';
  } else {
    document.all.item(divsec).style.display = 'none';
    document.all.item(abutton).src = '/images/bullets/plus.jpg';
  }
 
}

//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

var message="Function Disabled!";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
//alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
//alert(message);
return false;
}
}
}

function disableRightClick(){
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("return false")
}
