/* Author: Julius Getz Mørk | Getz:it (www.getzit.no) | julius@getzit.no */

/* Shopping cart */
jQuery(document).ready(function($){
	
	/* remove no-sj class from HTML-tag, so we know that js is activated */
	$('html').removeClass('no-js');
	
	
	/* Show the shopping cart on hover, with a delay on fadeout so we don't loose the hover while moving the pointer over to the shopping cart container  */
	$('#shopping').hover(
		function(){
			$(".shoppingcart").stop(true, true).fadeIn();
		},
        function(){
			$(".shoppingcart").stop(true, true).delay(1500).fadeOut('slow');
		}
	);
	
	/* Sub menu for main nav */
	$("#main-nav ul.menu ul").css({ display: 'none' });
	
	$("#main-nav ul.menu > li").hover(function() {
		window.log("mouse in")
		if ($(this).find('ul.sub-menu').length > 0){
		  $(this).find('ul.sub-menu').stop(true, true).delay(50).animate({ "height": "show", "opacity": "show" }, 200 );
		  $("#main-nav ul.menu > li > a").css({ opacity: "0.4" });
		  $("#main-nav ul.menu > li").css({ color: "#b0afaf" });
		}
	}, function(){
		window.log("mouse out")
		$(this).find('ul.sub-menu').stop(true, true).delay(50).animate({ "height": "hide", "opacity": "hide" }, 200 );
		$("#main-nav ul.menu > li > a").css({ opacity: "1" });
		$("#main-nav ul.menu > li").css({ color: "#8e8c8c" });
	});
	
	
	/* animate hover on prev/next buttons  */
	$(".product-prev-next > a > div").fadeTo(1000 ,0.5);
	$('.product-prev-next > a').hover(		
		function(){
			window.log("mouse in")
			if ($(this).find('.prev').length > 0){ 
				$(this).find("div").stop(true, true).animate({ 
				left: '+=35', opacity: 1 }, 'slow');
			} else { 
				$(this).find("div").stop(true, true).animate({ 
				right: '+=35', opacity: 1 }, 'slow');
			}
			
		},
        function(){
			window.log("mouse out")
			if ($(this).find('.prev').length > 0){ 
				$(this).find("div").stop(true, true).animate({ 
				left: '-25', opacity: 0.5 }, 'slow');
			} else { 
				$(this).find("div").stop(true, true).animate({ 
				right: '-25', opacity: 0.5 }, 'slow');
			}
			
		}
	);

});


	

























