$(function() {
	// 123
	$("#form-enquiry-submit").click(function() {
		$(".contactus-details-item-form").fadeTo(0, 0.33);
		$.get("../../functions/form-contactus.php", { name: $("#name").val(), telephone: $("#telephone").val(), email: $("#email").val(), department: $("#department").val(), enquiry: $("#enquiry").val() },
		function(data){
			if (data=="formsubmitted") {
				$(".contactus-details-item-form").remove();
				$("#form-enquiry-holder").append('<div class="contactus-details-item-sent"><img src="../styles/default/img/contact/thanks.png" width="151" height="21" /><br />Thank you for your enquiry.<br />One of our customer service representitives will contact you shortly.</div>');
			} else {
				alert(data);
				$(".contactus-details-item-form").fadeTo(0, 1);
			}
		});
		return false;
	});
	
	$("#directions-getdirections").click(function () {
		if ($("#directions-postcode").val() != "") {
			var location = "directions.php?postcode=" + $("#directions-postcode").val();
			window.open(location,"directcarsdirections","menubar=no,location=no,width=700,height=500,toolbar=no,scrollbars=yes,resizable=false");
		} else {
			alert("Please enter your postcode");
		}
	});
	// 
});
