//<!-- menu script

var ns4 = (document.layers);
var ie = (document.all);
var ns6 = (!document.all && document.getElementById);


if (document.images) {
  
  // MainMenu
  image1on = new Image();
  image1on.src = "/images/main_menu/home_on.jpg";
  
  image2on = new Image();
  image2on.src = "/images/main_menu/products_on.jpg";

  image3on = new Image();
  image3on.src = "/images/main_menu/custom_colors_on.jpg";

  image4on = new Image();
  image4on.src = "/images/main_menu/casestudies_on.jpg";

  image5on = new Image();
  image5on.src = "/images/main_menu/contact_on.jpg"; 
  
  
  image1off = new Image();
  image1off.src = "/images/main_menu/home_off.jpg";

  image2off = new Image();
  image2off.src = "/images/main_menu/products_off.jpg";

  image3off = new Image();
  image3off.src = "/images/main_menu/custom_colors_off.jpg";

  image4off = new Image();
  image4off.src = "/images/main_menu/casestudies_off.jpg";

  image5off = new Image();
  image5off.src = "/images/main_menu/contact_off.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;
}

// -->

