//preloading 
jQuery(function () {
	//jQuery('.preload').hide();//hide all the images on the page
	jQuery('.play,.magnifier').css({opacity:0});
	jQuery('.ngg-gallery-thumbnail img').css({opacity:0});
	jQuery('.ngg-gallery-thumbnail img').addClass("animated");
	jQuery('.play,.magnifier').addClass("animated_icon");
});

var i = 0;//initialize
var cint=0;//Internet Explorer Fix
jQuery(window).bind("load", function() {//The load event will only fire if the entire page or document is fully loaded
	var cint = setInterval("doThis(i)",80);//500 is the fade in speed in milliseconds

});

function doThis() {
	var images = jQuery('.ngg-gallery-thumbnail img').length;//count the number of images on the page
	if (i >= images) {// Loop the images
		clearInterval(cint);//When it reaches the last image the loop ends
	}
	jQuery('.preload:hidden').eq(i).fadeIn(500);//fades in the hidden images one by one
	jQuery('.animated_icon').eq(0).animate({opacity:1},{"duration": 500});
	jQuery('.animated').eq(0).animate({opacity:1},{"duration": 500});
	jQuery('.animated').eq(0).removeClass("animated");
	jQuery('.animated_icon').eq(0).removeClass("animated_icon");
	i++;//add 1 to the count
}

//image effects 
jQuery(document).ready(function(){
		var image_e= jQuery(".ngg-gallery-thumbnail img");
		image_e.mouseover(function(){jQuery(this).stop().animate({ opacity:0.6
				}, 400);
		}).mouseout(function(){
			image_e.stop().animate({ 
				opacity:1
				}, 400 );
		});
});
