/*********************************************************************************
							--jQuery image preloader--
**********************************************************************************/
		
$(function () {
	$('.gallery img').hide();//hide all the images on the page
});

var i = 0;//initialize
var int=0;//Internet Explorer Fix
$(window).bind("load", function() {//The load event will only fire if the entire page or document is fully loaded
	var int = setInterval("doThis(i)",500);//500 is the fade in speed in milliseconds
});

function doThis() {
	var imgs = $('.gallery img').length;//count the number of images on the page
	if (i >= imgs) {// Loop the images
		clearInterval(int);//When it reaches the last image the loop ends
	}
	$('.gallery img:hidden').eq(0).fadeIn(500);//fades in the hidden images one by one
	i++;//add 1 to the count
}

$(document).ready(function(){
	$(".kwicks li img").fadeTo("slow", 0.65); // This sets the opacity of the thumbs to fade down to 30% when the page loads
	$(".kwicks li img").hover(function(){
	$(this).fadeTo("slow", 1.0); // This should set the opacity to 100% on hover
	},function(){
	$(this).fadeTo("slow", 0.65); // This should set the opacity back to 30% on mouseout
	});
});

$(document).ready(function(){
	$("#gallery2 ul li img.a").fadeTo("slow", 0); // This sets the opacity of the thumbs to fade down to 30% when the page loads
	$("#gallery2 ul li img.a").hover(function(){
	$(this).fadeTo("slow", 1.0); // This should set the opacity to 100% on hover
	},function(){
	$(this).fadeTo("slow", 0); // This should set the opacity back to 30% on mouseout
	});
});

$(document).ready(function(){
	$("#gallery3 ul li img.a").fadeTo("slow", 0); // This sets the opacity of the thumbs to fade down to 30% when the page loads
	$("#gallery3 ul li img.a").hover(function(){
	$(this).fadeTo("slow", 1.0); // This should set the opacity to 100% on hover
	},function(){
	$(this).fadeTo("slow", 0); // This should set the opacity back to 30% on mouseout
	});
});
