if($) {
	
	$(document).ready(function(){
			
			$('#contact_form').ajaxForm({  
		        
				beforeSubmit:  function(formData, jqForm, options){
		        	formData.pop(); //remove submit button from sent data
		        	formData.push({ 'name' : 'ajax' , 'value' : 'email_form' }); //to know which widget is being processed
		        }, 
		        
		        success: function(responseText) {
			       var response = $.evalJSON(responseText);
			       if(response.status==1) {
				       $('#status_messages').html('Email sent successfully');
				       //alert('Email sent successfully');
				       $('#contact_form').find('input, textarea').each(function(){
					       if(!( $(this).attr('class').match('submit_button') )) {
					       		$(this).val('');
					       }
				       });
			       } else {
				       $('#status_messages').html(response.error);
				       //alert(response.error);
			       }
		        }
			
			});
		});
}
