$(document).ready(function(){
	if ($("#slideshowContainer #slideshow .slideText").length) {
		if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) { 
			var ffversion=new Number(RegExp.$1) // capture x.x portion and store as a number
			if (ffversion < 3.5) $("#slideshowContainer #slideshow .slideText").css({"font-size": "2.4em", "line-height" :"1em"});
		}
	}
	
	if ($("#contactUsForm").length) {
		$("#contactSelectionField input:checked").each(function f() {
			if ($(this).val() == "email") $("#contactEmailField").removeClass("hidden");
			if ($(this).val() == "phone") $("#contactPhoneField").removeClass("hidden");
		});
		$("#contactSelectionField input").change(function f() {
			if ($(this).val() == "email") {
				$("#contactEmailField").removeClass("hidden");
				$("#contactPhoneField").addClass("hidden");
			} else {
				$("#contactEmailField").addClass("hidden");
				$("#contactPhoneField").removeClass("hidden");
			}
		});
		
		$("#contactUsForm #details").focus(function f() {
			if ($(this).val() == "Provide any details for items you would like to discuss.") $(this).val("");
		});
		
		$("#contactUsForm").submit(function f(e) {
			var hasError = false;
			$("#errorContainer").empty();
			$("#contactUsForm input:not(.hidden input)").each(function g() {
				if (!$(this).val()) {
					hasError = true;
					$("#errorContainer").append("<p>Please enter a value for "+ $(this).attr("id") +".</p>")
				}
			});
			if (!$("#contactSelectionField input:checked").length) {
				hasError = true;
				$("#errorContainer").append("<p>Select a method for contacting you.</p>")
			}
				
			if (hasError) e.preventDefault();
		});
	}
});
