 // FUNCTION TO RESET THE TEXT IMAGE IN THE TOP BANNER

 // 09.27.01 KN - needed to add /retail/english/ to the beginning of each image source tag to allow this javascript
 //	to funtion properly in the /retail/English/services/customer/account.asp page as well as in all other pages
 // the problem was that /retail/English/services/customer/account.asp was 2 directories removed from the english/images directory
 // while all other pages were 0-1 directories removed

function highlightSection() {
	document.images['subhead'].src = '/retail/english/images/topBanner/subhead.gif';
	queryString = document.location.pathname // get the url and get it's string
	
	if(queryString.indexOf('/courseCatalog/courseOutlines.asp') != -1){
		document.images['learningResources'].src = '/retail/english/images/lowerNav/learningResources_2.gif';
	}		
	else if(queryString.indexOf('/courseCatalog/') != -1){
		document.images['subhead'].src = '/retail/english/images/topBanner/subhead_1.gif';
		document.images['catalog'].src = '/retail/english/images/upperNav/catalog_2.gif';
	}
	else if(queryString.indexOf('/coursecatalog/') != -1){
		document.images['subhead'].src = '/retail/english/images/topBanner/subhead_1.gif';
		document.images['catalog'].src = '/retail/english/images/upperNav/catalog_2.gif';
	}
	else if(queryString.indexOf('/learningCenters/') != -1){
		document.images['subhead'].src = '/retail/english/images/topBanner/subhead_2.gif';
		document.images['centers'].src = '/retail/english/images/upperNav/centers_2.gif';
	}
	else if(queryString.indexOf('/learningCentersMaps/') != -1){
		document.images['subhead'].src = '/retail/english/images/topBanner/subhead_2.gif';
		document.images['centers'].src = '/retail/english/images/upperNav/centers_2.gif';
	}
	else if(queryString.indexOf('/learningOptions/') != -1){
		document.images['subhead'].src = '/retail/english/images/topBanner/subhead_3.gif';
		document.images['options'].src = '/retail/english/images/upperNav/options_2.gif';
	}
	else if(queryString.indexOf('/free/index.asp') != -1){
		document.images['subhead'].src = '/retail/english/images/topBanner/subhead_3.gif';
		document.images['options'].src = '/retail/english/images/upperNav/options_2.gif';
	}	
	else if(queryString.indexOf('/certifications/') != -1){
		document.images['subhead'].src = '/retail/english/images/topBanner/subhead_4.gif';
		document.images['certifications'].src = '/retail/english/images/upperNav/certifications_2.gif';
	}	
	else if(queryString.indexOf('/company') != -1){
 		document.images['company'].src = '/retail/english/images/lowerNav/company_2.gif';
 	}
	else if(queryString.indexOf('/Centers') != -1){
 		document.images['centers'].src = '/retail/english/images/upperNav/centers_2.gif';
 	}
	else if(queryString.indexOf('/enterpriseSolutions/government') != -1){
//		document.images['governmentSolutions'].src = '/retail/english/images/lowerNav/GovernmentSolutions_2.gif';
	}
	else if(queryString.indexOf('/enterpriseSolutions/') != -1){
		document.images['solutions'].src = '/retail/english/images/lowerNav/BusinessSolutions_2.gif';
	}
	else if(queryString.indexOf('/youritfuture/') != -1){
		document.images['itFuture'].src = '/retail/english/images/lowerNav/itFuture_2.gif';
	}
//	else if(queryString.indexOf('/learningResources/') != -1){
//		document.images['learningResources'].src = '/retail/english/images/lowerNav/learningResources_2.gif';
//	}
//	else if(queryString.indexOf('/LMS/') != -1){
//		document.images['learningResources'].src = '/retail/english/images/lowerNav/learningResources_2.gif';
//	}	
}





// FUNCTION TO ADJUST THE MENU POSITION ON THE HOME PAGE

function adjustHomepageMenus(){
 // NETSCAPE NAVIGATOR 4.0, 4.3, 4.7 CODE
	if (navigator.appName == 'Netscape' && navigator.appVersion.indexOf('5.') == -1 )
	{ 
		document.layers['Layer1'].top = 158;
		document.layers['Layer2'].top = 158;
		document.layers['Layer3'].top = 158;
		document.layers['Layer4'].top = 158;
	} 
	// IE & NETSCAPE 6.0 CODE
	else if ((navigator.appName == 'Netscape' && navigator.appVersion.indexOf('5.') != -1) || (document.all) )
	{ 
		document.getElementById('Layer1').style.top = 158;
		document.getElementById('Layer2').style.top = 158;
		document.getElementById('Layer3').style.top = 158;
		document.getElementById('Layer4').style.top = 158;
	}
}

// image swapping functions:

function swapImgRestore() { 
	var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function preloadImages() { 
	initLayers(); // line added to make layers smart in NN. see layer code at bottom of page

	doPreloadImages('/retail/english/images/upperNav/catalog_2.gif','/retail/english/images/upperNav/centers_2.gif','/retail/english/images/upperNav/options_2.gif');
	doPreloadImages('/retail/english/images/upperNav/solutions_2.gif','/retail/english/images/lowerNav/company_2.gif','/retail/english/images/lowerNav/certifications_2.gif','/retail/english/images/lowerNav/itFuture_2.gif','/retail/english/images/lowerNav/learningResources_2.gif');
	doPreloadImages('/retail/english/images/topBanner/subhead_1.gif','/retail/english/images/topBanner/subhead_2.gif','/retail/english/images/topBanner/subhead_3.gif','/retail/english/images/topBanner/subhead_4.gif');
	doPreloadImages('/retail/english/images/bottomNav/siteMap_2.gif','/retail/english/images/bottomNav/help_2.gif','/retail/english/images/bottomNav/privacy_2.gif','/retail/english/images/bottomNav/terms_2.gif','/retail/english/images/bottomNav/contact_2.gif');
	doPreloadImages('/retail/english/images/searchCenter/discoverOurDifference3ON.gif');

}

function doPreloadImages() { 
	var d=document;
	if(d.images)
	{
		if(!d.p) d.p=new Array();

		var i,j=d.p.length,a=doPreloadImages.arguments; 
		for(i=0; i<a.length; i++)
		if (a[i].indexOf('#')!=0)
		{
			d.p[j]=new Image; d.p[j++].src=a[i];
		}
	}
}

function swapImage() {
	var i,j=0,x,a=swapImage.arguments;
	document.sr=new Array;

	for(i=0;i<(a.length-2);i+=3)
	if ((x=findObj(a[i]))!=null)
	{
		document.sr[j++]=x;
		if(!x.oSrc) x.oSrc=x.src;
		x.src=a[i+2];
	}
}

function findObj(n, d) { //v4.01
	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=findObj(n,d.layers[i].document);
	
	if(!x && d.getElementById) x=d.getElementById(n);
	
	return x;
}

// Reloads Pages in Netscape when windows are resized - layer fix

function reloadPage(init) { //reloads the window if Nav4 resized
	if (init==true) with (navigator) 
	{
		if ((appName=='Netscape')&&(parseInt(appVersion)==4))
		{
			document.pgW=innerWidth;
			document.pgH=innerHeight;
			onresize=reloadPage;
		}
	}
	else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}

reloadPage(true);


// functions for the jump menus in site:

var whichSite = '';

function setSite(site){ // sets a site on the onChange event of a drop down
	whichSite = site;
}
 
function goToSite(which,arg) { // 1st arg is the form name, 2nd is the selector name
	if (whichSite == '') {}
	else { 
		//eval('document.forms.'+which+'.'+arg+'.selectedIndex = 0');
		self.location.href = whichSite; 
	}
}

//////////
////////// Layer show and hide functions. Authored by mikeeb 8-03-01
//////////

timerID = null;
layersActive = false;

function initLayers() { // captures the mouseOvers and mouseOffs for NN 4 & below
	if (document.layers) 
	{
		for (i=1; i<5; i++) {
			thisLayer = 'Layer'+i;
			document.layers[thisLayer].onmouseover = stopTimer;
			document.layers[thisLayer].onmouseout = startHide;
		}
	}
	layersActive = true;
}


function showHideLayers() { // Modified by mikeeb
	if (layersActive == true)  {
		stopTimer();			 // this item has been added
			var i,p,v,obj,args=showHideLayers.arguments;
			for (i=0; i<(args.length-2); i+=3) 
				if ((obj=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;
			}
		}
}

function startHide(){ // starts the hiding of a layer - called by buttons
	//alert('it has started!');
		if (layersActive == true)  {
		timerID = setTimeout('finishHide()', 500);
	}
}
function finishHide() { //trigger after timeout
	for (i=1; i<5; i++)
	{
		whichLayer = 'Layer'+i;
		if (document.layers) document.layers[whichLayer].visibility = 'hide';
	 	else document.getElementById(whichLayer).style.visibility = 'hidden';
	}
}

function stopTimer(){ // if you rolled back onto a button or a layer
	if (layersActive == true)  {
		clearTimeout(timerID);
		timerID = null;
		}
}

function hideAll(notThisOne) { //to hide all menus immediately when rolling on a button
	if (layersActive == true)  {
		stopTimer();
		for (i=1; i<5; i++)
			{
				var thisLayer = 'Layer'+i;
				if (i == notThisOne) {} // dont hide this particular layer
				else if (document.layers) document.layers[thisLayer].visibility = 'hide';
	 			else document.getElementById(thisLayer).style.visibility = 'hidden';
		}
	}
}

function PopCentra(p_SelectIndex, p_SelectValue) {
	if (p_SelectIndex == '4') {
		var newWindow = window.open(p_SelectValue,'SystemCheck','width=690,height=650,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes');
	} else {
		goToSite('pageForm','selectOne')
	}
}


function open_window(url) {
	mywin = window.open(url,"win",'toolbar=1,location=1,directories=0,status=0,menubar=0,resizable=yes,scrollbars=yes,width=550,height=400');
}

//UNIVERSAL WINDOW OPENING FUNCTION
function NewWindow(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',toolbar=1,location=1,directories=0,status=0,menubar=0,resizable=yes'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { 
		win.window.focus();
	}
}

function Toggle(node)
{
	// Unfold the branch if it isn't visible
	if (node.nextSibling.style.display == 'none')
	{
		// Change the image (if there is an image)
		if (node.children.length > 0)
		{ 
			if (node.children.item(0).tagName == "IMG")
			{
				node.children.item(0).src = "minus.gif";
			}
		}

		node.nextSibling.style.display = '';
	}
	// Collapse the branch if it IS visible
	else
	{
		// Change the image (if there is an image)
		if (node.children.length > 0)
		{
			if (node.children.item(0).tagName == "IMG")
			{
				node.children.item(0).src = "plus.gif";
			}
		}

		node.nextSibling.style.display = 'none';
	}

}

function OLA()
	{
		alertWin =window.open('../courseCatalog/CatalogDefinitions.asp?Type=OLA','OLA', 'location=no,toolbar=no,resizable=no,scrollbars=no,marginheight=0,marginwidth=0,status=no,width=390,height=150,left=375,top=300,screenx=15,screeny=15,');
	}
function OLL()
	{
		alertWin =window.open('../courseCatalog/CatalogDefinitions.asp?Type=OLL','OLL', 'location=no,toolbar=no,resizable=no,scrollbars=no,marginheight=0,marginwidth=0,status=no,width=390,height=150,left=375,top=300,screenx=15,screeny=15');
	}
function ILT()
	{
		alertWin =window.open('../courseCatalog/CatalogDefinitions.asp?Type=ILT','ILT', 'location=no,toolbar=no,resizable=no,scrollbars=no ,marginheight=0,marginwidth=0,status=no,width=390,height=150,left=375,top=300,screenx=15,screeny=15');
	}	
function SelfStudy()
	{
		alertWin =window.open('../courseCatalog/CatalogDefinitions.asp?Type=SelfStudy','SelfStudy', 'location=no,toolbar=no,resizable=no,scrollbars=no ,marginheight=0,marginwidth=0,status=no,width=390,height=210,left=375,top=300,screenx=15,screeny=15');
	}
function InstructorLed()
	{
		alertWin =window.open('../courseCatalog/CatalogDefinitions.asp?Type=InstructorLed','InstructorFacilitatedCourses', 'location=no,toolbar=no,resizable=no,scrollbars=no ,marginheight=0,marginwidth=0,status=no,width=390,height=210,left=375,top=300,screenx=15,screeny=15');
	}

function ReinforcementTools(tools,sclass,smodality)
	{
		alertWin =window.open('../courseCatalog/ClassToolDefinitions.asp?Tools=' + tools + '&Title=' + sclass + '&Modality=' + smodality,'InstructorLed', 'location=no,toolbar=no,resizable=yes,scrollbars=yes ,marginheight=0,marginwidth=0,status=no,width=600,height=450,left=10,top=10,screenx=15,screeny=15');
	}
	
function openWindow(sURL, sName, lHeight, lWidth, bScrollBars, bResizable) {
	var sFeatures;
		
    sFeatures = 'location=yes'
	sFeatures = sFeatures + ',height=' + lHeight + ',width=' + lWidth;
	sFeatures = sFeatures + ',top=' + Math.round((screen.availHeight - lHeight)/2);
	sFeatures = sFeatures + ',left=' + Math.round((screen.availWidth - lWidth)/2);
	if(bScrollBars) {
		sFeatures = sFeatures + ',scrollbars=yes';
	}
	if(bResizable) {
		sFeatures = sFeatures + ',resizable=yes';
	}
								
	popup = window.open(sURL, sName, sFeatures);
	popup.opener = self;
}