/*
 * jQuery Easing v1.1 - http://gsgd.co.uk/sandbox/jquery.easing.php
 *
 * Uses the built in easing capabilities added in jQuery 1.1
 * to offer multiple easing options
 *
 * Copyright (c) 2007 George Smith
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 */
jQuery.easing={easein:function(x,t,b,c,d){return c*(t/=d)*t+b},easeinout:function(x,t,b,c,d){if(t<d/2)return 2*c*t*t/(d*d)+b;var a=t-d/2;return-2*c*a*a/(d*d)+2*c*a/d+c/2+b},easeout:function(x,t,b,c,d){return-c*t*t/(d*d)+2*c*t/d+b},expoin:function(x,t,b,c,d){var a=1;if(c<0){a*=-1;c*=-1}return a*(Math.exp(Math.log(c)/d*t))+b},expoout:function(x,t,b,c,d){var a=1;if(c<0){a*=-1;c*=-1}return a*(-Math.exp(-Math.log(c)/d*(t-d))+c+1)+b},expoinout:function(x,t,b,c,d){var a=1;if(c<0){a*=-1;c*=-1}if(t<d/2)return a*(Math.exp(Math.log(c/2)/(d/2)*t))+b;return a*(-Math.exp(-2*Math.log(c/2)/d*(t-d))+c+1)+b},bouncein:function(x,t,b,c,d){return c-jQuery.easing['bounceout'](x,d-t,0,c,d)+b},bounceout:function(x,t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b}},bounceinout:function(x,t,b,c,d){if(t<d/2)return jQuery.easing['bouncein'](x,t*2,0,c,d)*.5+b;return jQuery.easing['bounceout'](x,t*2-d,0,c,d)*.5+c*.5+b},elasin:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b},elasout:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);return a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b},elasinout:function(x,t,b,c,d){var s=1.70158;var p=0;var a=c;if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)p=d*(.3*1.5);if(a<Math.abs(c)){a=c;var s=p/4}else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b},backin:function(x,t,b,c,d){var s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b},backout:function(x,t,b,c,d){var s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},backinout:function(x,t,b,c,d){var s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b},linear:function(x,t,b,c,d){return c*t/d+b}};

/* VIX Swimwear jQuery */

jQuery(document).ready(function(){
	
	var navContainer = jQuery("#dropmenu"),
		navLi = jQuery("#dropmenu li"),
		//PANEL VARS
		thewindow = jQuery(window),
		panel = jQuery("#panel"),
		handle = jQuery("#handle"),
		panelContent = jQuery("#panelContents"),
		panelHint = jQuery("#panel #panelHint"),
		thebottom = jQuery("#bottomOfPage"),
		panelClose = jQuery("#closePanel"),
		container = jQuery("#content"),
	
		/*<![CDATA[*/
		loadingGif = "<div id='loading'></div>";
		/*]]>*/
	
		
	//PANEL STUFF			
	panel.slideDown(1000).draggable({
		handle: handle,
		axis:'y',
		//containment:[0,0],
		containment: "#panelContainer",
		drag: function() {
			$(".galleria-thumbnails").css({ 'z-index' : '999'});
			$('#loopedSlider').css({'z-index' : '999'});
			
			var handleHeight = handle.outerHeight() - 37;
			//devin adjust panel bg flashing by extending base container
			var panelHeight = panel.outerHeight() + 150;
			//var panelHeight = panel.outerHeight() - handleHeight;
			
			panelContent.css({"height":panelHeight+"px"});
		},
		stop: function() {
			
			var stopTop = thewindow.height() - handle.outerHeight();
			
			if(panelContent.height() > 185 && panelContent.height() < 550) {
				panel.animate({"top":stopTop +"px"},400, function() {
					$(".galleria-thumbnails").css({ 'z-index' : '10000'});
				});
				
			}
		}
	});
	
	//CLOSE BUTTON
	panelClose.live('click',function(){
    	var stopTop = thewindow.height() - handle.outerHeight();
		panel.stop().animate({"top":stopTop +"px"},400, "easeout");
		return false;
    });
	
	    	
	//HANDLE STUFF
	//handle.hover(function() {
		//jQuery(this).find("img").stop(true,true).fadeOut(500);
		//panelHint.stop(true,true).fadeIn(1200);
	//},function(){
		//jQuery(this).find("img").stop(true,true).fadeIn(500);	
		//panelHint.stop(true,true).fadeOut(500);
	//});
			
	//RESIZE
	thewindow.resize(function() {
		var resizeTop = thewindow.height() - handle.outerHeight();
		panel.css({"top":resizeTop +"px"});
	
	});
	
	// toggles the slickbox on clicking the noted link
	$('#slideLink, .openCollectionText').click(function() {
		$('#slideLink, .openCollectionText').toggleClass("active");
		 $('#slickBox, .collectionTextWrap').slideToggle(250);
	 		return false;
	});
	
});

$(document).ready(function() {
	//search form hide and show//
	
	jQuery(".searchToggle a").click(function(){
		$("#searchWrapper").slideToggle(200);
	});
	
	
	// fit carousel controls 
	
	$(".left").click(function(){
		  $(".moveable").animate({"left": "+=925px"}, 900, "easeout");
		 	$(".vixMoreLink").css({"display" : "block"}); 
			$(".vixPrevLink").css({"display" : "none"});
		});
		
	$(".right").click(function(){
		  $(".moveable").animate({"left": "-=925px"}, 900, "easeout");
		    $(".vixMoreLink").css({"display" : "none"}); 
			$(".vixPrevLink").css({"display" : "block"});
		});
		
		// fit carousel controls 
	
	$(".left2").click(function(){
		  $(".moveable2").animate({"left": "+=925px"}, 900, "easeout");
		  $(".vixMoreLink2").css({"display" : "block"});
		  $(".vixPrevLink2").css({"display" : "none"});
		});
		
	$(".right2").click(function(){
		  $(".moveable2").animate({"left": "-=925px"}, 900, "easeout");
		  $(".vixMoreLink2").css({"display" : "none"});
		  $(".vixPrevLink2").css({"display" : "block"}); 
		});

	
	// ViX Press //
	//To switch directions up/down and left/right just place a "-" in front of the top/left attribute
	//Vertical Sliding
	$('.boxgrid.slidedown').hover(function(){
		$(".cover", this).stop().animate({top:'0px'}, 300, "easeout");
	}, function() {
		$(".cover", this).stop().animate({top:'160px'}, 300, "easeout");
	});		
		$('.boxgrid.slideup').hover(function(){
		$(".cover", this).stop().animate({top:'0px'}, 300, "easeout");
	}, function() {
		$(".cover", this).stop().animate({top:'-160px'}, 300, "easeout");
	});
	//Horizontal Sliding
		$('.boxgrid.slideright').hover(function(){
		$(".cover", this).stop().animate({left:'325px'}, 300, "easeout");
	}, function() {
		$(".cover", this).stop().animate({left:'0px'}, 300, "easeout");
	});	
		$('.boxgrid.slideleft').hover(function(){
		$(".cover", this).stop().animate({left:'325px'}, 300, "easeout");
	}, function() {
		$(".cover", this).stop().animate({left:'0px'}, 300, "easeout");
	});	
	//Diagnal Sliding
		$('.boxgrid.diagonal-right').hover(function(){
		$(".cover", this).stop().animate({top:'260px', left:'325px'}, 300, "easeout");
	}, function() {
		$(".cover", this).stop().animate({top:'0px', left:'0px'}, 300, "easeout");
	});
	//Diagnal Sliding 2
		$('.boxgrid.diagonal-left').hover(function(){
		$(".cover", this).stop().animate({top:'-260px', left:'-325px'}, 450, "easeout");
	}, function() {
		$(".cover", this).stop().animate({top:'0px', left:'0px'}, 450, "easeout");
	});	
	
	//Caption Sliding (Partially Hidden to Visible)
	$('.collectionItem').hover(
		function(){
			//var sliderHeght = $('.slideUp',this).height();
			//console.log(sliderHeight);
			//console.log('hi');
			//$(".slideUp", this).stop().animate({bottom:'0px'}, 170);
			$(".slideUp", this).stop().animate({top:'250px'}, 170);
		}, 
		function() {
			//var sliderHeght = $('.slideUp', this).height();
			//alert(sliderHeight);
			$(".slideUp", this).stop().animate({top:'435px'}, 170);
	});
	$('.collectionItem li').hover(function(){
		$(".slideUpTitle", this).stop().animate({bottom:'0px'}, 170, "easeout");
	}, 
	function() {
		$(".slideUpTitle", this).stop().animate({bottom:'-38px'}, 170, "easeout");
	});


});
