$("document").ready(function() {

// DROPDOWN MENU
	
	$("#header ul.nav li").hover(function(){
	
	    $(this).addClass("hover");
	    $('ul:first',this).css('visibility', 'visible');
	
	}, function(){
	
	    $(this).removeClass("hover");
	    $('ul:first',this).css('visibility', 'hidden');
	
	});	



	// HOMEPAGE SLIDESHOW
	
	$("div.item-wrap") 
//	.before('<div class="featured-nav">') 
	.cycle({ 
	    fx:     'fade',  
	    timeout: 6000, 
	    //pager:  '.featured-nav',
	    cleartype: true, 
	    cleartypeNoBg: true
	});


	

});



// Image loader
function imageLoader() {
	
    $('.loader').each(function () {
					  
        var loader = $(this);
        var pathToImage = loader.attr('title');
        var img = new Image();
	  
        $(img).css("opacity", "0.0").load(function () {
								    
            loader.append(this).removeAttr('title');
		
            $(this).css("margin", "0px").css("opacity", "0.0").animate({
											     
                opacity: 1.0
		    
            },400, function () {
			
                loader.css({ "background-image": "none", "background-color": "transparent" });
		    
            });
		
        }).attr('src', pathToImage);
	  
    });
    
}

$("document").ready(function() {
    imageLoader();
});


