$(document).ready(function(){
						   
	// Animated Image Preload Effect
	// Courtesy of Sean Corey at http://5-squared.com
	
	$('.imgfade').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
		int = setInterval("doThis(i)",500);
	});

	function doThis() {
		var images = $('.imgfade').length;//count the number of images on the page
		if (i >= images) {// Loop the images
			clearInterval(int);//When it reaches the last image the loop ends
			delete int;
		}
		$('.imgfade:hidden').eq(0).fadeIn(500);//fades in the hidden images one by one
		i++;//add 1 to the count
	}

$(document).ready(function(){
	
	$(".imgfade").hover(function(){
	$(this).fadeTo("slow", 1.2); // This sets the opacity to 100% on hover
	},function(){
	$(this).fadeTo("slow", 1.0); // This sets the opacity back to 70% on mouseout
	});
	
	// Activate PrettyPhoto
	$("a[rel^='prettyPhoto']").prettyPhoto({
		animationSpeed: 'normal', // fast/slow/normal
		padding: 40, // padding for each side of the picture
		opacity: 0.35, // Value betwee 0 and 1
		showTitle: true, // true/false
		counter_separator_label: '/', // The separator for the gallery counter 1 "of" 2
		theme: 'light_rounded', // light_rounded / dark_rounded / light_square / dark_square
		callback: function(){}
	});
	
	// Ajax Submit
	// Full documentation on this can be found at http://www.position-absolute.com/articles/jquery-form-validator-because-form-validation-is-a-mess/
	$("#contactform").validationEngine({
		ajaxSubmit: true,
			ajaxSubmitFile: "../includes/ajaxSubmit.php", // form processing file
			ajaxSubmitMessage: "Thank you, we received your information!", // success message
		success :  false,
		failure : function() {}
	});
	
	$(".widget:first").addClass("first");
	$(".widget li:last").addClass("item-last");
	$("#related li:last").addClass("item-last");
	$("#footerwidgets .singlecol:last").addClass("last");
	
});