Cufon.replace('h1.headline, .intro .text h3, #footer .cols ul li h3', { fontFamily: 'Aller' });
Cufon.replace('.intro .text h3 strong, .post h1, #sidebar h2', { fontFamily: 'Aller Bold' });

$(window).load(function() {
	
	slideshowDelay = slideshowDelay * 1000;
	$('#navigation ul li:last-child, #sidebar .widget li:last-child, .categories-list li:last-child, .recent-posts 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();
	});
	
	$('#slider').nivoSlider({
		effect:effectType,
		slices:slideshowSlices,
		animSpeed:slideshowSpeed,
		pauseTime:slideshowDelay,
		directionNav:true, //Next & Prev
		directionNavHide:false, //Only show on hover
		controlNav:false, //1,2,3...
		keyboardNav:true, //Use left & right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.8, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){} //Triggers after all slides have been shown
	});

    $('.blink').
        focus(function() {
            if(this.title==this.value) {
                this.value = '';
            }
        }).
        blur(function(){
            if(this.value=='') {
                this.value = this.title;
            }
        });
        
    $('.recent-posts ul li').hover(
    	function() { $(this).addClass('hover'); },	
    	function() { $(this).removeClass('hover'); }	
    );
    
    $('#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(); }); }	
	    );
	}
    
    

	var sliderNavigation = "";
	
	$('.slider h2').hover(function(){
		$('.slider').find('.tooltip').show().stop().animate({'opacity':1,'top':56}, 200, 'easeOutQuad');
	},function(){
		$('.slider').find('.tooltip').stop().animate({'opacity':0,'top':51}, 200, 'easeOutQuad').hide();
	});

	$('.slider .wrapper').hover(function(){
		$(this).find('.top-bar').stop().animate({'top':0,'opacity':1}, 200, 'easeOutQuad');
		$(this).find('.nivo-nextNav,.nivo-prevNav').stop().animate({'opacity':1}, 200, 'easeOutQuad');
	},function(){
		$(this).find('.top-bar').stop().animate({'top':-45,'opacity':0}, 200, 'easeInQuad');
		$(this).find('.nivo-nextNav,.nivo-prevNav').stop().animate({'opacity':0}, 200, 'easeInQuad');
	});
	
	$('.mini-tab').click(function(){
		if (sliderNavigation == "open"){
			$(this).html('Show Navigation');
			sliderNavigation = "";
			$('.slider .wrapper').find('.bottom-bar').stop().animate({'bottom':-93}, 200, 'easeOutQuad');
		} else {
			$(this).html('Hide Navigation');
			sliderNavigation = "open";
			$('.slider .wrapper').find('.bottom-bar').stop().animate({'bottom':0}, 200, 'easeOutQuad');
		}
	});
	
});
