/* DHTML FUNCTIONS */
//
function openwinMov(URL,Name) {
  popupWin = window.open(URL, Name, 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=616,height=480,left=120,top=120')
}
function showDemo(URL, iWidth, iHeight) {
	//xo = window.open(URL,'demo',"toolbar=no,titlebar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,fullscreen=yes,scrollbars=no,width=" + iWidth + ",height=" + iHeight);
	xo = window.open(URL,'demo',"status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0,scrollbars=0,top=2,left=2,width=" + iWidth + ",height=" + iHeight);
	var usera = navigator.userAgent;
	var bMSIE5 = (usera.indexOf("MSIE 5.")>=1);
	var bMSIE6 = (usera.indexOf("MSIE 6.")>=1);
	var bMSIE7 = (usera.indexOf("MSIE 7.")>=1);
	if (bMSIE5 || bMSIE6 || bMSIE7)
	{
	   xo.focus();
	}
}
function showPop(URL, iWidth, iHeight) {
	//xo = window.open(URL,'demo',"toolbar=no,titlebar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,fullscreen=yes,scrollbars=no,width=" + iWidth + ",height=" + iHeight);
	xo = window.open(URL,'demo',"status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=1,scrollbars=1,top=2,left=2,width=" + iWidth + ",height=" + iHeight);
	var usera = navigator.userAgent;
	var bMSIE5 = (usera.indexOf("MSIE 5.")>=1);
	var bMSIE6 = (usera.indexOf("MSIE 6.")>=1);
	var bMSIE7 = (usera.indexOf("MSIE 7.")>=1);
	if (bMSIE5 || bMSIE6 || bMSIE7)
	{
	   xo.focus();
	}
}
function setPositionDiv()
{
	if (self.innerWidth)
	{
		frameWidth = self.innerWidth;
		frameHeight = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{
		frameWidth = document.documentElement.clientWidth;
		frameHeight = document.documentElement.clientHeight;
	}
	else if (document.body)
	{
		frameWidth = document.body.clientWidth;
		frameHeight = document.body.clientHeight;
	}
	else return;
	var offsetLeftDiv = (frameWidth/2)+190;
	var offsetLeftDivFF = (frameWidth/2)+180;
	var offsetLeftDiv2 = (frameWidth/2)-200;

	if(document.getElementById('panelDiv')){
	    document.getElementById('panelDiv').style.marginLeft = offsetLeftDiv2 + 'px';
	    if (navigator.appVersion.indexOf("MSIE")!=-1){
	        document.getElementById('msviMasthead').style.marginLeft = offsetLeftDiv + 'px';
	        document.getElementById('panelDiv').style.marginTop = -8 + 'px';
	        } else {
	        document.getElementById('msviMasthead').style.marginLeft = offsetLeftDivFF + 'px';
	        document.getElementById('panelDiv').style.marginTop = -25 + 'px';
	        }          
		}
	}
	
//window.onResize = setPositionDiv;
window.onload = setPositionDiv;

function setChromPosition(){
	var iWidth =  document.getElementById('mainpage').offsetLeft;
	//alert (iWidth);
	//document.getElementById('msviMasthead').style.Left=document.getElementById('mainpage').offsetLeft+90;
}
var isNav4, isIE4, isNav6 = false; var range = ""; var styleObj = "";
if (navigator.appVersion.charAt(0) >= 4) {
	if (navigator.appName == "Netscape") { if (navigator.appVersion.charAt(0) >= 5) {isNav6 = true;} else {isNav4 = true;}}
	else {isIE4 = true; range = "all."; styleObj = ".style";}
}
function getObject(obj) {var theObj;
	if (typeof obj == "string") {
		if (isNav6) {theObj = document.getElementById(obj); if (theObj != null) theObj = theObj.style;}
		else {theObj = eval("document." + range + obj); if (theObj != null) theObj = eval("theObj" + styleObj);}}
	else {theObj = obj;} return theObj;
}
function show () {var theObj;
	for (var i = 0; i < show.arguments.length; i++) { theObj = getObject(show.arguments[i]);
		if (theObj != null) { theObj.display = "block"; theObj.visibility = "visible";}}
}
function hide () {var theObj;
	for (var i = 0; i < hide.arguments.length; i++) { theObj = getObject(hide.arguments[i]);
		if (theObj != null) { theObj.display = "none"; theObj.visibility = "hidden";}}
}
function menuActive () {var theObj;
	for (var i = 0; i < menuActive.arguments.length; i++) { theObj = getObject(menuActive.arguments[i]);
		if (theObj != null) { theObj.color = "#536D89"; theObj.backgroundColor = "#FFFFFF";}}
}
function menuInActive () {var theObj;
	for (var i = 0; i < menuInActive.arguments.length; i++) {theObj = getObject(menuInActive.arguments[i]);
		if (theObj != null) { theObj.color = "#FFFFFF"; theObj.backgroundColor = "";}}
}


function tabStatus(tabBox){
	var tabCount = 4;
	for (var i = 1; i <= tabCount; i++)
	{
		var tabID = i;
		var tabName = "tab" + tabID;
		var tabHead = "tabHeader" + tabID;
		var tabLinkHead = "tabLinkBlock" + tabID;
		
		var arrowName = "arrow" + tabID;
		var tabBlock = "tabContent" + tabID;
		
		if (tabBox == tabName)
		{
			document.getElementById(tabName).className='tabOn';
			document.getElementById(tabHead).className='tabHeaderOn';
			/*document.getElementById(tabLinkHead).className='tabLinkBlockOn';*/
			
			
			show(arrowName, tabBlock);
		}
		else
		{
			document.getElementById(tabName).className='tabOff';
			document.getElementById(tabHead).className='tabHeaderOff';
			/*document.getElementById(tabLinkHead).className='tabLinkBlockOff';*/
			
			
			hide(arrowName, tabBlock);
		}
	}
}

function tabStatusSG(tabBox){
	var tabCount = 4;
	for (var i = 1; i <= tabCount; i++)
	{
		var tabID = i;
		var tabName = "tab" + tabID;
		var tabHead = "tabHeader" + tabID;
		var tabLinkHead = "tabLinkBlock" + tabID;
		
		var arrowName = "arrow" + tabID;
		var tabBlock = "tabContent" + tabID;
		
		if (tabBox == tabName)
		{
			document.getElementById(tabName).className='tabOnSG';
			document.getElementById(tabHead).className='tabHeaderOn';
			/*document.getElementById(tabLinkHead).className='tabLinkBlockOn';*/
			
			
			show(arrowName, tabBlock);
		}
		else
		{
			document.getElementById(tabName).className='tabOffSG';
			document.getElementById(tabHead).className='tabHeaderOff';
			/*document.getElementById(tabLinkHead).className='tabLinkBlockOff';*/
			
			
			hide(arrowName, tabBlock);
		}
	}
}

function miniTabStatus(miniTabBox){
	var tabCount = 4;
	for (var i = 1; i <= tabCount; i++)
	{
		var tabID = i;
		var tabName = "tab" + tabID;
		var tabHead = "tabHeader" + tabID;
		
		var arrowName = "arrow" + tabID;
		var tabBlock = "tabContent" + tabID;
		
		if (document.getElementById(tabName)){
			if (miniTabBox == tabName)
			{
				document.getElementById(tabName).className='miniTabOn';
				document.getElementById(tabHead).className='tabHeaderOn';
				
				show(arrowName, tabBlock);
			}
			else
			{
				document.getElementById(tabName).className='miniTabOff';
				document.getElementById(tabHead).className='tabHeaderOff';
				
				hide(arrowName, tabBlock);
			}
		}
	}
}







function goToReg() {
	var CurrentOpt = document.registrationMenu.regLocation.options;
	var CurrentVal = CurrentOpt[document.registrationMenu.regLocation.selectedIndex].value;	
  
	if (CurrentVal != ""){
		window.location = CurrentVal;
	}
	else {
		return;
	}
}


/* DHTML FUNCTIONS */
function menuActivate(menuBox,num) {
for (var i = 1; i <= num; i++)
{var menuID = "0" + i; var menuName = "menu" + menuID; if (menuBox == menuID) {menuActive(menuName);} else {menuInActive(menuName);}}
}

function boxActivate(offerBox,num) {
for (var i = 1; i <= num; i++)
{var boxID = "0" + i; var boxName = "box" + boxID; if (offerBox == boxID) {show(boxName);} else {hide(boxName);}}
}





function openDownload()
{
     menuSet=false;
     var obj = document.getElementById("divDownloadBox");            
     mavGetObjectPosition('aDownload');                    
     obj .style.top = yPos + 20+ 'px';
     obj .style.left = xPos - 190 + 'px';
     obj .style.display="";
}


function changeMenuClass()
{
     var pageName = mavGetPageName();
     alert(pageName);
     mavSetClass("linkCurrent",pageName)
}

function setUpPage()
{
    
     //Home
    mavRotateTabs(5);
    
     mavRightMenu(xmlFile)     
     //For Tab Rollovers
     try{
     boxActivate('01'); menuActivate('01');}
     catch(e){}
}

function legalPop(legalText){
var hey = "hey";
  var generator=window.open('','legalWindow','height=250,width=400,top=230,left=240');
  generator.document.write('<html><head><title>Popup</title>');
  generator.document.write('</head><body style="margin:30px;">');
  generator.document.write('<p style="font-family:Verdana; font-size:11px;">'+legalText+'</p>');
  generator.document.write('<p style="text-align:center;"><a style="font-family:Verdana; font-size:12px;" href="javascript:self.close()">Close this window</a></p>');
  generator.document.write('<script>self.focus();</script>');
  generator.document.write('</body></html>');
  generator.document.close();

}
/* QStringPARSE FUNCTIONS */
//

function PageQuery(q) {
	if(q.length > 1) this.q = q.substring(1, q.length);
	else this.q = null;
	this.keyValuePairs = new Array();
	if(q) {
		for(var i=0; i < this.q.split("&").length; i++) {
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	this.getKeyValuePairs = function() { return this.keyValuePairs; }
	this.getValue = function(s) {
		for(var j=0; j < this.keyValuePairs.length; j++) {
			if(this.keyValuePairs[j].split("=")[0] == s)
				return this.keyValuePairs[j].split("=")[1];
		}
		return false;
	}
	this.getParameters = function() {
		var a = new Array(this.getLength());
		for(var j=0; j < this.keyValuePairs.length; j++) {
			a[j] = this.keyValuePairs[j].split("=")[0];
		}
		return a;
	}
	this.getLength = function() { return this.keyValuePairs.length; }	
}
function queryString(key){
var page = new PageQuery(window.location.search); 
return unescape(page.getValue(key)); 
}
function displayItem(key){
if(queryString(key)=='false') 
{
result.innerHTML="you didn't enter a ?name=value querystring item.";
}else{
result.innerHTML+=queryString(key)+"<BR>";
}
}


/* ADDED on 10/10/07 */

function show() {
	var theObj;
	for (var i = 0; i < show.arguments.length; i++) {
		theObj = getObject(show.arguments[i]);
		if (theObj != null) {
			theObj.display = "block";
			theObj.visibility = "visible";
		}
	}
}

function drawWCLink(url){
	document.getElementById('myWMedia').innerHTML= '<div class="myMediaLink"><a  href='+url+'>View&nbsp;your&nbsp;Webcast&nbsp;&nbsp;&nbsp;&nbsp;</a><\/div>';

}
function drawVLLink(url){
	document.getElementById('myVMedia').innerHTML= '<div class="myMediaLink"><a target=_new href='+url+'>View&nbsp;your&nbsp;Virtual&nbsp;Lab&nbsp;&nbsp;&nbsp;&nbsp;</a><\/div>';

}

function atlasFrame(tag){
	if (document.getElementById('tagger')){
alert('hi!');
		theFrame = document.getElementById('tagger');
		theFrame.src=tag;
	}
}
