


//constants
var navItemHeight = 32;
var navItemWidth = 117;



$(document).ready(function() {

if (typeof document.body.style.maxHeight != "undefined") {
	// firefox  ie7
	shadowCompatible = true;
	$(".subnav").css("backgroundImage","url(images/pix85.png)");

} else {

	// ie6 and below
	shadowCompatible = false;
	
	$(".subnav").css("opacity","0.90").css("filter","alpha(opacity=90)").css("backgroundColor","#FFFFFF");

}
	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);






	if (sPage == "home.html"){
		$("#nav0").css({background:"url(images/nav_on.gif)", fontWeight: "bold"});
		$("#dot1").css("display", "none");
		$("#dot2").css("display", "none");
	}else if (sPage == "ourcompany.html" || sPage == "ourvision.html" || sPage == "ourteam.html" || sPage == "ourinvestors.html" || sPage == "newsreleases.html"){
		$("#dot2").css("display", "none");
		$("#dot3").css("display", "none");	
		$("#nav1").css({background:"url(images/nav_on.gif)", fontWeight: "bold"});
	}else if (sPage == "ourwork.html" || sPage == "ourclients.html"){
		$("#dot3").css("display", "none");
		$("#dot4").css("display", "none");	
		$("#nav2").css({background:"url(images/nav_on.gif)", fontWeight: "bold"});
	
	}else if (sPage == "research.html" || sPage == "design.html" || sPage == "quality.html" || sPage == "support.html"){
		$("#dot4").css("display", "none");
		$("#dot5").css("display", "none");	
		$("#nav3").css({background:"url(images/nav_on.gif)", fontWeight: "bold"});
	}else if (sPage == "contactus.html" ){
		$("#dot5").css("display", "none");
		$("#dot6").css("display", "none");	
		$("#nav4").css({background:"url(images/nav_on.gif)", fontWeight: "bold"});
	}
	
	$("#navcontainer > div").each(function(i){
	

		
		$("#subNav" + i).css({top: menuYcoord + ycoord + navItemHeight, left: menuXcoord + xcoord, position: "absolute"});
		
		
		$("#nav" + i).hoverIntent( function() { 
			$(this).css({background:"url(images/nav_on.gif)", fontWeight: "bold"});

			
			if ($(this).attr("id") == "nav0"){
				$("#dot1").css("display", "none");
				$("#dot2").css("display", "none");
				$("#dot3").css("display", "block");
				$("#dot4").css("display", "block");	
				$("#dot5").css("display", "block");
				$("#dot6").css("display", "block");	
			}else if ($(this).attr("id") == "nav1"){
				$("#dot2").css("display", "none");
				$("#dot3").css("display", "none");		
				$("#dot1").css("display", "block");
				$("#dot4").css("display", "block");	
				$("#dot5").css("display", "block");
				$("#dot6").css("display", "block");	
			}else if ($(this).attr("id") == "nav2"){
				$("#dot3").css("display", "none");
				$("#dot4").css("display", "none");		
				$("#dot1").css("display", "block");
				$("#dot2").css("display", "block");	
				$("#dot5").css("display", "block");
				$("#dot6").css("display", "block");	
			}else if ($(this).attr("id") == "nav3"){
				$("#dot4").css("display", "none");
				$("#dot5").css("display", "none");		
				$("#dot1").css("display", "block");
				$("#dot2").css("display", "block");	
				$("#dot3").css("display", "block");
				$("#dot6").css("display", "block");	
			}else if ($(this).attr("id") == "nav4"){
				$("#dot5").css("display", "none");
				$("#dot6").css("display", "none");	
				$("#dot1").css("display", "block");
				$("#dot2").css("display", "block");	
				$("#dot3").css("display", "block");
				$("#dot4").css("display", "block");	
			}
			
			if (currOn != -1){
			//	$("#subNav" + currOn).slideUp(325);
				$("#subNav" + currOn).css("display","none");
			}
			
			$("#subNav" + i).slideDown(325);
			currOn = i;

			

		},function(){


		 
		  $(this).css({background:"",  fontWeight: "normal"});	
		});

		$("#subNav" + i).hover(function(){
		  $(this).css({display:"block"});
		  $("#nav" + i).css({background:"url(images/nav_on.gif)", fontWeight: "bold", letterSpacing: "0.01em"});
		  

		},function(){
			$(this).css("display","none");
		 // $(this).slideUp(325);
		  $("#nav" + i).css({background:"",  fontWeight: "normal"});
		  currOn = -1;
			if (i == 0){
				$("#dot1").css("display", "block");
				$("#dot2").css("display", "block");
				
			}else if (i == 1){
				$("#dot2").css("display", "block");
				$("#dot3").css("display", "block");			
			}else if (i == 2){
				$("#dot3").css("display", "block");
				$("#dot4").css("display", "block");			
			}else if (i == 3){
				$("#dot4").css("display", "block");
				$("#dot5").css("display", "block");			
			}else if (i == 4){
				$("#dot5").css("display", "block");
				$("#dot6").css("display", "block");			
			}		
		});	

		xcoord += navItemWidth;
	});	
	
		$("#topSensor").mouseover( function(){
			if (currOn != -1){
			//	$("#subNav" + currOn).slideUp(325);
			$("#subNav" + currOn).css("display","none");
				currOn = -1;
			}			
		});	
	
	$('#bodyMiddle').corner("tr 8px br 8px");
	$('.bulge').corner("tr 8px br 8px");
	$('#bodyRight').corner("8px");



		$(".subnav > div").each(function(){
	
			$(this).after("<div class='bottomshadow'><img src='images/spacer.gif' height='21' width='117'></div>");
			
			if (shadowCompatible){	
			$(this).hover( function() { 
				
	
		
				$(this).next().addClass("bottomshadowon");	
			
		
			},function(){
	
		
				$(this).next().removeClass("bottomshadowon");	
			
			});		
			}
		});	



/*	
	$("#subNavContainer > div > div > a").each(function(){
	
		$(this).before("<div class='topshadow'></div><br />").after("<br/><div class='bottomshadow'></div>");
		
		$(this).hover( function() { 
			$(this).prev().removeClass("topshadowon");	
			$(this).next().addClass("bottomshadowon");	
		
	
		},function(){
		
		});

	});
*/	

	


});
	