function showForm(){
	$("#fields").show("fast");
	$("#note").hide("fast");
}
function hideForm(){
	$("#fields").hide("fast");
	$("#note").show("fast");
}
$(document).ready(function(){
	
	// fix height before toggling
	var $Contact = $('#Contact');
	var ContactElement = $Contact[0];

	$("#Contact").css({
		'height': ContactElement.offsetHeight + 'px'
	});
	
	$("#note").hide();

	$("#ajax-contact-form").submit(function(){


		var str = $(this).serialize();

		$.ajax({
			type: "POST",
			url: "contact.php",
			data: str,
			success: function(msg){

				$("#note").ajaxComplete(function(event, request, settings){

					// Message Sent? Show the 'Thank You' message and hide the form
					if(msg == 'OK') {
						hideForm();
						result = '<div class="notification_ok"><p>Your message has been sent. Thank you!</p><p>We will get back to you as soon as possible.</p><p class="sig"><a href="mailto:mashimakers@mashi.tv">Uli &amp; Alp</a></p></div>';
					}
					// Message Sent? Show the 'Thank You' message and hide the form
					else {
						hideForm();
						result = '<div class="notification_error">' + msg + '</div>';
						result+= '<br/<br/><input type="button" class="fieldSubmit" onclick="showForm()" value="Back to form" name="btnBack" />';

					}
					$(this).html(result);

				});
			}
		});
		return false;
	});
});
