// JavaScript Document

var setAction = 0;
var openFor;

function setTabs(x,y){
		document.getElementById("features").style.display = "none";
		document.getElementById("specs").style.display = "none";
		document.getElementById("solutions").style.display = "none";
		document.getElementById('tabA').className = "tabOff";
		document.getElementById('tabB').className = "tabOff";
		document.getElementById('tabC').className = "tabOff";
		document.getElementById(x).style.display = "block";
		document.getElementById(y).className = "tabOn";
	}
	
function setTrainingTabs(x,y){
		document.getElementById("descrip").style.display = "none";
		document.getElementById("audience").style.display = "none";
		document.getElementById("objectives").style.display = "none";
		document.getElementById("prereq").style.display = "none";
		document.getElementById("background").style.display = "none";
		document.getElementById("summary").style.display = "none";
		document.getElementById('tabA').className = "tabOff";
		document.getElementById('tabB').className = "tabOff";
		document.getElementById('tabC').className = "tabOff";
		document.getElementById('tabD').className = "tabOff";
		document.getElementById('tabE').className = "tabOff";
		document.getElementById('tabF').className = "tabOff";
		document.getElementById(x).style.display = "block";
		document.getElementById(y).className = "tabOn";
	}
	
function showPortalReg(){
		document.getElementById("loginArea").style.display = "none";
		document.getElementById("requestArea").style.display = "block";
	}
	
function setPortalLayers(x){
		document.getElementById("options").style.display = "none";
		document.getElementById("messages").style.display = "none";
		document.getElementById(x).style.display = "block";
	}
	
function showContactForm(){
		document.getElementById("contactForm").style.visibility = "visible";
}

function showContent(x){
		if (document.getElementById("hidden_" + x).style.display == "none"){
			document.getElementById("hidden_" + x).style.display = "block";
		}
		else{
			document.getElementById("hidden_" + x).style.display = "none";
		}
	}

function open_up(fileName,width,height,name,scrolls)
{
	window.open(fileName,name,'toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=no,copyhistory=yes,scrollbars='+scrolls+',width='+width+',height='+height);
}

function showDiv(x)
{
	document.getElementById("floater1").innerHTML = x;
}

function buildNews()
{
	var monthNum = document.month.jumpto.value;
	
	//alert(monthNum);
	window.location.assign('news.asp?monthV=' + monthNum)
}

function showMap(x)
{
	//alert("This will show the correct map, etc.");
	document.getElementById("mapIt").innerHTML = "<a href=javascript:hideMap('" + x + "') title='Click here to toggle the map off'>hide map</a> | <a href=javascript:printWindow()>Print</a><br /><iframe src='" + x + "' style='width: 100%; height: 300px;'></iframe>";
}

function hideMap(x)
{
	document.getElementById("mapIt").innerHTML = "<a href=javascript:showMap('" + x + "') title='Click here to toggle the map on and off'>show map</a>";
}

function printWindow()
{
	bV = parseInt(navigator.appVersion);
	if (bV >= 4) window.print();
}

function expandContent(x,y,z)
{
	document.getElementById(x).innerHTML = "<p><b>" + x + ":</b> <a href=javascript:expandContent('" + x + "','','+')>" + z + "</a></p>" + y;
}

function redLight()
{
	msg = "If you Exit now your progress will be lost and you will be returned to the main course listing.  Are you sure you want to continue?";
	return confirm(msg);
}

function show_category(x)
	{
		var x,category,y,stringInput;
		category = eval(x);
		stringInput = "document.topics.currenttopic" + category + ".value";
		y = eval(stringInput);
		
		if (setAction == 0)
		{
		document.getElementById(x).innerHTML = y;
		document.images['content' + x].src = "images/showless.gif";
		setAction = 1;
		}
		else
		{
		document.getElementById(x).innerHTML = "<br />";
		document.images['content' + x].src = "images/showmore.gif";
		setAction = 0;
		}
	}
	
function close_category(x)
	{
		var x;
		category = eval(x);
		document.getElementById(x).innerHTML = "<br />";
		document.images['content' + x].src = "images/showmore.gif"
	}

function buildSupport()
	{
		var selectedProduct = document.productsupport.switchto.value;
		window.location.assign('product_support_focused.asp?selectedProduct=' + selectedProduct)
	}
	
function copyFormElements()
	{
		document.finishregistration.techname.value = document.finishregistration.fname.value + ' ' + document.finishregistration.lname.value;
		document.finishregistration.techaddress.value = document.finishregistration.address.value;
		document.finishregistration.techaddress2.value = document.finishregistration.address2.value;
		document.finishregistration.techcity.value = document.finishregistration.city.value;
		document.finishregistration.techstate.value = document.finishregistration.state.value;
		document.finishregistration.techzip.value = document.finishregistration.zip.value;
		document.finishregistration.techphone.value = document.finishregistration.phone.value;
		document.finishregistration.techemail.value = document.finishregistration.email.value;
	}
	
function clearField(x)
	{
		document.getElementById(x).value = "";
	}
	
function setTimer(){
	openFor = setTimeout("hideSub();",3000);
}
	
function showSub(x){
	clearTimeout(openFor);
	subMenus = new Array('a','b','c','d','e','f');
	//subMenus = new Array('a','b','c');
	i = 0;
	document.getElementById("sMenu"+x).style.display = "block";
	for (i=0;i<=5;i++){
		if (subMenus[i] != x){
			document.getElementById("sMenu"+subMenus[i]).style.display = "none";
		}
	}
	setTimer();
}

function hideSub(){
	subMenus = new Array('a','b','c','d','e','f');
	//subMenus = new Array('a','b','c');
	i = 0;
	for (i=0;i<=5;i++){
		document.getElementById("sMenu"+subMenus[i]).style.display = "none";
	}
}

function displayWindow(theURL,winName,width,height,features) { //v3.1
    var window_width = width;
    var window_height = height;
    var newfeatures= features;
    var window_top = (screen.height-window_height)/2;
    var window_left = (screen.width-window_width)/2;
	//alert('These are the variables' + theURL + ', ' + winName + ', ' + window_width + ', ' + window_height + ', ' + window_top + ', ' + window_left + ', ' + newfeatures);
	
    newWindow=window.open(''+ theURL + '',''+ winName + '','width=' + window_width + ',height=' + window_height + ',top=' + window_top + ',left=' + window_left + ',' + newfeatures + '');
    newWindow.focus();
}
//sample - <a href="javascript:displayWindow('popup_IdeaWinners.asp','Winners',291,200,'scrollbars=yes');">Idea Factory Winners</a>


function closeWindow() {
	window.close();
}

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_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_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];}
}