//--------------------------------------------------------------------------------------------------------------
//NOTES: This file includes functions that control:
//Image rollovers
//Menu bars image groups
//Toggling <DIV>(s) to show and hide elements
//Jump Menus
//New Browser windows
//--------------------------------------------------------------------------------------------------------------
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i>a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i>d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function jumpMenu(strUrl,strValue)
{
	if(strValue != '0') window.location = strUrl;
	return;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function toggle(element,imgname)
{
	if (!element)
	{
		return;
	}
	{
	if (element.style.display == 'none') {
	element.style.display = 'block';
	if (imgname)	{
		document.images[imgname].src = 'images/i_minus.gif'
	}
	}
	else
	{
	element.style.display = 'none';
	if (imgname)	{
		document.images[imgname].src = 'images/i_plus.gif'
	}
	}
	}
}

function setOptions(strVal,objForm)
{
	var iPos = strVal.indexOf('_');
	if (iPos > 0)
	{
		objForm.CID.value = strVal.substring(0,(iPos));
		objForm.SID.value = strVal.substring((iPos+1),strVal.length);											
	}
	else
	{
		objForm.CID.value = strVal;
		objForm.SID.value = 0;
	}
	return;
}

function setOptionsUk(strVal,objForm)
{
	var iPos = strVal.indexOf('_');
	if (iPos > 0)
	{
		objForm.DID.value = strVal.substring(0,(iPos));
		objForm.SID.value = strVal.substring((iPos+1),strVal.length);											
	}
	else
	{
		objForm.DID.value = strVal;
		objForm.SID.value = 0;
	}
	return;
}



//function checkKeyCode(){
	//alert(event.keyCode)

//	var strUrl = document.URL;
//	var nQuestPos = strUrl.indexOf('?');
	// if there is no ? then there are no parameters
//	if (nQuestPos==-1)
//		strUrl += '?';
//	else
//		strUrl += '&';

	// If the user presses F12
//	if(event.keyCode==123)
//	{		
		// add the xml=rtn
//		strUrl += 'XML=RTN';
		// redirect the window
//		document.URL = strUrl;
//	}
//}


function setText(element,text) {
	document.getElementById(element).innerHTML = text;
}

function MM_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}
//----------------------------------------------------------------------------------------------------------------------------------------

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}
//----------------------------------------------------------------------------------------------------------------------------------------
// #START JS Control Menu Rollovers

function MM_toggleMenu(iPosShow)
{
	//NOTE:
	//Loop through the menu array and show the element flagged as shown.
	//If no iPosShow parameter is passed then hide all elements.
	
	var arrMenus = new Array('SMNU_1','SMNU_2','SMNU_3','SMNU_4','SMNU_5','chld1','chld2','chld3','chld4','chld5','chld6','chld7','chld8');
	var sArguments = '';
	
	for (var i = 0; i < arrMenus.length; i++)
	{
		//NOTE: For each item in the Array, show arguments, Roll the Position match back 1 to match the 0 based array.
		if(i == (iPosShow - 1))
		{
			sArguments = sArguments + '\'' + arrMenus[i] + '\',\'\',\'show\'';
		}
		else
		{
			sArguments = sArguments + '\'' + arrMenus[i] + '\',\'\',\'hide\'';	
		}
		//NOTE: Add a comma deleimiter for each item except the last one.
		if((i + 1) != arrMenus.length)
		{
			sArguments = sArguments + ',';
		}
	}
	//NOTE: Evaluate Function call to dynamically execute it.
	eval('MM_showHideLayers(' + sArguments + ')');
	
	return;
}

function MM_toggleChildMenu(iChildPosShow)
{
	//NOTE:
	//Loop through the menu array and show the element flagged as shown.
	//If no iPosShow parameter is passed then hide all elements.
	
	var arrChildMenus = new Array('chld1','chld2','chld3','chld4','chld5','chld6', 'chld7', 'chld8');
	var sChildArguments = '';
	
	for (var i = 0; i < arrChildMenus.length; i++)
	{
		//NOTE: For each item in the Array, show arguments, Roll the Position match back 1 to match the 0 based array.
		if(i == (iChildPosShow - 1))
		{
			sChildArguments = sChildArguments + '\'' + arrChildMenus[i] + '\',\'\',\'show\'';
		}
		else
		{
			sChildArguments = sChildArguments + '\'' + arrChildMenus[i] + '\',\'\',\'hide\'';	
		}
		//NOTE: Add a comma deleimiter for each item except the last one.
		if((i + 1) != arrChildMenus.length)
		{
			sChildArguments = sChildArguments + ',';
		}
	}
	//NOTE: Evaluate Function call to dynamically execute it.
	eval('MM_showHideLayers(' + sChildArguments + ')');
	
	return;
}

function MM_bold(menu)
{
	thermal1.style.font='normal normal normal 10px normal';
	thermal2.style.font='normal normal normal 10px normal';
	thermal3.style.font='normal normal normal 10px normal';
	
	thermal1.style.color='white';
	thermal2.style.color='white';
	thermal3.style.color='white';
	

	
	if(menu == 1)
	{
	thermal1.style.font='normal normal bold 10px normal';
	thermal2.style.color='#F9B0B3';
	thermal3.style.color='#F9B0B3';
	}
	if(menu == 2)
	{
	thermal2.style.font='normal normal bold 10px normal';
	thermal1.style.color='#F9B0B3';
	thermal3.style.color='#F9B0B3';
	}
	if(menu == 3)
	{
	thermal3.style.font='normal normal bold 10px normal';
	thermal2.style.color='#F9B0B3';
	thermal1.style.color='#F9B0B3';
	}
}