function showgallery(galID) {
	if($.browser.opera) {
		body_height = document.body.scrollHeight + 50;
	}else{
		body_height = $(document).height();
	};
    document.getElementById("MediaGalleryBlock").style.display = "block";
    document.getElementById("cover").style.display = "block";
    if (body_height < 968) {
        document.getElementById("cover").style.height = "1044px";
    } else {
        document.getElementById("cover").style.height = body_height + "px";
    }
    document.getElementById("gallery_container_box").innerHTML = "<br /><br /><center>Loading...</center><br /><br />";
	jQuery.post("http://www.downtownlondon.ca/window_contest.cfm",
	{ TSCG: galID },
		function(data){
			if (data == 0) {
				// do nothing
				alert("error");
			} else {
				$("#gallery_container_box").html(data);
			}
		}
	);
}
function hidegallery() {
	document.getElementById("MediaGalleryBlock").style.display = "none";
    document.getElementById("cover").style.display = "none";
}
function ContestVendorSelection() {
	if ($('#contest_selection').val() != "") {
		$("#contestant_value").attr("value",$('#contest_selection').val());
		$(".vendor_comment").html("Selected");
		$(".vendor").html($('#contest_selection').val());
	}
	else {
		$(".vendor_comment").html("");
		$(".vendor").html("");	
	}
}
jQuery(document).ready(function() {

	jQuery("#contest_submit").click(function() {
		if ($("#contestant_value").val() == "") {
			alert("Please select a holiday display.");
			$("#contest_selection").focus();
			return false;
		}
		if ($("#input_name").val() == "") {
			alert("Please enter your name.");
			$("#input_name").focus();
			return false;
		}
		if ($("#input_emailaddress").val() == "") {
			alert("Please enter your email address.");
			$("#input_emailaddress").focus();
			return false;
		}
		
		jQuery.post("http://www.downtownlondon.ca/ajax_submit_contest.cfm",
		{ yourcontestant: $("#contestant_value").val(), yourname: $("#input_name").val(), youremail: $("#input_emailaddress").val()},
			function(data){
				if (data == 0) {
					//$(".form_error").show();
				} else {
					$(".window_container").html(data);			
				}
			}
		);
		return false;
	});
});