<!-- //hide script from old browsers

/* This script uses Jquery for dhtml animations */
// Active screen element code written by Anywhichway 2008 (prewritten scripts credit/src shown where applicable)

	var panelwidth = 260;
	var displaywidth = 546;
	var animtime = 500;
	var workpage = false;
  
  
  	function popup(targ,w,h){
		args = "location=no,status=no,scrollbars=no,resizable=no,width="+ w +",height="+h;
		
		popwin = window.open(targ,"pop",args);
		
	}
  
	// this function is used to pull variables out of the url querystring. <SRC> - http://ilovethecode.com/Javascript/Javascript-Tutorials-How_To-Easy/Get_Query_String_Using_Javascript.shtml
	function querySt(ji) {
		hu = window.location.search.substring(1);
    
		gy = hu.split("&");
		for (i=0;i<gy.length;i++) {
			ft = gy[i].split("=");
			if (ft[0] == ji) {
				return ft[1];
			}
		}
	}
	
  function hashSt(ji) {
		hu = window.location.hash.substring(1);
    
		gy = hu.split("&");
		for (i=0;i<gy.length;i++) {
			ft = gy[i].split("=");
			if (ft[0] == ji) {
				return ft[1];
			}
		}
	}
	// this function displays the correct menu_info and display_info elements based on ID name
	// and then animates both panels to the display position
	function show(workid){
		$("div#menu_info div").hide();
		$("div#menu_info div#"+workid+"1").show();
		//show info
		$("div#menu_slider").animate({marginLeft:"-"+(panelwidth*2)+"px"}, animtime);
		
		$("div#display_info div").hide();
		$("div#display_info div#"+workid+"2").show();
		//show image
		$("div#display_slider").animate({marginLeft:"0px"}, animtime);
		
		//set back link
		$("div#infobacklink a").attr("href", "javascript:slide_mid();"); 
    //$("div#infobookmark a").attr("href", "work.html?show="+workid);
	  window.location.hash = "show="+workid;
  }
	
	//extra function just for SOLO jobs
	function solo(workid){
		$("div#menu_info div").hide();
		$("div#menu_info div#"+workid+"1").show();
		//show info
		$("div#menu_slider").animate({marginLeft:"-"+(panelwidth*2)+"px"}, animtime);
		
		$("div#display_info div").hide();
		$("div#display_info div#"+workid+"2").show();
		//show image
		$("div#display_slider").animate({marginLeft:"0px"}, animtime);
		
		//hide all submenu stuff
		 $("div#menu_sub div").hide();
		 //and logos
		 $("div#display_client div").hide();
		 $("div#display_client div#blankclient").show();
		 
		//set back link
		$("div#infobacklink a").attr("href", "javascript:slide_start();"); 
    //$("div#infobookmark a").attr("href", "work.html?solo="+workid); 
    window.location.hash = "solo="+workid;
	}
	
	
	// this function shows the correct client submenu
	// and then animates both panels to the display position
	function submenu(subid){
		$("div#menu_sub div").hide();
		$("div#menu_sub div#"+subid+"1").show();
		
		$("div#display_client div").hide();
		$("div#display_client div#"+subid+"2").show();
		
    
		slide_mid();
    window.location.hash = "show="+subid;
	}
	
	// this animates both panels to the start display positions
	function slide_start(){
    window.location.hash = "#";
		$("div#menu_slider").animate({marginLeft:"0px"}, animtime);
		$("div#display_slider").animate({marginLeft:"-"+(displaywidth*2)+"px"}, animtime);
	}
	
	// this animates both panels to the mid display position
	function slide_mid(){
    window.location.hash = "#";
		//shows the middle tier menu
		$("div#menu_slider").animate({marginLeft:"-"+panelwidth+"px"}, animtime);
		$("div#display_slider").animate({marginLeft:"-"+displaywidth+"px"}, animtime);
	}

	
	
	//work startup script
	function work_startup(){
           workpage = true;
		//$("div#menu_sub div").hide();
		$("div#menu_info .infoback").click(function(){
				slide_mid();
				return false;
		})
		//check for querystring and run if found
		var sololink = false;
		var linkid = querySt("show");
		if (linkid == undefined){
			linkid = querySt("solo");
			if (linkid != undefined){
        window.location = "work.php#solo="+linkid;
			}
		}else{
        window.location = "work.php#show="+linkid;
    }
    //also for hash strings
    if (linkid == undefined){
       linkid = hashSt("show");
       if (linkid == undefined){
      			linkid = hashSt("solo");
      			if (linkid != undefined){
      				  sololink = true;
      			}
    		 }
     }
		
		
		if (linkid != undefined){
			//pull the client name from the first part of the string before the underscore.
			subid = linkid.substring(0,linkid.indexOf("_"));
			//show submenu
		    $("div#menu_sub div").hide();
			$("div#menu_sub div#"+subid+"1").show();
		    //and client
		    $("div#display_client div").hide();
			$("div#display_client div#"+subid+"2").show();
			//show work
			if (sololink != true){
				show(linkid);
			}else{
				solo(linkid);
			}
		}
		var clientid = querySt("client");
		if (clientid != undefined){
			//show client
			submenu(clientid);
		}
		//we could use a function that cuts out the animation for these direct links.
	}
	
	function news_startup(){
	         news(0);
	}
	function news(id){
    $("#newsmenu a").css("background","#333");
    $("#newslink"+id).css("background","#666");
    $("div#news_slider").animate({marginLeft:"-"+(700*id)+"px"}, animtime);
		/*$("div#news_slider").animate({ top: "-"+(595*id)+"px"}, animtime);*/
	}
	


// end hiding script from old browsers -->


