$(document).ready(function(){
					   
//jquery

   
      $.fn.clearForm = function() {
   
        return this.each(function() {
   
          var type = this.type, tag = this.tagName.toLowerCase();
   
          if (tag == 'form')
   
            return $(':input',this).clearForm();
   
          if (type == 'text' || type == 'password' || tag == 'textarea')
   
           this.value = '';
   
          else if (type == 'checkbox' || type == 'radio')
  
          this.checked = false;
  
        else if (tag == 'select')
  
            this.selectedIndex = -1;
  
        });

      };




	$("#contact-form").submit(function(e){			
			
			
				$('#preloader').show();
				
				$.post('modules/contact/send.php',$(this).serialize(), 
																	
																	function(data){
						//alert(data);
						if(parseInt(data)==-1){
						$("#messageerrors").html(data.substr(2));
							//$.validationEngine.buildPrompt("#captcha","* Wrong verification number!","error");
						}
						else
						{
							$("#contact-form").hide('slow');
							$('#contact-form').clearForm();
							$("#messageerrors").html(data);
							//.after('<h1>Thank you!</h1>');
						}
						
						$('#preloader').hide();
					}
																	
																	);
				return false;
	})

});


