jQuery(document).ready(function(){
	$('#branding img').hover(
		function(){
			$(this).animate({
				//opacity:"1",
				paddingLeft:"5px"
			}, 150, "easeOutQuart");
		}, function(){
			$(this).animate({
				//opacity:"0.8",
				paddingLeft:"0"
			}, 150, "easeOutQuart");
		}
	);
	$('.truckClass a').hover(
		function(){
			$(this).parent().animate({
				marginLeft:"20px",
				marginRight:"0px"
			}, 300, "easeOutQuart");
		}, function(){
			$(this).parent().animate({
				marginLeft:"0px",
				marginRight:"20px"
			}, 150, "easeInOutQuad");
		}
	);
	/*
	$('#access ul.menu').children('li').hover(
		function(){
			$(this).children('a').css("text-shadow", "0px 3px 3px rgba(0,0,0,0.01)");
			$(this).children('ul.sub-menu').animate({
				opacity:["1","easeOutQuart"],
				height:["show", "easeOutQuart"]
			}, 300);
		}, function(){
			if($(this).hasClass('current_page_item')){
				$(this).children('a').css("text-shadow", "0px 3px 3px rgba(0,0,0,0.01)");
			}else if ($(this).hasClass('current-menu-ancestor')){
				$(this).children('a').css("text-shadow", "0px 3px 3px rgba(0,0,0,0.01)");
			}else if ($(this).hasClass('current-menu-item')){
				$(this).children('a').css("text-shadow", "0px 3px 3px rgba(0,0,0,0.01)");
			}else if ($(this).hasClass('current-menu-parent')){
				$(this).children('a').css("text-shadow", "0px 3px 3px rgba(0,0,0,0.01)");
			}else{
				$(this).children('a').css("text-shadow", "0px 3px 3px rgba(0,0,0,0.5)");
			}
			$(this).children('ul.sub-menu').animate({
				opacity:["0","easeOutQuart"],
				height:["hide", "easeOutQuart"]
			}, 300);
		}
	);
	$('#access ul.menu ul').children('li').hover(
		function(){
			$(this).children('a').css("text-shadow", "0px 1px 3px rgba(0,0,0,0.01)");
			$(this).children('ul.sub-menu').animate({
				opacity:["1","easeOutQuart"],
				height:["show", "easeOutQuart"]
			}, 300);
		}, function(){
			$(this).children('a').css("text-shadow", "0px 1px 3px rgba(0,0,0,0.5)");
			$(this).children('ul.sub-menu').animate({
				opacity:["0","easeOutQuart"],
				height:["hide", "easeOutQuart"]
			}, 300);
		}
	);*/
	$('#access ul ul a').hover(
		function(){
			$(this).css("text-shadow", "0px 1px 3px rgba(0,0,0,0.01)");
			$(this).animate({
				paddingRight:"5px",
				paddingLeft:"15px"
			}, 150, "easeOutQuart");
			$(this).parent().animate({
				backgroundColor:"#e6e4cf"
			}, 150, "easeOutQuart");
		}, function(){
			$(this).css("text-shadow", "0px 1px 3px rgba(0,0,0,0.5)");
			$(this).animate({
				paddingRight:"10px",
				paddingLeft:"10px"
			}, 150, "easeOutQuart");
			$(this).parent().animate({
				backgroundColor:"#cac89e"
			}, 150, "easeOutQuart");
		}
	);
	$('.postImage img').hover(
		function(){
			$(this).css("box-shadow", "0px 3px 10px rgba(0,0,0,0.5)");
			$(this).css("-moz-box-shadow", "0px 3px 10px rgba(0,0,0,0.5)");
			$(this).css("-webkit-box-shadow", "0px 3px 10px rgba(0,0,0,0.5)");
		}, function(){			
			$(this).css("box-shadow", "0px 3px 3px rgba(0,0,0,0.01)");
			$(this).css("-moz-box-shadow", "0px 3px 3px rgba(0,0,0,0.01)");
			$(this).css("-webkit-box-shadow", "0px 3px 3px rgba(0,0,0,0.01)");
		}
	);
	$('.postImage').hover(
		function(){
			//$(this).animate({shadow:'0px 5px 5px #666'}, 'fast');
			$(this).animate({
				marginTop:["0px", "easeOutQuart"],
				borderTopColor:["#a4ac6c", "easeOutQuart"],
				borderRightColor:["#a4ac6c", "easeOutQuart"],
				borderBottomColor:["#a4ac6c", "easeOutQuart"],
				borderLeftColor:["#a4ac6c", "easeOutQuart"]
			}, 150);
		}, function(){
			//$(this).animate({shadow:'0px 0px 0px #FFF'}, 'fast');
			$(this).animate({
				marginTop:["5px", "easeOutQuart"],
				borderTopColor:["white", "easeOutQuart"],
				borderRightColor:["white", "easeOutQuart"],
				borderBottomColor:["white", "easeOutQuart"],
				borderLeftColor:["white", "easeOutQuart"]
			}, 150);
		}
	);
	$('.post #postContent').hover(
		function(){
			$(this).children('.entry-meta').animate({
				opacity:["1","easeOutQuart"]
			}, 150);
			$(this).find('.entry-summary a').animate({
				opacity:["1","easeOutQuart"]
			}, 650);
		}, function(){
			$(this).children('.entry-meta').animate({
				opacity:["0.3","easeOutQuart"]
			}, 150);
			$(this).find('.entry-summary a').animate({
				opacity:["0.3","easeOutQuart"]
			}, 650);
		}
	);
	$('#slider').nivoSlider({
		effect:'random', //Specify sets like: 'fold,fade,sliceDown'
		slices:27,
		animSpeed:700, //Slide transition speed
		pauseTime:8000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:true, //Next & Prev
		directionNavHide:true, //Only show on hover
		controlNav:true, //1,2,3...
		controlNavThumbs:false, //Use thumbnails for Control Nav
		controlNavThumbsFromRel:false, //Use image rel for thumbs
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left & right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.9, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){} //Triggers after all slides have been shown
	});
	$('.categorySlider').nivoSlider({
		effect:'random', //Specify sets like: 'fold,fade,sliceDown'
		slices:13,
		animSpeed:400, //Slide transition speed
		pauseTime:4000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:false, //Next & Prev
		directionNavHide:true, //Only show on hover
		controlNav:false, //1,2,3...
		controlNavThumbs:false, //Use thumbnails for Control Nav
		controlNavThumbsFromRel:false, //Use image rel for thumbs
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left & right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.9, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){} //Triggers after all slides have been shown
	});
	
	interval = setInterval( "crossSellSwitch()", 8000 );
	$('#crossSell').hover(function() {
	    clearInterval(interval);
	}, function(){
		interval = setInterval( "crossSellSwitch()", 8000 );
	});
});
function crossSellSwitch() {
    var $active = $('#crossSell div.active');
    if ( $active.length == 0 ) $active = $('#crossSell div:last');

    var $next =  $active.next().length ? $active.next()
        : $('#crossSell div:first');
	
	$active.addClass('last-active').animate({
		opacity:["0.01","easeInOutBack"],
		marginTop:['-142px', "easeInOutBack"]
	}, 500);
	$next.addClass('active').animate({
		opacity:["1","easeInOutBack"],
		marginTop:['0px', "easeInOutBack"]
	}, 500, function(){
		$active.removeClass('active last-active');
	});
}
