$(function() { // remove default content from contact form fields on focus $("#contact-form input[@type=text], #contact-form textarea").focus(function(){ var v = $(this).val(); if( v in oc(["Name", "Phone","Email","Enter a brief description of your requirements here and we'll have someone contact you ASAP."]) ) { $(this).val(""); } }); // show confirmation message, then switch back to form var status = $(".sentmessage").css("display"); if ( status=="block" ) { $(".sentmessage").fadeTo(3000, 1).hide(1000, function() { $("#contact-form div").show(2000); }); } // populate the form division field var div = $("body").attr("id"); $("#contact-division").val(div); }); function oc(a) { var o = {}; for(var i=0;i