	$(window).load(function() { 
$('#superwrapper').css({'visibility':'visible'});
	
	$('html,body').scrollTop(3720);
	 $('.yellowHap').css({'visibility':'visible'});
	  $('.happenings').addClass('currentState');
	  $('a[href*=#]').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
        && location.hostname == this.hostname) {
        
            var $target = $(this.hash);
            
            
            if($(this).parent().hasClass('practice'))
            {
            $('.hiding').css({'visibility':'hidden'});
            $('.greyBox').css({'visibility':'visible'});
            }
             if($(this).parent().hasClass('who'))
            {
             $('.hiding').css({'visibility':'hidden'});
            $('.yellowBox').css({'visibility':'visible'});
            }
            
             if($(this).parent().hasClass('projects'))
            {
             $('.hiding').css({'visibility':'hidden'});
            $('.greyBoxProj').css({'visibility':'visible'});
            }
            
             if($(this).parent().hasClass('happenings'))
            {
             $('.hiding').css({'visibility':'hidden'});
            $('.yellowHap').css({'visibility':'visible'});
            }
            
              if($(this).parent().hasClass('contact'))
            {
             $('.hiding').css({'visibility':'hidden'});
           
            }

        
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
            
            if ($target.length) {
            
                var targetOffset = $target.offset().top;
                
                $('html,body').animate({scrollTop: targetOffset}, 1500, 'easeInOutCubic');
                    
                return false;
                
            }
            
        }
        
    });
    
    
    
    
    $("#projectHolder img").parent().hover(
  function () {
    $('<div class="yellowHover"></div>').appendTo($(this));
    if(navigator.appName == "Opera")
	{
	$('.yellowHover').css({'margin-top':'-190px'});
	}
	
  }, 
  function () {
   $(this).children('.yellowHover').css({'visibility':'hidden'},function(){
   $(this).remove();
   });
  }
 );
 
 
  $('.map').parent().hover(
  function () {
    $('<div class="seeMap"></div>').appendTo($(this));
  }, 
  function () {
   $(this).children('.seeMap').css({'visibility':'hidden'},function(){
   $(this).remove();
   });
  }
 );



$('#nav a').click(function(){
$('li').removeClass('currentState');
$(this).parent().addClass('currentState');
//return false;

});
    
 var news =  $('.newscols').length;
	totalWit =  (314 + 30) * news;
	$('#newsinner').width(totalWit);
	
	
	var currentSlide =  0;	
   
    
 $('#newsRight').click(function(){
 if(currentSlide < news - 3)
 {
 $('#newsinner').animate({'margin-left':'-=315px'});
 currentSlide =  currentSlide + 1;
 }
 
 });
 
 
 $('#newsLeft').click(function(){
 if(currentSlide >= 1)
{
 $('#newsinner').animate({'margin-left':'+=315px'});
 currentSlide =  currentSlide - 1;
 }
 
 
 
 });
	
	
	
	$('#projectSlider').cycle({
	timeout: 0,
	prev: '#projprev',
	next:'#projnext'
	
	});
	
	
	function initCycle(){
	$('#ally').cycle({
	timeout: 0,
	prev: '#projprevLite',
	next:'#projnextLite'
	
	});
	}
	
	
	$('.see a').click(function(){
	var toppy = $(document).scrollTop();
	var tall = $(document).height();
	var id = $(this).parent().attr('id');
	$.post('home/ajax_feature', {id:id}, function(data){
	$(data).appendTo('#projectSliderLite');
	$('#lightBox').height(tall).fadeIn(function(){
	
	$('#projectWrapperLite').css({'top':''+toppy+'px'});
	

	$('#projectSliderLite').fadeIn();
	initCycle();
 
	
	});
		
	});
	
	return false;
	});
	
	
	$('.projectcols').click(function(){
	var toppy = $(document).scrollTop();
	var tall = $(document).height();
	var id = $(this).attr('id');
	$.post('home/ajax_project', {id:id}, function(data){
	$(data).appendTo('#projectSliderLite');
	$('#lightBox').height(tall).fadeIn(function(){
	
	$('#projectWrapperLite').css({'top':''+toppy+'px'});
	

	$('#projectSliderLite').fadeIn();
	initCycle();
 
	
	});
	});
	
	});

	
	
	$('#closeBox').click(function(){
	$('#projectSliderLite').fadeOut(function(){
	$('#lightBox').fadeOut();
	
	}).empty();
	
	
	
	});
	
	 var currentTallest = 0,
     currentRowStart = 0,
     rowDivs = new Array(),
     $el,
     topPosition = 0;

 $('.staff').each(function() {

   $el = $(this);
   topPostion = $el.position().top;

   if (currentRowStart != topPostion) {

     // we just came to a new row.  Set all the heights on the completed row
     for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) {
       rowDivs[currentDiv].height(currentTallest);
     }

     // set the variables for the new row
     rowDivs.length = 0; // empty the array
     currentRowStart = topPostion;
     currentTallest = $el.height();
     rowDivs.push($el);

   } else {

     // another div on the current row.  Add it to the list and check if it's taller
     rowDivs.push($el);
     currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest);

  }

  // do the last row
   for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) {
     rowDivs[currentDiv].height(currentTallest);
   }

 }); 

	
	
	  	
		
	}); 

