function clickclear(thisfield, defaulttext) {
	if (thisfield.value == defaulttext) {
		thisfield.value = "";
	}
}

function clickrecall(thisfield, defaulttext) {
	if (thisfield.value == "") {
		thisfield.value = defaulttext;
	}
}

$(document).ready(function(){

	$("#ebutton").click(function () {
		$("#email").fadeOut("fast", function() {
			emailChal();}
		);
	});
	
	function emailChal() {
	
		var str = $("#emailform").serialize();
	
		$.ajax({ 
			type: "POST", 
			url: "testform2.php", 
			data: str,
			error: function() {
				console.log("Failed to Submit");
			},
			success: function(html){ 
				$("#resp").html(html);
			},
			complete: function() {
				$("#resp").fadeIn("fast");

				$("#backbutton").bind("click", function () {
					$("#resp").fadeOut("fast");
					$("#formname").val("Your name");
					$("#formfrom").val("Your email");
					$("#formto").val("Their email");
					$("#email").fadeIn("fast");
				});
				
			}

		});
	}

});