//<!-- menu script

var ns4 = (document.layers);
var ie = (document.all);
var ns6 = (!document.all && document.getElementById);


if (document.images) {
  
  
  
  // Company menu on
  image1on = new Image();
  image1on.src = "/images/menu/aboutus_on.gif";
  
  image2on = new Image();
  image2on.src = "/images/menu/offices_on.gif";

  image3on = new Image();
  image3on.src = "/images/menu/shipping_on.gif";

  image4on = new Image();
  image4on.src = "/images/menu/contact_on.gif";
  
  image14on = new Image();
  image14on.src = "/images/menu/home_on.gif";
  
  
     // Company menu off
  image1off = new Image();
  image1off.src = "/images/menu/aboutus_off.gif";

  image2off = new Image();
  image2off.src = "/images/menu/offices_off.gif";

  image3off = new Image();
  image3off.src = "/images/menu/shipping_off.gif";

  image4off = new Image();
  image4off.src = "/images/menu/contact_off.gif";
  
  image14off = new Image();
  image14off.src = "/images/menu/home_off.gif";
  
  
  //Main Menu on
  image5on = new Image();
  image5on.src = "/images/main_menu/plumbing_on.jpg";
  
  image6on = new Image();
  image6on.src = "/images/main_menu/utilities_on.jpg";

  image7on = new Image();
  image7on.src = "/images/main_menu/industrial_on.jpg";

  image8on = new Image();
  image8on.src = "/images/main_menu/irrigation_on.jpg";
  
  image9on = new Image();
  image9on.src = "/images/main_menu/pool_on.jpg";
  
  image10on = new Image();
  image10on.src = "/images/main_menu/hvac_on.jpg";

  image11on = new Image();
  image11on.src = "/images/main_menu/electrical_on.jpg";

  image12on = new Image();
  image12on.src = "/images/main_menu/msds_on.jpg";
  
  
  
  //Main Menu off
  image5off = new Image();
  image5off.src = "/images/main_menu/plumbing_off.jpg";
  
  image6off = new Image();
  image6off.src = "/images/main_menu/utilities_off.jpg";

  image7off = new Image();
  image7off.src = "/images/main_menu/industrial_off.jpg";

  image8off = new Image();
  image8off.src = "/images/main_menu/irrigation_off.jpg";
  
  image9off = new Image();
  image9off.src = "/images/main_menu/pool_off.jpg";
  
  image10off = new Image();
  image10off.src = "/images/main_menu/hvac_off.jpg";

  image11off = new Image();
  image11off.src = "/images/main_menu/electrical_off.jpg";

  image12off = new Image();
  image12off.src = "/images/main_menu/MSDS_off.jpg";
  
  //Search button off
  image13off = new Image();
  image13off.src = "/images/productsearch_off.jpg";
  
  //Search button on
  image13on = new Image();
  image13on.src = "/images/productsearch_on.jpg";
  
  
  
    //Form buttons off
  image15off = new Image();
  image15off.src = "/images/submit_order_off.jpg";
  
  image16off = new Image();
  image16off.src = "/images/clear_form_off.jpg";
  
   //Form buttons on
  image15on = new Image();
  image15on.src = "/images/submit_order_on.jpg";
  
  image16on = new Image();
  image16on.src = "/images/clear_form_on.jpg";
  
  
}

function turnOn(imageName) {
  if (document.images) {
    document[imageName].src = eval(imageName + "on.src");
  }
}

function turnOff(imageName) {
  if (document.images) {
    document[imageName].src = eval(imageName + "off.src");
  }
}

function openIt(id,leftpos, toppos) {	

	if (document.images) {
		if(ns4){
			if(leftpos){
				document.layers[id].visibility = "show";
				document.layers[id].left = leftpos;
				document.layers[id].top = toppos;
			}
	
		}else if(ie){
		
			if(leftpos){
				document.all[id].style.visibility = "visible";
				document.all[id].style.left = leftpos;
				document.all[id].style.top = toppos;
			}
			
		}else if(ns6){
		
			if(leftpos){
				document.getElementById(id).style.visibility = "visible";
				document.getElementById(id).style.left = leftpos;
				document.getElementById(id).style.top = toppos;
			}
		}
	}
}

function closeIt(id){

	if (document.images) {
		if(ns4){
			document.layers[id].visibility = "hide";
		}	else if(ie){
			document.all[id].style.visibility = "hidden";	
		}	else if(ns6){
			document.getElementById(id).style.visibility = "hidden";
		}
	}
}

//global var - needed for updateXCoor()
var x;

//this function updates the width of red space (how much to move over
// the drop down menus, by updating a variable in includes/TextLinks.asp
function updateXCoor(){

	//http://www.webmasterworld.com/forum91/1553.htm

		//the width of the page content
		var contentWidth = 781;
		var	myWidth = 0;
	
		//http://www.howtocreate.co.uk/tutorials/index.php?tut=0&part=16
		if( typeof( window.innerWidth ) == 'number' ) {
			 //Non-IE
			myWidth = window.innerWidth;
		} else if( document.documentElement &&
		  ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			 //IE 6+ in 'standards compliant mode'
			 myWidth = document.documentElement.clientWidth;
		} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			myWidth = document.body.clientWidth;
		}	
		
		if (myWidth > contentWidth){
			x = (myWidth - contentWidth) / 2;
		}else{
			x = 0;
		}
			
		//window.status = 'The blank space = ' + x + ' ...available width = ' + myWidth;
}

// -->


