Cufon.replace('#comments, #respond h2,.nivo-caption span.h3, .nivo-caption span.price');
Cufon.replace('.page-title, .sub-title', { letterSpacing: '-1px' });
Cufon.replace('#navigation > ul > li > a');

$(window).load(function() {
	
	var zIndexNumber = 1000;
	$('div').each(function() {
		$(this).css('zIndex', zIndexNumber);
		zIndexNumber -= 10;
	});

	
	$('.featured-images').nivoSlider({
		animSpeed: 800,
		pauseTime: 6000,
		startSlide:0,
		effect:'random',
		controlNav: false,
		directionNav: true,
		directionNavHide: true,
		captionOpacity: 0.8,
		afterChangingCaption : function() {
			Cufon.refresh();
		}
	});
	
	$('#navigation ul li:last-child').addClass('last');
	
	$('#navigation ul.sub-menu').each(function(){
		$(this).wrap('<div class="drop-down" />');
		$(this).wrap('<div class="wrapper" />');
		$('#navigation .wp3-nav').find('.wrapper').prepend('<span class="pointer notext">&nbsp;</span>');
		$('#navigation .wp3-nav ul').show();
	});
    
    $('#navigation ul li').each(function(){
    	if ($(this).children('.drop-down').size() > 0) {
    		$(this).find('a:first').addClass('hasChild');
    	}
	});
    
	
	if($.browser.msie) {
	    $('#navigation ul li').hover(
	    	function() { $(this).find('.drop-down:first').show().stop().animate({'top':20}, 200);  },
	    	function() { $(this).find('.drop-down:first').stop().animate({ 'top':15 }, 150, function(){ $(this).hide(); }); }	
	    );
	    
	    $('#navigation ul li ul li').hover(
	    	function() {  $(this).find('.drop-down:first').show().stop().animate({'top':-29}, 200); },
	    	function() { $(this).find('.drop-down:first').stop().animate({ 'top':-34 }, 150, function(){ $(this).hide(); }); }	
	    );
	    
	}else{
		$('#navigation ul li').hover(
	    	function() { $(this).find('.drop-down:first').show().stop().animate({'opacity':1,'top':20}, 200); },
	    	function() { $(this).find('.drop-down:first').stop().animate({'opacity':0,'top':15}, 150, function(){ $(this).hide(); }); }	
	    );
	    $('#navigation ul li ul li').hover(
	    	function() { $(this).find('.drop-down:first').show().stop().animate({'opacity':1,'top':-29}, 200); },
	    	function() { $(this).find('.drop-down:first').stop().animate({'opacity':0,'top':-34}, 150, function(){ $(this).hide(); }); }	
	    );
	}

});


$(document).ready(function(){ // This sets the opacity of the thumbs to fade down to 60% when the page loads
$(".cards img").fadeTo("slow", 0.5);

$(".cards img").hover(function(){
$(".cards img").fadeTo("slow", 1.0); // This sets the opacity to 100% on hover
},function(){
$(".cards img").fadeTo("slow", 0.5); // This sets the opacity back to 60% on mouseout
});
});

