// adds the fading effect when an image is wraped with an anchor tag and a animation class added to it
$(window).load(function(){

	$(".gallery-item a, .image-box a, .image-box a.video").hover(function(){
		$("img", this).stop().animate({ "opacity": 0.3 }, 400);
		}, function() {
		$("img", this).stop().animate({ "opacity": 1 }, 250);
	});
	
	
});

// Adds prettyphoto relevence to the gallery shortcode when used inside of a template.
$(document).ready(function(){

   $(".gallery-icon a").prettyPhoto();

});
	


// Dropdown menu
$(document).ready(function () {	

    $(".menu-top ul li").hover(function(){
    
        $(this).addClass("hover");
        $('ul:first',this).css('visibility', 'visible');
    
    }, function(){
    
        $(this).removeClass("hover");
        $('ul:first',this).css('visibility', 'hidden');
    
    });
    
    $(".menu-top ul li:has(ul)").find("a:first").append("<span></span>");

});

//dropdown easing
$(document).ready(function () {	
	
	$(".menu-top li").hover(
		function () {
			//show its submenu
			$("ul", this).css('display','none').slideDown(200);
			//adding: .css('display','none') fixes animation on first try issue		

		}, 
		function () {
			//hide its submenu
			$("ul", this).css('display','none').slideUp(200);
			//adding: .css('display','none') fixes animation on first try issue		
		}
	);
	
});
