// AmaTech Solutions, LLC - Contact Form JS

/*contact form */

var dostuff = function(){
  //hide form container and show loading screen
      		hideElement($('#contact_form_container'));
      		showElement($('#form_loading'));
      		$('#form_loading').empty().addClass('loading');
};
var dootherstuff = function(response){
     	$('#form_loading').removeClass('loading');
      $('#form_loading').html(response);
};

$(document).bind('ready', function(){

  hideElement('#form_loading');
	$('#contact_form').bind('submit', function(e) {
		//Prevents the default submit event from loading a new page.
		      e.preventDefault();  
	
      		dostuff();
      		$.post($("#contact_form").attr("action"), 
      		      $("#contact_form").serialize(),
                function(data){
                  dootherstuff(data);
                });   
        /*
      		//Set the options of the form's Request handler. 
      		this.set('send', {onComplete: function(response) { 
            dootherstuff(response);
      		}});
      		//Send the form.
      		this.send();
       */
	});
	 hideElement($('#form_loading'));
});
 /* End Contact Form */
