// JavaScript Document

activateMenu = function(nav) {
//Adds home button to mainNav code when on secondary pages
	//alert(myVar.indexOf('pages'));
	var myVar = new String(document.location);
	if(myVar.indexOf('about') != -1) {
		//alert('make visible');
		//alert(myVar.indexOf('pages'));
		hident=document.getElementById('home');
 		hident.className='homeBtnVis';
	}
	if(myVar.indexOf('contact') != -1) {
		//alert('make visible');
		//alert(myVar.indexOf('pages'));
		hident=document.getElementById('home');
 		hident.className='homeBtnVis';
	}
	if(myVar.indexOf('corporateapparel') != -1) {
		//alert('make visible');
		//alert(myVar.indexOf('pages'));
		hident=document.getElementById('home');
 		hident.className='homeBtnVis';
	}
	if(myVar.indexOf('firstaidandsafety') != -1) {
		//alert('make visible');
		//alert(myVar.indexOf('pages'));
		hident=document.getElementById('home');
 		hident.className='homeBtnVis';
	}
	if(myVar.indexOf('uniformandlinen') != -1) {
		//alert('make visible');
		//alert(myVar.indexOf('pages'));
		hident=document.getElementById('home');
 		hident.className='homeBtnVis';
	}
	
	
/* currentStyle restricts the Javascript to IE only */
	if (document.all &&
 document.getElementById(nav).currentStyle) {  
        var navroot = document.getElementById(nav);
        
        /* Get all the list items within the menu */

        var lis=navroot.getElementsByTagName("LI");  
        for (i=0; i<lis.length; i++) {
        
           /* If the LI has another menu level */
            if(lis[i].lastChild.tagName=="UL"){
            
                /* assign the function to the LI */
             	lis[i].onmouseover=function() {	
                
                   /* display the inner menu */
                   this.lastChild.style.display="block";
                }
                lis[i].onmouseout=function() {   
                   this.lastChild.style.display="none";
                }
            }
        }
    }
}
window.onload= function(){
    /* pass the function the id of the top level UL */

    /* remove one, when only using one menu */
   /* activateMenu('nav'); */
    activateMenu('vertnav'); 
}


function navChangeOvr(id) {

 	identity=document.getElementById(id);
	idBtn=document.getElementById(id+'Btn');
	
	idBtn.className='navItemOvr';
 	
	/*if(idBtn.className != 'navAreaHov'){
 		idBtn.className='navAreaHov';
	
	}*/
 }
 
function navChangeUp(id) {

 	identity=document.getElementById(id);
	idBtn=document.getElementById(id+'Btn');
	
	idBtn.className='navItem';
	
 	/*
	if(idBtn.className != 'navArea'){
 		idBtn.className='';
	}*/

 }
 
//PopIt window
<!-- ;
var newwindow='';

function popitup(url) {
	if (newwindow.location && !newwindow.closed) 
	{ newwindow.location.href = url; newwindow.focus(); } 
else 
	{ newwindow=window.open(url,'htmlname','width=640,height=480,resizable=1') ; }
}

function tidy()
{
if (newwindow.location && !newwindow.closed) { newwindow.close(); } 
}

//Routines specifically for popup feedback windows

var fbwindow
function fbpopitup(url) {
if (fbwindow && !fbwindow.closed) 
	{ fbwindow.location.href = url; fbwindow.focus(); } 
else 
	{ fbwindow=window.open(url,'fhtmlname','width=520,height=420,resizable=1,scrollbars=1,top=50,left=10'); }
}
function fbtidy(){
if (fbwindow && !fbwindow.closed) {fbwindow.close(); } }
// Based on JavaScript provided by Peter Curtis at www.pcurtis.com -->



// Preload Images 
function simplePreload()
{ 
  var args = simplePreload.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++)
  {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}

 
//Set Section Sub Nav
function setSubNav() {
	//alert('in set sub');
//defines var to hold mainNav code & default pageHeader
	var activePlace = "";
	
//Defines site nav folders
	//var mainNav = new Array("products","options","promos","store","aboutus","reps","contact","links","videos");
//has sub nav
	//var mainNav_hasSub = new Array("yes","no","no","no","no","no");
//gets current URL
	var myVar = new String(document.location);
//finds active section based on current URL
	i=0;
	while ((myVar.indexOf(mainNav[i]) == -1) && (i < mainNav.length)) {
			i = i + 1;
			
	}
	
//sets var to hold active section and location in nav array
	//var activePage = new String(mainNav[i]);
	//alert(activePage);
//defines CSS style variables
	//activeStyle = "subNavVis";
//if(activePage != 'undefined'){
	//ident3=document.getElementById(activePage+'Btn');
	//ident3.className='navBtnActive';
//}
//Adds home button to mainNav code when on secondary pages
	//alert(myVar.indexOf('pages'));
	if(myVar.indexOf('pages') != -1) {
		//alert('make visible');
		//alert(myVar.indexOf('pages'));
		hident=document.getElementById('homeBtn');
 		hident.className='homeBtnVis';
	}
//Show subNav_code
	//alert(i);
	//if (mainNav_hasSub[i] == 'yes'){
		//alert(activePage);
		//identity=document.getElementById(activePage+'Sub');
		//identity.className=activeStyle;
		//alert(activePage);
		//ident2=document.getElementById(activePage);
		//ident2.className='navPageActive';
		
		
	//}
	if (myVar.indexOf('#') != -1){
		var beginAnchor = myVar.indexOf('#');
		window.location=myVar.substring(beginAnchor);
	}
// END Main Nav Creation
}

//Cycle navImages
	var the_timeout;
function doTimer()
{
        
        the_timeout = setTimeout("doTimer();", 5000);
}	
	



simplePreload('/images/gif/nav/mainNav_ovr.gif');
