var hfile;
var isDefault;

var hURL=String(this.location.href);
hURL = hURL.split("/");
lvl =  hURL.length;
var Domain = hURL[2];		// get the current domain
var hfolder = hURL[lvl - 2];// get the file containing folder
var hfile = hURL[lvl - 1]; 	// get the file name
hfile = hfile.split(".")[0]; //removes extention from file name
		
		
var flag = false;
var intBack = 2;

function init() {
	if (document.images) {   
	ex2aon = new Image();   
	if(hfolder=="about_us"){ex2aon.src = '/images/nav_about_us_high'+strExt;}
	else{ex2aon.src = '/images/nav_about_us'+strExt;}
	ex2bon = new Image();    
	ex2bon.src = '/images/nav_engineered_solutions'+strExt;    
	ex2con = new Image();    
	if(hfolder=="customer_support"){ex2con.src = '/images/nav_customer_support_high'+strExt;}
	else{ex2con.src = '/images/nav_customer_support'+strExt;}
	ex2don = new Image();
	if(hfolder=="products"){ex2don.src = '/images/nav_products_high'+strExt;}
	else{ex2don.src = '/images/nav_products'+strExt;}
	ex2eon = new Image();    
	ex2eon.src = '/images/nav_markets_served'+strExt; 
	return (flag = true);
	}
} 
	if (document.images) {      
	ex2aoff = new Image();   
	if(hfolder=="about_us"){ex2aoff.src = '/images/nav_about_us_high'+strExt;}
	else{ex2aoff.src = '/images/nav_about_us'+strExt;}
	ex2boff = new Image();   
	ex2boff.src = '/images/nav_engineered_solutions'+strExt;   
	ex2coff = new Image();
	if(hfolder=="customer_support"){ex2coff.src = '/images/nav_customer_support_high'+strExt;}
	else{ex2coff.src = '/images/nav_customer_support'+strExt;}
	ex2doff = new Image();   
	if(hfolder=="products"){ex2doff.src = '/images/nav_products_high'+strExt;}
	else{ex2doff.src = '/images/nav_products'+strExt;}
	ex2eoff = new Image();   
	ex2eoff.src = '/images/nav_markets_served'+strExt;} 
	init();
	
window.onload = function() {
	
		var hURL=String(this.location.href);
	    hURL = hURL.split("/");
	    lvl =  hURL.length;
	    var Domain = hURL[2];		// get the current domain
	    var hfolder = hURL[lvl - 2];// get the file containing folder
	    var hfile = hURL[lvl - 1]; 	// get the file name
	    hfile = hfile.split(".")[0]; //removes extention from file name
		
		
		if(hfile == ""){
		var dirPath = ""	
		}
		else if((hfile=="default")||(hfile=="contact_us")||(hfile=="thank_you")){
			var dirPath = "";	
		}
		else{
			var dirPath = "../";	
		}
		
		if(screen.deviceXDPI != screen.logicalXDPI){
			document.getElementsByTagName("body")[0].innerHTML+="<link href='"+dirPath+"styles/dpi.css' rel='stylesheet' type='text/css' />"; //this is for dpi users
		}
		
		
		
		if(hfolder=="products"){
			//document.getElementById('products_sub').innerHTML="<ul style='list-style:none;margin:0px;padding:0px;'><li><a href='/products/drive_control_panels.asp' class='sub_nav'>Drive Control Panels</a></li><li><a href='/products/automation_control.asp' class='sub_nav'>Automation Controls</a></li><li><a href='/products/general_controls.asp' class='sub_nav'>General Controls</a></li><ul>";
		    
			//document.getElementById('products').innerHTML="<img src='images/nav_products_high.png' alt='Products' style='background-color:#000' />";
			//document.getElementById('products').innerHTML="<script language='javascript' type='text/javascript'>od_displayImage('ex2d', 'images/nav_products_high', 250, 23, 'pngLink', 'Products');alert('hey');";
		}
		
		if((hfile!="default")&&(hfile!="")&&(hfile!="contact_us")&&(hfile!="thank_you")){ //assign black background to main nav items
			if(document.getElementById){
				document.getElementById(hfolder).style.background="#000";
				document.getElementById("home_left_top").style.display="none";
			}
		}
		else if((hfile=="contact_us")||(hfile=="thank_you")){
			document.getElementById("home_left_top").style.display="none";
		}
		
		else{
			document.getElementById("left_home_link").innerHTML="&#160;"; //hide Home link when on homepage
		}
		
		
		
		
		
		/*if((hfile==hfolder)&&(hfolder!="register_now")&&(hfolder!="directions")&&(hfolder!="education")){ //if the page is the main page for the section
		isDefault="notTanted";
		}
		if(hfile=="register_now_thanks"){
		    hfile="register_now";
		}
		
		if(document.getElementById('ctl00_' + hfolder)==null){}
		else{document.getElementById('ctl00_' + hfolder).style.color='#E5F02E';} //main menu highlight
        
        queryVar = this.location.href;
        var inq = queryVar.indexOf('?');
        queryVar = queryVar.substring(inq + 1);
        
        if(queryVar=="id=0"){ //make it happen
            hfile=hfile+"_happen";
        }
        else if(queryVar=="id=2"){//make it different
            hfile=hfile+"_diff";
        }
        
		if((hfile=="default")||(hfile=="Default")||(hfile=="")){}
		else if (isDefault=="tanted"){ //if it has left nav to highlight
		    if(document.getElementById(hfile)==null){}
		    else{document.getElementById(hfile).className='live';}
		}*/

	}