//stage align and resizes
jQuery.event.add(window, "load", resizeFrame);
jQuery.event.add(window, "resize", resizeFrame);

$(document).ready(function(){
		$(".lookbook").galleryS();
		$("#enter").vAlign().hAlign();		
		$("#herds-info").vAlign().hAlign();
		$("#herds-sinfo").vAlign().hAlign();
		$("#herds-sty").vAlign().hAlign();
		 $("#herds-subinfo").vAlign().hAlign();
		$("#herds-contact").vAlign().hAlign();
		$("#shopbody").shopResize();
		$("#back").vAlign();
		$("#cart").vAlign();
		$("#centerd").setWidth();
		$("#shopwrapper").vAlign().hAlign();
		 
      });
      $(window).bind('resize', function(){
       $("#wrapper").wrapS();
		$(".lookbook").galleryS();
		$("#enter").vAlign().hAlign();
		$("#herds-info").vAlign().hAlign();
		$("#herds-sty").vAlign().hAlign();
		$("#herds-sinfo").vAlign().hAlign();
		 $("#herds-subinfo").vAlign().hAlign();
		$("#herds-contact").vAlign().hAlign();
		$("#shopwrapper").vAlign().hAlign();
		$("#centerd").setWidth();
		 $("#back").vAlign();
		$("#cart").vAlign();
      }); 
	  
function resizeFrame() 
{
    var h = $(window).height();
	 $("#splash").css('height',(h));
	  $("#shopbody").css('height',(h));
	 $("#enter").vAlign().hAlign();
	  $("#herdsabout").css('height',(h));
	   $("#herdsty").css('height',(h));
	  $("#herdsstore").css('height',(h));
	    $("#herdssubscribe").css('height',(h));
	  $("#herdscontact").css('height',(h));
	 $("#herds-info").vAlign().hAlign();
	 $("#herds-sinfo").vAlign().hAlign();
	 $("#herds-sty").vAlign().hAlign();
	 $("#herds-subinfo").vAlign().hAlign();
	 $("#herds-contact").vAlign().hAlign();
	 $("#shopwrapper").vAlign().hAlign();
    $("#wrapper").css('height',(h-73));
	$("#centerd").setWidth();
	$("#back").vAlign();
		$("#cart").vAlign();
	 
	var h2 = $("#wrapper").height();
	$(".lookbook").css('height',(h2/4));
	$(".lookbook a#slide-right").css('height',(h2/4));	
	$(".lookbook a#slide-right2").css('height',(h2/4));
	$(".lookbook a#slide-right3").css('height',(h2/4));
	$(".lookbook a#slide-right4").css('height',(h2/4));x
	
}


	  
//GALLERY
$(window).bind("load", function() {
    var activeOpacity   = 1.0,
        inactiveOpacity = 0.48,
        fadeTime = 350,
        clickedClass = "selected",
        thumbs = ".lookbook";

    $(thumbs).fadeTo(1, inactiveOpacity);
	

    $(thumbs).hover(
        function(){
            $(this).fadeTo(fadeTime, activeOpacity);		
			
		        },
        function(){
            // Only fade out if the user hasn't clicked the thumb
            if(!$(this).hasClass(clickedClass)) {
                $(this).fadeTo(fadeTime, inactiveOpacity);
				
            }
        });
     $(thumbs).click(function() {
         // Remove selected class from any elements other than this
         var previous = $(thumbs + '.' + clickedClass).eq();
         var clicked = $(this);
         if(clicked !== previous) {
             previous.removeClass(clickedClass);
         }
         clicked.addClass(clickedClass).fadeTo(fadeTime, activeOpacity);
     });
});



