$(document).ready(function(){
	$('#main-container').jqTransform();

	$("button").click(function(){

		$(".formError").hide();

	});

	var use_ajax=true;
	$.validationEngine.settings={};
	
});


function form_submit() {
					
	$(document).ready( function() {
									 
		var email = $( "#yourEmail" ).val();
		var title = $( "#msgTitle" ).val();
		var content = $( "#msgContent" ).val();

		$( ".error" ).hide();
		$( ".confirm" ).hide();
									 
		if( email.length < 1 ) {
			
			$( ".error" ).show( "slow" );
			$( ".error" ).html( "You have not supplied a valid email address" );
			
		} else if( title.length < 1 ) {
			
			$( ".error" ).show( "slow" );
			$( ".error" ).html( "You have not supplied a valid title" );
			
		} else if( content.length < 1 ) {
			
			$( ".error" ).show( "slow" );
			$( ".error" ).html( "You have not supplied a valid message" );
			
		} else {
			
			/* AJAX */
			$.ajax({
			   type: "POST",
			   url: "../send-email.php",
			   data: "email="+escape( email )+"&title="+escape( title )+"&content="+escape( content ),
			   success: function(msg){
				 if( msg == "Thank you for your message, it has been sent." ) {
					 
					 $( ".confirm" ).show( "slow" );
					 $( ".confirm" ).html( "Thank you for your message, it has been sent." );
					 
			     } else {
				   
				    $( ".error" ).show( "slow" );
					$( ".error" ).html( "Your message could not be sent, try again." );
					
				 }
				   
			     }
			 });
			
		}
									 
	} );
	
}
