$(window).load(function() {
	$(".contact-form .no-js").hide();
	$(".contact-form form").show();
	$(".contact-form .moreinfo").show();
	$("#venue_spec").search();
	$("select#typeevent").change(function () {
		var str = "";
		resetVenueDropdowns ();
		$("select#typeevent option:selected").each(function () {
			str = $(this).val();
		});
		$(".moreinfo").children().hide();
		// console.log(str);
		$("#moreinfo-" + str).show();
		
		// Enable appropriate dropdown
		$(".venue-" + str + " .venue-dropdown").removeAttr("disabled");
		$(".venue-" + str).show();
	}).change();
	
	$(".venue-outdoor-catering select").change(function () {
		if ($(this).val() == "Others") {
			$("#venue_spec").removeAttr("disabled");
			$("#venue_spec").show();
		} else {
			$("#venue_spec").attr("disabled", "true");
			$("#venue_spec").hide();
		}
	}).change();
});

function resetVenueDropdowns () {
	$(".venue-dropdown").each(function() {
		$(this).attr("disabled", "true");
		$(this).parent().hide();
	});
	$("#venue_spec").attr("disabled", "true");
	$("#venue_spec").hide();
}

// Clear Search Box
$.fn.search = function() {
	return this.focus(function() {
		if( this.value == this.defaultValue ) {
			this.value = "";
		}
	}).blur(function() {
		if( !this.value.length ) {
			this.value = this.defaultValue;
		}
	});
};