$(document).ready(function(){	   
	// storage
	var  currentSet = $(document).getUrlParam("vx");
	var ida = $(document).getUrlParam("id");
	var idb = $(document).getUrlParam("Itemid");
	var clock;
	var redColor = {color: "#006699"};
	
	$("div.topNav").bind("mouseenter", function(e){clock = 1;});
	$("div.projectNav").bind("mouseenter", function(e){clock = 1;});
	
	if(currentSet=="side"){
			$("div.Capabailities").show();
			$("div.Capabilities").show();
			$("div.Projects").hide();
			$("div.Dust").hide();
			$("div.Tech").hide();
			$("#EngOverview").show();
			$("#DustOverview").show();
			$("div.EngServices").hide();
			$("div.Dust").hide();
			$("div.Tech").hide();
			$(".specProject").hide();
			if(clock!=1){
			$("a.capa").css(makeRed("all"));
			}
			}
			
	if(currentSet!="side"){
			$("div.Capabailities").hide();
			$("div.Capabilities").hide();
			$("div.Dust").hide();
			$("div.Tech").hide();
			$("#EngOverview").hide();
			$("div.EngServices").hide();
			$("div.Dust").hide();
			$("div.Tech").hide();
			$(".specProject").show();
			if(clock!=1){
			$("a.p1").css(makeRed("all"));
			}
			}
	
			$("div.Clients").hide();
			$("div.Extra1").hide();
			//$("div.projectNav").hide();
			$(".specProject").hide();
			//$("div.p1").show();
			$("#DustOverview").show();
			
			$("div.p2").hide();
			$("div.p3").hide();
			$("div.p4").hide();
			$("div.Landing").hide();
			//$("#EngOverview").hide();
	
	function loadFader(){
		$('#portfolio').css("display", "" );
		$('#portfolioB').css("display", "" );
		$('#portfolioC').css("display", "" );
		$('#news').innerfade({
			animationtype: 'slide',
			speed: 750,
			timeout: 2000,
			type: 'random',
			containerheight: '1em'
			});
		$('#portfolio').innerfade({
			speed: 1000,
			timeout: 5000,
			type: 'sequence',
			containerheight: '141px'
			});		
		$('#portfolioB').innerfade({
			speed: 1000,
			timeout: 5000,
			type: 'sequence',
			containerheight: '141px'
			});
		$('#portfolioC').innerfade({
			speed: 1000,
			timeout: 5000,
			type: 'sequence',
			containerheight: '141px'
			});				
		$('.fade').innerfade({
			speed: 'slow',
			timeout: 1000,
			type: 'sequence',
			containerheight: '1.5em'
			});
			}

	 $("#specProjectSwitch").bind("click", function(e){
			clock=1;
			$("div.Projects").show();
			$(".specProject").show();
			$("div.Capabailities").hide();
			$("div.Capabilities").hide();
			$("div.Clients").hide();
			$("div.Landing").hide();
			$("div.Tech").hide();
			$("div.Dust").hide();
			$("div.p1").hide();
			$("div.p2").hide();
			$("div.p3").hide();
			$("div.p4").hide();			
			var thisCssObjA = {color: "#006699"};
			$("span.overview .aosTopLink").css(thisCssObjA); 
			});
	 
	 function makeRed(mode){
			var cssObj = {color: "#000000"};
			$("a.capa").css(cssObj);
			$("a.p1").css(cssObj);
			$("a.p2").css(cssObj);
			$("a.p3").css(cssObj);
			$("a.p4").css(cssObj);
			$("a.p1eng").css(cssObj);
			$("span.n1 .aosTopLink").css(cssObj);
			$("span.n2 .aosTopLink").css(cssObj);
			$("span.n3 .aosTopLink").css(cssObj);
			$("span.n4 .aosTopLink").css(cssObj);
			$("span.n5 .aosTopLink").css(cssObj);
			$("span.overview .aosTopLink").css(cssObj);
			$("span.n2project .aosTopLink").css(cssObj);
			var thisCssObj = {color: "#006699"};
			return (thisCssObj);
			}

	//  SHOW: capabilities text
	 if((ida==17) && (idb==41)){
			$("div.Projects").hide();
			$(".specProject").hide();
			$("div.Capabailities").show();
			$("div.Capabilities").show();
			$("div.Clients").hide();
			$("div.Landing").hide();
			$("div.Dust").hide();
			$("div.Tech").hide();
			$("#EngOverview").hide();
			$("div.EngServices").hide();
			$("div.Dust").hide();
			$("div.Tech").hide();
			$("div.p1").hide();
			$("div.p2").hide();
			$("div.p3").hide();
			$("div.p4").hide();
			var thisCssObj = {color: "#000000"};
			var thisCssObjA = {color: "#006699"};
			$("span.overview .aosTopLink").css(thisCssObjA);
			$(".p1").css(thisCssObj);
			}

	if(currentSet=="landing"){
			$("div.Projects").hide();
			$("div.Capabailities").hide();
			$("div.Capabilities").hide();
			$("div.Clients").hide();
			$("div.Dust").hide();
			$("div.Tech").hide();
			$("#EngOverview").hide();
			$("div.EngServices").hide();
			$("div.Dust").hide();
			$("div.Tech").hide();
			$("div.Landing").show();
			}
		
	// system overrrides:*******************************************************************
	//  Engineering...->Projects from Dropdown
	 if((ida==29) && (idb==55)){
			$(".specProject").show();
			clock=1;
			$(this).css(makeRed("all"));
			var thisCssObjA = {color: "#006699"};
			$("span.n2 .aosTopLink").css(thisCssObjA);
			}
			
	//  Dust Control...->Projects from Dropdown
	 if((ida==233) && (idb==55)){
			clock=1;
			$(this).css(makeRed("all"));
			$("div.Dust").show();
			var thisCssObjA = {color: "#006699"};
			$("span.n2 .aosTopLink").css(thisCssObjA);
			}
			
	//  Dust Control...->landing from AOS Menu
	 if((ida==233) && (idb==85) && (currentSet=="side")){
			clock=1;
			$(this).css(makeRed("all"));
			$("div.Capabailities").show();
			$("div.Capabilities").show();
			$("div.Projects").hide();
			$("div.Dust").show();
			$("div.Tech").hide();
			$("#EngOverview").hide();
			$("#DustOverview").hide();
			$("div.EngServices").hide();
			$(".specProject").hide();
			var thisCssObjA = {color: "#006699"};
			$("span.n2 .aosTopLink").css(thisCssObjA);
			if(clock!=1){
			$("span.n2 .aosTopLink").css(makeRed("all"));
			}
			}		
			
			//  SHOW: change dust to engine
	 if((ida==233) && (idb==85)){
			$("div.componentheading").html("Engineering &amp; Design");
			clock=1;
			$(this).css(makeRed("all"));
			$("div.Capabailities").show();
			$("div.Capabilities").show();
			$("div.Projects").hide();
			$("div.Dust").show();
			$("div.Tech").hide();
			$("#EngOverview").hide();
			$("#DustOverview").hide();
			$("div.EngServices").hide();
			$(".specProject").hide();
			var thisCssObjA = {color: "#006699"};
			$("span.n4 .aosTopLink").css(thisCssObjA);
			}		

	 if((ida==233) && (idb==55)){
			clock=1;
			$("div.componentheading").html("Engineering &amp; Design");
			$(this).css(makeRed("all"));
			$("div.Dust").hide();
			$(".specProject").show();
			var thisCssObjA = {color: "#006699"};
			$("span.n2 .aosTopLink").css(thisCssObjA);
			}

	 $("a.capa").bind("click", function(e){
			clock=1;
			$(this).css(makeRed("all"));
			$("div.Projects").hide();
			$("div.Capabailities").show();
			$("div.Capabilities").show();
			$("div.Dust").hide();
			$("div.Tech").hide();
			$("#EngOverview").hide();
			$("div.EngServices").hide();
			$("div.Dust").hide();
			$("div.Tech").hide();
			$("div.Clients").hide();
			$("div.Landing").hide();
			var thisCssObjA = {color: "#006699"};
			$("span.overview .aosTopLink").css(thisCssObjA);
			});
	 
	  $("span.n1").bind("click", function(e){
			clock=1;
			$(this).css(makeRed("all"));
			$("div.Projects").hide();
			$("div.Capabailities").show();
			$("div.Capabilities").show();
			$("div.Dust").hide();
			$("div.Tech").hide();
			$("#EngOverview").hide();
			$("div.EngServices").hide();
			$("div.Dust").hide();
			$("div.Tech").hide();
			$("div.Clients").hide();
			$("div.Landing").hide();
			var thisCssObjA = {color: "#006699"};
			$("span.n1 .aosTopLink").css(thisCssObjA);
			});
			

	 
	 $("span.overview").bind("click", function(e){
			clock=1;
			$(this).css(makeRed("this"));
			$("div.Projects").hide();
			$("div.specProject").hide();
			$("div.p1").hide();
			$("div.p2").hide();
			$("div.p3").hide();
			$("div.p4").hide();
			$("div.Capabailities").hide();
			$("div.Capabilities").hide();
			$("div.Clients").hide();
			$("div.Dust").hide();
			$("div.Tech").hide();
			$("#EngOverview").show();
			$("div.EngServices").hide();
			$("div.Dust").hide();
			$("div.Tech").hide();
			$("div.Landing").show();
			var thisCssObjA = {color: "#006699"};
			$("span.overview .aosTopLink").css(thisCssObjA);
			});
	 
	 //  SHOW: project text DETENTION
	 $("span.n2").bind("click", function(e){
			clock=1;
			//$("table.aosContent").show();
			$("div.Capabailities").hide();
			$("div.Capabilities").hide();
			$(".specProject").show();
			$("div.Projects").show();
			$("div.Clients").hide();
			$("div.Dust").hide();
			$("div.Tech").hide();
			$("#EngOverview").hide();
			$("div.EngServices").hide();
			$("div.Tech").hide();
			$("div.p1").hide();
			
			/* BLANK PROJECT PAGE FIX: S. McCleary  04-17-2009
			------------------------------------------------------------------------------------------------------------------------------*/
			if((ida!=29 || ida!=233) && (idb!=59 || idb!=85)){
				$("div.p1").show();
				}else{
				$("div.p1").hide();
				}
			/* EO BLANK PROJECT PAGE FIX */
				
			$("div.p2").hide();
			$("div.p3").hide();
			$("div.p4").hide();
			$("div.Landing").hide();
			$(this).css(makeRed("all"));
			var thisCssObjA = {color: "#006699"};
			$("span.n2 .aosTopLink").css(thisCssObjA);
			$("a.p1").css(thisCssObjA);
			});

	 
	 	//  SHOW: project text DETENTION
	 $("span.n2project").bind("click", function(e){
			clock=1;
			//$("table.aosContent").show();
			$("div.Capabailities").hide();
			$("div.Capabilities").hide();
			$(".specProject").show();
			$("div.Projects").show();
			$("div.Clients").hide();
			$("div.Dust").hide();
			$("div.Tech").hide();
			$("#EngOverview").hide();
			$("div.EngServices").hide();
			$("div.Tech").hide();
			$("div.p1").hide();
			$("div.p2").hide();
			$("div.p3").hide();
			$("div.p4").hide();
			$("div.Landing").hide();
			$(this).css(makeRed("all"));
			var thisCssObjA = {color: "#006699"};
			$("span.n2project .aosTopLink").css(thisCssObjA);
			
			
			//$(this).css(makeRed("all"));
			//var thisCssObjA = {color: "#006699"};
			$("a.p1").css(thisCssObjA);
			
			
			});

	 
	 //  SHOW: project text
	 $("span.projectSpec").bind("click", function(e){
			clock=1;
		  	//$("table.aosContent").show();
			$(this).css(makeRed("all"));
			$("div.Capabailities").hide();
			$("div.Capabilities").hide();
			$("div.Projects").show();
			$("div.Clients").hide();
			$("div.Dust").hide();
			$(".specProject").show();
			$("div.Tech").hide();
			$("div.p1").hide();
			$("div.p2").hide();
			$("div.p3").hide();
			$("div.p4").hide();
			$("div.Landing").hide();
			var thisCssObjA = {color: "#006699"};
			$("span.projectSpec .aosTopLink").css(thisCssObjA);
			});
		
	//  SHOW: clients text
	 $("span.n3").bind("click", function(e){
			clock=1	
			$("div.p1").hide();
			//$("table.aosContent").show();
			$("div.Clients").show();
			$("div.Projects").hide();
			$("div.Dust").hide();
			$("#EngOverview").hide();
			$("div.EngServices").hide();
			$("div.Dust").hide();
			$("div.Tech").show();
			$(".specProject").hide()
			$("div.Capabailities").hide();
			$("div.Capabilities").hide();
			$("div.Landing").hide();
			$(this).css(makeRed("all"));
			var thisCssObjA = {color: "#006699"};
			$("span.n3 .aosTopLink").css(thisCssObjA);
			});
		
	//  SHOW: Extra1 text
	$("span.n4").bind("click", function(e){
			clock=1;
			$("div.p1").hide();
			//$("table.aosContent").show();
			$(this).css(makeRed("all"));
			$("div.Clients").show();
			$("#EngOverview").hide();
			$("div.EngServices").hide();
			$("div.Dust").show();
			$("div.Tech").hide();
			$("div.Projects").hide();
			$(".specProject").hide();
			$("div.Capabailities").hide();
			$("div.Capabilities").hide();
			$("div.Landing").hide();
			$(this).css(makeRed("all"));
			var thisCssObjA = {color: "#006699"};
			$("span.n4 .aosTopLink").css(thisCssObjA);
			});
	 
	//  SHOW: Extra1 text
	$("span.n5").bind("click", function(e){
			clock=1;
			$("div.p1").hide();
			//$("table.aosContent").show();
			$("div.Clients").hide();
			$("div.Projects").hide();
			$("div.Dust").hide();
			$("div.Tech").hide();
			$("#EngOverview").hide();
			$("div.EngServices").show();
			$("div.Dust").hide();
			$("div.Tech").hide();
			$(".specProject").hide();
			$("div.Capabailities").show();
			$("div.Capabilities").show();
			$("div.Landing").hide();
			$(this).css(makeRed("all"));
			var thisCssObjA = {color: "#006699"};
			$("span.n5 .aosTopLink").css(thisCssObjA);
			});

	//  SHOW: Individual Projects
		//  SHOW: project 1
		$("a.p1").bind("click", function(e){ 
			clock=1;
			$(".specProject").hide();
			$("div.Capabailities").hide();
			$("div.Capabilities").hide();
			$("div.Dust").hide();
			$("div.Projects").show();
			$("div.Clients").hide();
			$("div.p1").show();
			$("div.Dust").hide();
			$("div.p2").hide();
			$("div.p3").hide();
			$("div.p4").hide();
			$("div.Landing").hide();
			$(this).css(makeRed("all"));
			var thisCssObjA = {color: "#006699"};
			$("a.p1").css(thisCssObjA);
			});
		
	//  SHOW: project 2
	$("a.p2").bind("click", function(e){
			clock=1;
			$(".specProject").hide();
			$("div.Dust").hide();
			$("div.Capabailities").hide();
			$("div.Capabilities").hide();
			$("div.Projects").show();
			$("div.Clients").hide();
			$("div.p1").hide();
			$("div.p2").show();
			$(this).css(makeRed("all"));
			$("div.p3").hide();
			$("div.p4").hide();
			$("div.Landing").hide();
			var thisCssObjA = {color: "#006699"};
			$("a.p2").css(thisCssObjA);
			});
		
	//  SHOW: project 3
	$("a.p3").bind("click", function(e){
			clock=1;
			$(".specProject").hide();
			$("div.Capabailities").hide();
			$("div.Capabilities").hide();
			$("div.Projects").show();
			$("div.Clients").hide();
			$("div.Dust").hide();
			$("div.p1").hide();
			$("div.p2").hide();
			$("div.p3").show();
			$("div.p4").hide();
			$("div.Landing").hide();
			$(this).css(makeRed("all"));
			var thisCssObjA = {color: "#006699"};
			$("a.p3").css(thisCssObjA);
			});
		
	//  SHOW: project 4
	$("a.p4").bind("click", function(e){
			clock=1;
			$(".specProject").hide();
			$("div.Capabailities").hide();
			$("div.Capabilities").hide();
			$("div.Projects").show();
			$("div.Dust").hide();
			$("div.Clients").hide();
			$("div.p1").hide();
			$("div.p2").hide();
			$("div.p3").hide();
			$("div.p4").show();
			$("div.Landing").hide();
			$(this).css(makeRed("all"));
			var thisCssObjA = {color: "#006699"};
			$("a.p4").css(thisCssObjA);
			});
			
			/* Random image display pusher-over */
			loadFader();	
			$('.visible img').each(function(index) {
			$(this).css('padding-left', '15px');
			});

	
  });