// JavaScript Document

try {
  document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}

function imgRO(imgName,imgSrc) {
	if (document.images) {
		document[imgName].src = imgSrc;
	}
}

function goPage(thePage,theWidth,theHeight) {
	window.open(thePage,'','scrollbars=0,toolbar=0,left=30,top=30,resizable=no,width='+theWidth+',height='+theHeight);
}

function goPage2(thePage,theWidth,theHeight) {
	window.open(thePage,'','scrollbars=yes,toolbar=0,left=30,top=30,resizable=yes,width='+theWidth+',height='+theHeight+'');
}

function goPage3(thePage) {
	window.open(thePage,'','');
}


function jump(thePage) {
	document.location.href=thePage;
}

function ecmsExit(theWin,theLink) {
	alert(ecmsExitText(theWin));
	if (theWin==0) {
		document.location.href=theLink;
	} else {
		window.open(theLink,'');
	}
}

function showBox(theBox,theVisibility,saveCookie) {
	if (document.getElementById) {
		if (theVisibility==1) {
			theTable=document.getElementById(theBox+'1');
			theTable.style.display="block";
			theTable=document.getElementById(theBox+'0');
			theTable.style.display="none";
		} else {
			theTable=document.getElementById(theBox+'1');
			theTable.style.display="none";
			theTable=document.getElementById(theBox+'0');
			theTable.style.display="block";
		}
        if (saveCookie==1) {
    		document.cookie = theBox+"="+theVisibility;
        }
	}
}

function ajaxFunction(){
  var objXMLHttp=null;
  try {
    // Firefox, Opera 8.0+, Safari
    objXMLHttp=new XMLHttpRequest();
  }
  catch (e) {
    // Internet Explorer
    try {
      objXMLHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) {
      try {
        objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch (e) {
        objXMLHttp=null;
      }
    }
  }
  return objXMLHttp;
}

function gbid(theID) {
	return document.getElementById(theID);
}

navArray = new Array();

function mdNavEnter(c,v) {
	if (isNaN(navArray[c])) {
		navArray[c]=0;
	}
	navArray[c]+=v;
	var p=gbid(c+'a').className.indexOf('-parent')>-1;
	if (navArray[c]>0) {
		gbid(c).className='md-nav-entry-hover';
		p ? gbid(c+'_').className='md-nav-sub-hover' : void(0);
	} else {
			setTimeout("mdNavExit('"+c+"',"+p+")",5);
	}
}

function mdNavExit(c,p) {
	if (navArray[c]<1) {
		gbid(c).className='md-nav-entry';
		p ? gbid(c+'_').className='md-nav-sub' : void(0);
	}
}

function ecmsCommentMode(f,m) {
    var theForm=eval('document.commentForm'+f);
	theForm.commentMode.value=m;
	theForm.submit();
}
