<!-- Hide from old Browsers 
var $Jstuff = jQuery.noConflict();
var currentImg;

function URLFindAfterHash() {
	
	var idstr = " ";
	idstr = window.location.href;
	
	idstrpos = idstr.lastIndexOf('=');
	
	if (idstrpos > -1 ){
		idstr=idstr.slice(idstrpos+1);
	    idstr = idstr.slice(0);
	}
	else{
	    idstr = "haccordion-header1";
	    idstr = "about-us";
	}	

	idstr = idstr.replace(" ", "-");
	idstr = $Jstuff('.'+idstr).attr( 'id' );
	
	return idstr;
	
}



$Jstuff(document).ready(function(){


			$Jstuff("#closebtn").mouseover(function(){
                      $Jstuff(this).css({ opacity: "0.4"});
				    });
			$Jstuff("#closebtn").mouseout(function(){
                      $Jstuff(this).css({ opacity: "1.0"});
				    });

		
			$Jstuff(".our-work-grid-item").mouseover(function(){
                      $Jstuff(this).animate({ opacity: "0.3"}, 300, "swing");
				      //$Jstuff(this).css({"opacity":"0.5"});
				    });
			$Jstuff(".our-work-grid-item").mouseout(function(){
                      if (this.id != currentImg.id){$Jstuff(this).animate({ opacity: "1"}, 100, "swing");}
				      //$Jstuff(this).css({"opacity":"1.0"});
				    });
			$Jstuff(".our-work-grid-item").click(function(){
                      //alert($Jstuff("img",this).attr("src")+" ' " + $Jstuff("img","#our-work-main").attr("src"));
                      $Jstuff(this).animate({ opacity: "0.3"}, 100, "swing");
                    
                      imgSrc = $Jstuff("img",this).attr("src");
                      /* Remove thumb */
                      imgSrc = imgSrc.replace("thumbs/thumbs_","");
                      imgDesc = $Jstuff("img",this).attr("description");

                     imgSrc = this.id;
 
                     if (typeof currentImg != 'undefined'){$Jstuff(currentImg ).animate({ opacity: "1"}, 100, "swing");}
                     currentImg = this;
                     imgSrc = "#gallery"+imgSrc.replace("our-work-grid-","");
			         
			         $Jstuff("#our-work-main").cycle('stop');

                      
                      $Jstuff("#our-work-main").animate({ opacity: "0"}, 200, "swing",function(){ChangeSlideGallery( imgSrc,imgDesc );});
				    });

	       	/*Fade up all content on first load */
			$Jstuff(".haccordion").haccordion();
			
			idstr = URLFindAfterHash();
			//$Jstuff("#"+idstr).click();
			//haccordion-header3

					
	 		$Jstuff("#page").fadeIn(1500,function(){$Jstuff("#"+idstr).click(); });
 
 /* Slideshow set and run.  Stop if not in our work */    
		    $Jstuff('a,div').click(function(){
		     if (this.id != 'haccordion-header3' ){	$Jstuff("#our-work-main").cycle('stop');}
		    });
		    
		    $Jstuff('#haccordion-header3').click(function(){    
		     $Jstuff('#our-work-grid-2').click();
		    });


			
		}); /* ready */
		
function ChangeImg(imgSrc,imgDesc){
			$Jstuff("img","#our-work-main").attr("src",imgSrc);
			$Jstuff("#our-work-text").html(imgDesc);
			$Jstuff("img","#our-work-main").animate({ opacity: "0"}, 400, "swing")
			.animate({ opacity: "1"}, 200, "swing");
		}

var lastGallery;
		
function ChangeSlideGallery(imgSrc,imgDesc){
			//$Jstuff("img","#our-work-main").attr("src",imgSrc);
			//$Jstuff(lastGallery).cycle('stop');
			lastGallery = imgSrc;
			
			$Jstuff("#our-work-main").html(" ");
			//$Jstuff(imgSrc).appendTo("#our-work-main");
			imgSrcStuff = $Jstuff(imgSrc).html();
			//$Jstuff("#our-work-main").wrapInner(imgSrc);
			$Jstuff("#our-work-main").html(imgSrcStuff);

		    $Jstuff("#our-work-main").cycle({ 
		    fx: 'fade',
		    speed:    300, 
		    timeout:  2000,
		    pause: 1
		    });

			$Jstuff("#our-work-text").html(imgDesc);
			$Jstuff("#our-work-main").animate({ opacity: "0"}, 400, "swing")
			.animate({ opacity: "1"}, 200, "swing");
		}
		
function FadeUpImg(imgsrc){
			$Jstuff("img","#our-work-main").attr("src",imgsrc);
		}



$Jstuff.fn.extend({
  haccordion: function(params){
    //var jQ = $Jstuff; Speed was 400
    var params = $Jstuff.extend({
      speed: 200,
      speedwipe: 400,
      speedfade: 200,
      speedoutfade: 200,
      headerclass: "hac-header",
      contentclass: "hac-content",
      fadeContent: 1,
      flag: 0,
      contentwidth: 753
    },params);
    return this.each(function(){
      $Jstuff("."+params.headerclass,this).click(function(){
      	
      	//alert(id);
      
        var p = $Jstuff(this).parent()[0];
        
         idcheck = $Jstuff(this).attr('id');
         tabWidth = parseFloat($Jstuff(this).css('width'),10);
         //alert (tabWidth );


        if (p.opened != undefined){
        	params.speed = 200; /* 400 */
        	//if (idcheck != 4);
            //$Jstuff(p.fadeContent).animate({ opacity: "0"}, params.speedoutfade, "swing");   
            $Jstuff("#hac-content4").css({ opacity: "0"});   
            $Jstuff("#hac-content3").css({ opacity: "0"});   
            $Jstuff("#hac-content2").css({ opacity: "0"});    
            $Jstuff("#hac-content1").css({ opacity: "0"});   
        }
        else
        {
        	params.speed = 200;	
        }


         p.opened = this;

		fadeContent = "#hac-content1";
		header2left = (params.contentwidth +(tabWidth));
		header3left = (params.contentwidth +(tabWidth*2));
		header4left = (params.contentwidth +(tabWidth*3));

		
		
		if (idcheck == "haccordion-header4"){
			header2left = tabWidth;
			header3left = (tabWidth*2);
			header4left = (tabWidth*3);
			fadeContent = "#hac-content4";
		}
		
		
		if (idcheck == "haccordion-header3"){
			header2left = tabWidth;
			header3left = (tabWidth*2);
			header4left = (params.contentwidth +(tabWidth*3));
			fadeContent = "#hac-content3";
		}	
		
		/* move header 2 */
		if (idcheck == "haccordion-header2"){
			header2left = tabWidth;
			header3left = (params.contentwidth +(tabWidth*2));
			header4left = (params.contentwidth + (tabWidth*3));
			fadeContent = "#hac-content2";
		}

   		p.fadeContent = fadeContent;
          /* move header 2 */
        $Jstuff("#haccordion-header2").animate({ left: header2left+"px"}, params.speedwipe, "swing");
        $Jstuff("#hac-content2").animate({ left: (header2left+24)+"px"}, params.speed, "swing");
 
         /* move header 3 */
        $Jstuff("#haccordion-header3").animate({ left: header3left+"px"}, params.speedwipe, "swing");
        $Jstuff("#hac-content3").animate({ left: header3left+24+"px"}, params.speed, "swing");

         /* move header 3 */
        $Jstuff("#haccordion-header4").animate({ left: header4left+"px"}, params.speedwipe, "swing");
        $Jstuff("#hac-content4").animate({ left: header4left+24+"px"}, params.speed, "swing",function(){FadeOpacity(fadeContent);});
        
 
      }); /* click */
      
      return false;
    }); /* each */
    
    function FadeOpacity(fadeContent){
    	       $Jstuff(fadeContent).animate({ opacity: "1"}, params.speedfade, "swing");

    }
        
  }
});


/* Maybe look here http://www.overset.com/2008/06/18/jquery-history-plugin/ */

/*  http://benalman.com/code/projects/jquery-bbq/examples/fragment-jquery-ui-tabs/#some_tabs=2 */

$Jstuff(function(){
  
  // Enable tabs on all tab widgets. If you define a callback for the 'select'
  // event, it will be executed for the selected tab whenever the hash changes.
  //$Jstuff('.hac-header').tabs();
  
  // Define our own click handler for the tabs, overriding the default.
  //$Jstuff('.tabs ul.ui-tabs-nav a').click(function(){
  $Jstuff('.hac-header').click(function(){
    var state = {},
      
      // Get the id of this tab widget.
      //id = $Jstuff(this).closest( '.hac-header' ).attr( 'id' ),
       id = $Jstuff(this).attr( 'id' );
       id="hac-header";
       id="aaron";
      
      // Get the index of this tab.
      // This is the tab name
      idx = $Jstuff(this).parent().prevAll().length;
      idx = $Jstuff(this).closest( '.hac-header' ).attr( 'class' );
	  idx = idx.replace("hac-header ", "");
      
      
      //idx = $Jstuff(this).closest( '.hac-header' ).next().find('div.titleandbar h2').html();

      //idx = $Jstuff(this).next().find('div.titleandbar h2').html();
      //alert(idx);
      
     // alert("idx "+idx+" id "+id);
    
    // Set the state!
    state[ id ] = idx;
    $Jstuff.bbq.pushState( state );
    
    // And finally, prevent the default link click behavior by returning false.
    return false;
  });
  
  // Bind an event to window.onhashchange that, when the history state changes,
  // iterates over all tab widgets, changing the current tab as necessary.
  $Jstuff(window).bind( 'hashchange', function(e) {

    		idstr = URLFindAfterHash();
    		//alert("has changed "+idstr);
			$Jstuff("#"+idstr).click();

            idstr = $Jstuff("#"+idstr).next().find('div.titleandbar h2').html();

			
			idstr = idstr.replace("=", " | ");
			idstr = "Aaron Printing  | " + idstr.replace("+", " ");
			//alert(idstr);
			document.title = idstr;

    
    // Iterate over all tab widgets.
    $Jstuff('.hac-header').each(function(){
      
      // Get the index for this tab widget from the hash, based on the
      // appropriate id property. In jQuery 1.4, you should use e.getState()
      // instead of $.bbq.getState(). The second, 'true' argument coerces the
      // string value to a number.
      //var idx = $Jstuff.bbq.getState( this.id, true ) || 0;
      
      // Select the appropriate tab for this tab widget (you could keep track of
      // what tab each widget is on using .data, and only select a tab if it has
      // changed).
      //alert(idx);
      
     // if (idx == 1){$Jstuff("#"+this.id).click();}
      //$Jstuff(this).tabs( 'select', idx );
      
  
    });
    
  })
  
  // Since the event is only triggered when the hash changes, we need to trigger
  // the event now, to handle the hash the page may have loaded with.
  $Jstuff(window).trigger( 'hashchange' );
  
});




-->
