
var agt = navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);

var is_nav    = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1));
var is_nav4   = (is_nav && (is_major == 4));
var is_nav4up = (is_nav && (is_major >= 4));
var is_nav5   = (is_nav && (is_major == 5));
var is_nav5up = (is_nav && (is_major >= 5));

var is_nav5dn = (is_nav && (is_major <= 5));


var is_ie    = (agt.indexOf("msie") != -1);
var is_ie4   = (agt.indexOf("msie 4")!= -1) ;
var is_ie4up = (is_ie && (is_major >= 4));
var is_ie5   = (is_ie && (is_major == 4) && (agt.indexOf("msie 5")!=-1) );
var is_ie5up = (is_ie && !is_ie4);

var is_aol   = (agt.indexOf("aol") != -1);
var is_aol4  = (is_aol && is_ie4);

var is_opera = (agt.indexOf("opera") != -1);
var is_webtv = (agt.indexOf("webtv") != -1);

var is_win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
var is_mac = (agt.indexOf("mac")!=-1);




function hideFormElements(val){
	// val says which drop down section
	// for our business in sm
	if((currsection==3)&&(currsection2==1 || currsection2==3)) {
		var sturl = location.search;
		var le1= sturl.indexOf("theme=");
		le1=le1+6;
		var le2=le1+2;
		var strtheme=sturl.substring(le1,le2);
		if(strtheme=='T7') {
		if(val==2){
			if(document.getElementById("month") != null)
			document.getElementById("month").style.visibility="hidden";
			if(document.getElementById("year") != null)
			document.getElementById("year").style.visibility="hidden";
			if(document.getElementById("month1") != null)
			document.getElementById("month1").style.visibility="hidden";
			if(document.getElementById("year1") != null)
			document.getElementById("year1").style.visibility="hidden";
		}
		// for investor relaions in sm
		if(val==4) {
			if(document.getElementById("selcat") != null)
			document.getElementById("selcat").style.visibility="hidden";
			if(document.getElementById("pgno") != null)
			document.getElementById("pgno").style.visibility="hidden";
		}
		}
	}	
	if(currsection==3 && currsection2==3 && val==4) 
	{
		if(document.getElementById("selcat") != null)
		document.getElementById("selcat").style.visibility="hidden";
		if(document.getElementById("pgno") != null)
		document.getElementById("pgno").style.visibility="hidden";		
	}
	if(currsection==3 && val==1) 
	{
		if(document.getElementById("month") != null)
			document.getElementById("month").style.visibility="hidden";
		if(document.getElementById("year") != null)	
			document.getElementById("year").style.visibility="hidden";		
	}
	// for Products & Applications in em
	if((currsection==4)&&(currsection2==1)) {
		var sturl = location.search;
		var le1= sturl.indexOf("theme=");
		le1=le1+6;
		var le2=le1+2;
		var strtheme=sturl.substring(le1,le2);
		if(strtheme=='T7') {
		if(val==2){
			if(document.getElementById("month") != null)
			document.getElementById("month").style.visibility="hidden";
			if(document.getElementById("year") != null)
			document.getElementById("year").style.visibility="hidden";
			if(document.getElementById("month1") != null)
			document.getElementById("month1").style.visibility="hidden";
		}
		}
	}
	
	if(currsection==6 &&currsection2==2 && val==4) 
	{
		// only for  honeywell
		if(document.getElementById("automationProducts") != null)
		document.getElementById("automationProducts").style.visibility="hidden";
		if(document.getElementById("aerospaceProducts") != null)
		document.getElementById("aerospaceProducts").style.visibility="hidden";															
	}
	
	if(currsection==6 &&currsection2==1 && val == 4) 
	{
		// only for  honeywell
		if(document.getElementById("automation") != null)
		document.getElementById("automation").style.visibility="hidden";
		if(document.getElementById("solutions") != null)
		document.getElementById("solutions").style.visibility="hidden";
		if(document.getElementById("aerospace") != null)
		document.getElementById("aerospace").style.visibility="hidden";		
	}
	// to hide elements when control is in advanced search page
	var strurl = location.search;
	var l1= strurl.indexOf("page=");
	l1=l1+5;	// adding the length of "page="
	var l2=l1+9;
	var strpage = strurl.substring(l1,l2);
	if((strpage=='advsearch')&&(val==4)){
		document.getElementById("advs").style.visibility="hidden";	
	}
}

function showFormElements(val){
	if((currsection==3)&&(currsection2==1 || currsection2==3)) {
		// for our business in sm
		var sturl = location.search;
		var le1= sturl.indexOf("theme=");
		le1=le1+6;
		var le2=le1+2;
		var strtheme=sturl.substring(le1,le2);
		if(strtheme=='T7') {
		if(val==2) {
			if(document.getElementById("month") != null)
			document.getElementById("month").style.visibility="visible";
			if(document.getElementById("year") != null)
			document.getElementById("year").style.visibility="visible";
			if(document.getElementById("month1") != null)
			document.getElementById("month1").style.visibility="visible";
			if(document.getElementById("year1") != null)
			document.getElementById("year1").style.visibility="visible";
		}
		// for investor relaions in sm
		if(val==4){
			if(document.getElementById("selcat") != null)
			document.getElementById("selcat").style.visibility="visible";
			if(document.getElementById("pgno") != null)
			document.getElementById("pgno").style.visibility="visible";
			
		}
		}
	}
	
	// for Products & Applications in em
	if((currsection==4)&&(currsection2==1)) {
		var sturl = location.search;
		var le1= sturl.indexOf("theme=");
		le1=le1+6;
		var le2=le1+2;
		var strtheme=sturl.substring(le1,le2);
		if(strtheme=='T7') {
		if(val==2) {
			if(document.getElementById("month") != null)
			document.getElementById("month").style.visibility="visible";
			if(document.getElementById("year") != null)
			document.getElementById("year").style.visibility="visible";
			if(document.getElementById("month1") != null)
			document.getElementById("month1").style.visibility="visible";
		}
		}
	}

	if(currsection==3 && val==1) 
	{
		if(document.getElementById("month") != null)
		document.getElementById("month").style.visibility="visible";
		if(document.getElementById("year") != null)
		document.getElementById("year").style.visibility="visible";
	}
	if(currsection==3 && currsection2==3 && val==4) 
	{
		if(document.getElementById("selcat") != null)
		document.getElementById("selcat").style.visibility="visible";
		if(document.getElementById("pgno") != null)
		document.getElementById("pgno").style.visibility="visible";		
	}


	if(currsection==6 &&currsection2==2 && val==4) 
	{
		// only for  honeywell
		if(document.getElementById("automationProducts") != null)
		document.getElementById("automationProducts").style.visibility="visible";
		if(document.getElementById("aerospaceProducts") != null)
		document.getElementById("aerospaceProducts").style.visibility="visible";					
	}

	if(currsection==6 &&currsection2==1 && val == 4) 
	{
		// only for  honeywell
		if(document.getElementById("automation") != null)
		document.getElementById("automation").style.visibility="visible";
		if(document.getElementById("solutions") != null)
		document.getElementById("solutions").style.visibility="visible";
		if(document.getElementById("aerospace") != null)
		document.getElementById("aerospace").style.visibility="visible";		
	}

	
	// to show elements when control is in advanced search page
	var strurl = location.search;
	var l1= strurl.indexOf("page=");
	l1=l1+5;	// adding the length of "page="
	var l2=l1+9;
	var strpage = strurl.substring(l1,l2);
	if((strpage=='advsearch')&&(val==4)){
		if(document.getElementById("advs") != null)
		document.getElementById("advs").style.visibility="visible";	
	}
}

var on
var off
// show menu link highlighted
//ele = the element usually "this"
//num = the nav style 
//level1nav = which level1 element do you want to hightlight


function slink(ele,num,level1nav){
	on = eval("bgnav" + num + "_on");
	//alert("slink-->on-->"+on);
	setClose(false);
	
	slinkL1(num,level1nav);
	
		if (is_ie){
			  ele.style.backgroundColor= on;
		}
		else
		{
			if(is_nav5up){
				ele.style.backgroundColor= on;
			}
			else{
				//do nothing
			}
		}
		
}


//highlights the related levelone nav
function slinkL1(num,level1nav){
	on2 = bgnav1_on;
	//alert("slinkL1-->num, level1nav-->"+num+" ,"+level1nav);
	//alert("slinkL1-->on2-->"+on2);
		if (num == 2 ){
					
			if (is_ie){
				o = eval("document.all.level" + level1nav );
				
			}
			else if (is_nav5up)
			{
			   o = eval("document.getElementById('level" + level1nav + "')");
			}	
			
			o.style.backgroundColor = on2;
		}	

}

// hide menu link highlighted
// ele = the element to change (generally 'this')
//num = the nav level used to set the correct style
//level1nav = used to compute the id of the TD 

function hlink(ele,num,level1nav){//alert("inside hlink");
  setClose(true,level1nav);
	off = eval("bgnav" + num  + "_off");//alert("hlink-->off-->"+off);
	off2 = bgnav1_off ;//alert("hlink-->off2-->"+off2);
	//alert("hlink-->currsection, level1nav-->"+currsection+" ,"+level1nav);
	if (currsection != level1nav || level1nav == 0){
		//call function to control the first level nav bg color
		hlinkL1(level1nav);
		// change the bgcolor of "this" element back to the off state
		 if (is_ie){
			  ele.style.backgroundColor= off;	
			  ele.style.cursor='hand';
		     }
			else if (is_nav)
			{
				if(is_nav5up){
					ele.style.backgroundColor= off;	
		       }
			   else{
			       // do nothing
			      }
		  }
	  
	 } 
}

// changes the level 1 nav back to the off state
//level1nav = the # portion of the level1 nav  TD id ( "level" + level1nav ) = "leveln 
// to change
function hlinkL1(level1nav){
  off2 = bgnav1_off;
  //alert("hlinkL1-->level1nav-->"+level1nav);
 // alert("hlinkL1-->off2-->"+off2);
	if  (level1nav != 0){
		if (is_ie){
			
			o = eval("document.all.level" + level1nav );
			
		}
		else if (is_nav5up)
		{
		   o = eval("document.getElementById('level" + level1nav + "')");
		}	
		
		o.style.backgroundColor = off2;
	}	
}

var menuTimer;

// begin timer to close menu
function setClose(bool,level1nav){
	m= "menuClose("+level1nav+")";
//	alert(m);

	switch(bool){
		case true:
			menuTimer=setTimeout(m,250);
			break;
		case false:
			clearTimeout(menuTimer);
			break;
	}
}

var menunum;

// menu controller
//num = number concatenated to menu to = id of layer to be turned on
//ele = element to get background color changed usually "this"
//style = which background color does it get.
function menu(num,ele,style){
	menunum = "menu" + num;
	menuClose(num);

	if (currsection != num){
		menuOpen(menunum);
		if (style != 0) {
			slink(ele,style,num);
		}
	}
	setClose(false);
}

// open menus 
function menuOpen(menunum){
	
		if (is_ie){
				document.all[menunum].style.visibility='visible';		
		}else{
			if(is_nav5up){
				document.getElementById(menunum).style.visibility='visible';
			}else{
				document.layers[menunum].visibility='visible';		
			}
		}	
		
}


// close all menus
function menuClose(level1nav){
	
	if (is_ie){
		// if you're leaving a level1 or 2 elelent 
		//turn off the bg color of the level one nav		
			for (i=1;i<=8;i++){
					document.all["menu"+i].style.visibility='hidden';
		}
	}
	else
	{
			if(is_nav5up){
				for (i=1;i<=8;i++){
					document.getElementById("menu"+i).style.visibility='hidden';
				}
			}
			else{
				for (i=1;i<=8;i++){
					document.layers["menu"+i].visibility='hidden';
				}
			}
	}
	
}


// follow link
// called by <TD> onClick event  
	
function follow_url(url){//alert("inside follow_url-->"+url);
		document.location.href=url;
		
//		alert("document.location.href-->"+document.location.href);
	}


// this keeps NS 6+ from closing the submenus when the ilayer is moused over
function nsSetClose(bool){
	if (nscp4){
		setClose(bool);
	}
}
function nsMenu(ele){
	if (nscp4){
		menu(ele,this,1);
	}	
}

