/*****************************************************************************************
page load
*****************************************************************************************/

function loadMenus() {
	try
	{
		if(menus) {
			displayPrimaryNav(); 
			if (document.getElementById('menuHolder')) {
				displayTertiaryNav();
			}
			if (document.getElementById('shortcutHolder')) {
				displayShortcuts(menus[0].subMenu[2], false);
			}
			if (document.getElementById('shortcutHolderYellow')) {
				displayShortcuts(menus[0].subMenu[2], true);
			}
		}
	}
	catch(err) {
	}
}

/*****************************************************************************************
image functions
*****************************************************************************************/

function swapImage(iID, sNewImage, sPath) {
	document.getElementById(iID).src = sPath + sNewImage;
}

function preloadImage(sPath) {
	var oImg = new Image();
	oImg.src = sPath;
}

/*****************************************************************************************
other
*****************************************************************************************/

//function for showing copyright notice when user right clicks page
function showCopyright() {
	if(event.button==2)
		{alert(String.fromCharCode(169) + ' MTN')}
}

//this is for when you need to dynamically change the height off the side menu to make space for content on the right, 
//effectively moving the yellow horizontal bar further down. send height , true to move down or height, false to move back up

function changeMenuHeight(iHeight,bNewOrig)
{
	if(document.getElementById('menuHolder'))
	{
		if(bNewOrig) {
				document.getElementById('fullLeftBar').height = iHeight		
		}
		else {
			document.getElementById('fullLeftBar').height = eval(document.getElementById('fullLeftBar').height-iHeight+1)		
		}
	}
}
//function for showing and hiding elements dynamically
function expandableDiv(lbl, div)
{
if(document.getElementById(lbl).style.display=="none")
{
document.getElementById(lbl).style.display = ""
}
else
 {
  document.getElementById(lbl).style.display = "none"
  }  
  moveFooterDown(div)
}
//function for moving footerdown
function moveFooterDown(div)
{
var divHeightpx = document.getElementById(div).offsetHeight + 50
var divHeightem = divHeightpx/20 * 1.8
//document.getElementById('fullLeftBar').style.height = divHeightem + (50/20*1.8) + "em"
}
//function to put focus  on first input element
function inputFocus(oElement)
{	
	if(document.getElementById(oElement))
	{			
	document.getElementById(oElement).focus()
	}
}

function expandDiv(div,link)
{
	if(document.getElementById(div).style.display=="none")
		{
		document.getElementById(div).style.display = ""
		document.getElementById(link).innerHtml = document.getElementById(link).className = "DivExpanded"
		}
	else
		{
		document.getElementById(div).style.display = "none"
		document.getElementById(link).innerHtml = document.getElementById(link).className = "Div"
		} 
}

//function do Keypress enter
function doEnterPress(e, btn,txtbox) {		
		if (e==13) {	
			if (document.getElementById(btn)) {
				document.getElementById(btn).click();
				waiting(btn,txtbox)
			}			
		}				
	}	
	
//function to prevent futher keypress, till server roundtrip complete by chaing cursor
function waiting(btn,txtbox)
	{
	document.getElementById(btn).style.cursor = "wait"
	document.getElementById(txtbox).style.cursor = "wait"
	}
	
//function to print page
function printPage()
{
	this.print();
	this.marginleft(9);
}	


//Flash detection 
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	    for (var i = 0; i < words.length; ++i){
			if (isNaN(parseInt(words[i]))) continue;
			var MM_PluginVersion = words[i]; 
	    }
		var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
}

function SwapClass(id,newclass){
	if(document.getElementById(id)){
		document.getElementById(id).className=newclass;
	}
}

function manageFlash(showDiv,hideDiv)
	{   		
		document.getElementById(showDiv).style.display='block';
		document.getElementById(hideDiv).style.display='none';	
	}

/*************************************promo's rollover events***********************************
***************************************************************************************/

function swapPromo(promoDiv, promoLink, mouse_event) 
{
if (mouse_event =="over")
{document.getElementById(promoDiv).className = 'promobg_over';
document.getElementById(promoLink).className = 'PromoYellow';
}
else
{document.getElementById(promoDiv).className = 'promobg_out';
 document.getElementById(promoLink).className = 'PromoWhite';
 }
}


	