


//constants
var navItemHeight = 23;
var navItemWidth = 117;



$(document).ready(function() {
if ( document.referrer.substring( document.referrer.length - 10 ,document.referrer.length ) == "index.html"){
	$("body").fadeIn("slow");
}

if (typeof document.body.style.maxHeight != "undefined") {
	// firefox  ie7
	shadowCompatible = true;
	$(".subnav").css("backgroundImage","url(images/transpix.png)");

} else {

	// ie6 and below
	shadowCompatible = false;
	
	$(".subnav").css("opacity","0.50").css("filter","alpha(opacity=50)").css("backgroundColor","#000000");

}

	var menuXcoord = $("#navcontainer").offset().left;
	var menuYcoord = $("#navcontainer").offset().top;
	
	var xcoord = 0;
	var ycoord = 0;
	
	var currOn = -1;
	
	var path = location.pathname;


	var sPath = window.location.pathname;

	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);

	var subNavHeight = 101 + navItemHeight;
	
	if (sPage == "home.html"){
		$("#nav0").css({backgroundColor: "#000000",  lineHeight: "1.3em"});
		
	}else if (sPage == "ourcompany.html" || sPage == "ourvision.html" || sPage == "ourteam.html" || sPage == "ourinvestors.html" || sPage == "newsreleases.html"){

		$("#nav1").css({backgroundColor: "#000000"});
	}else if (sPage == "ourwork.html" || sPage == "ourclients.html"){

		$("#nav2").css({backgroundColor: "#000000", lineHeight: "1.3em"});
	
	}else if (sPage == "research.html" || sPage == "design.html" || sPage == "quality.html" || sPage == "support.html"){

		$("#nav3").css({backgroundColor: "#000000", lineHeight: "1.3em"});
	}else if (sPage == "contactus.html" ){

		$("#nav4").css({backgroundColor: "#000000", lineHeight: "1.3em"});
	}
	
		$("#subNav1").css({top: subNavHeight, left: 73 , position: "absolute"});
		$("#subNav2").css({top: subNavHeight, left: 215 , position: "absolute"});
		$("#subNav3").css({top: subNavHeight, left: 273 , position: "absolute"});
		$("#subNav4").css({top: subNavHeight, left: 383 , position: "absolute"});
		$("#subNav5").css({top: subNavHeight, left: 468 , position: "absolute"});
		$("#subNav6").css({top: subNavHeight, left: 645 , position: "absolute"});
		$("#subNav7").css({top: subNavHeight, left: 710 , position: "absolute"});


$("#subNavContainer > div.subnav").each(function(i){
		
		var num = i + 1;
		$("#subNav" + num).mouseover(function(){
		  $("#nav" + num).addClass("navBackOn");
		});
		
		$("#subNav" + num).mouseout(function(){
		  $("#nav" + num).removeClass("navBackOn");
		});
});
		
		
		
		
		
$("#navcontainer > div").each(function(i){
	

		

		
		
		$("#nav" + i).hoverIntent( function() { 
			$(this).addClass("navBackOn");
			
			if (currOn != -1){
				$("#subNav" + currOn).css("display","none");
			}
			
			$("#subNav" + i).slideDown(325);
			currOn = i;

			

		},function(){

		 $(this).removeClass("navBackOn");	
		});

		$("#subNav" + i).hover(function(){
		  $(this).css({display:"block"});

		  

		},function(){
			$(this).css("display","none");

	//	  $(this).css({backgroundColor: "#000000"});
		  currOn = -1;

		});	


	});	
	
		$("#topSensor").mouseover( function(){
			if (currOn != -1){

			$("#subNav" + currOn).css("display","none");
				currOn = -1;
			}			
		});	




});
	
