$(function() {
	$("form").submit(function() {
		return validate_form({
			"#full-name": "exists",
			"#email": "email",
			"#comment": "exists"
		});
	});
	
	$("#tour-photos").cycle();

	// Prevents IE from caching the images
	// IE will not call the load event when loading a cached image
	$("div#tour-photos img").each(function() {
		this.src += "?"+Math.floor(Math.random()*100000);	
	});
		
	// Center images inside the cycling div
	$("div#tour-photos img").load(function() {
		var containerWidth = parseInt($("div#tour-photos").css("width"));
		var containerHeight = parseInt($("div#tour-photos").css("height"));
		this.style.marginLeft = ((containerWidth - this.width) / 2) + "px";
		this.style.marginTop = ((containerHeight - this.height) / 2) + "px";
	});
});
Shadowbox.init({
    players:    ["iframe"]
});