// Requires JQuery : http://jquery.com/
// Requires jQuery URL Parser : http://projects.allmarkedup.com/jquery_url_parser/

$(document).ready(function(){

	// Get the value of 'enquiry' from the current URL
	var enquiry = jQuery.url.param("enquiry");
	
	// Check the enqury value for 'and' and replace with &
	if (enquiry == "Web - Sales and Marketing") {
		var enquiry = "Web - Sales & Marketing";
	}
	
	
	
	// If a value was set, change the selection to the matching enquiry.
	// If value is set but doesn't match, the first option will be selected.
	if (enquiry){
		$("#enquiry_type_select").val(enquiry).attr("selected", "selected");
		$("p.askus_intro").html("You've indicated that you're interested in <strong>" + $("#enquiry_type_select option:selected").text() + "</strong>.");
	}
	// Enquiry was not set at all, so select the first one to avoid any errors.
	else 
	{
		$("#enquiry_type_select").val("Web - General Sales Enquiry").attr("selected", "selected");
		$("p.askus_intro").html("Please complete the form below and one of our account managers will be in touch within 12 hours.");
	}
	
});
