function initContactLink() {
	$("div.contactButton").click(function(){
		$(".quickContact").animate({ height: "440px" }).animate({ height: "340px" }, "fast");
		$("div.contactButton").toggle();
	});
	$('div.hideButton').click(function(){
		$(".quickContact").animate({ height: "0px" }, "fast");
	});	
	  $('div.doneButton').click(function(){
		$('.quickContact').animate({ height: "0px" }, "fast");
		$('div.contactButton').toggle();
	});	
}
function initContactFormSubmit() { 
	var options = { 
		target:        '#hiddenDIV',   // target element(s) to be updated with server response 
	    beforeSubmit:  beforePost,  // pre-submit callback 
	    success:       afterPost  // post-submit callback 
	}
	$('#quickContactForm').validate({
	    submitHandler: function(form) {
			$('#quickContactForm').ajaxSubmit(options);
		}
	});
	// pre-submit callback 
	function beforePost() { 
		$("#contactSubmit").hide();
		$("#submitMessage").show();
	    // here we could return false to prevent the form from being submitted; 
	    // returning anything other than false will allow the form submit to continue 
	    return true; 
	} 
	// post-submit callback 
	function afterPost(rtn)  { 
		var successcontact = rtn.substring(0,7);
	    if(rtn=="success") {
	      	$("#quickContactForm").hide();
			$("#contactNotification").fadeIn("slow");
		}else{
	        //there was an error, so grab the UL in the content ID, 
	        //inside the hidden DIV, and put it into the Message Notification
	      $("#errorMessage").html( $("#hiddenDIV #content ul").html() );
		  $("#hiddenDIV").empty(); 
	     }
	}
}
function initZindex() {
	$(function() {
		var zIndexNumber = 1000;
		$('div').each(function() {
			$(this).css('zIndex', zIndexNumber);
			zIndexNumber -= 10;
		});
	});
	$('#masthead').css('zIndex', 500);
}
$(document).ready(function() {
	initContactLink();
	initContactFormSubmit();
	initZindex();
});
	