$(document).ready(function(){
	$('#contact-form').jqTransform();

	$("button").click(function(){

		$(".formError").hide();

	});

	var use_ajax=true;
	$.validationEngine.settings={};

	$("#contact-form").validationEngine({
		inlineValidation: false,
		promptPosition: "centerRight",
		success :  function(){use_ajax=true},
		failure : function(){use_ajax=false;}
	 })

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

			if(!$('#subject').val().length)
			{
				$.validationEngine.buildPrompt(".jqTransformSelectWrapper","* This field is required","error")
				return false;
			}
			
			if(use_ajax)
			{
				$('#loading').css('visibility','visible');
				$.post('submit.php',$(this).serialize()+'&ajax=1',
				
					function(data){
						if(parseInt(data)==-1)
							$.validationEngine.buildPrompt("#captcha","* Wrong verification number!","error");
							
						else
						{
							$("#contact-form").hide('slow').after('<h3>Your message has been sent!</h3><br/>Thank you for your interest in our growing company.  GENICON specializes in the concept, design, manufacture and distribution of Minimally Invasive Surgical devices, focused in the field of Laparoscopic surgery. Our patented, award winning product line was created to meet the needs of the most demanding surgeon and the economic constraints facing every healthcare system around the world.  Within our family of dedicated stocking Distributors, we have covered several countries around the globe, but yet, there remains many more to open. <br/><br/>Perhaps your interest will yield a long lasting working relationship with our firm, where you find that our state-of-the-art product offering is only rivaled by our dedication to Customer Service and Sales Support.  In the near future, your local GENICON Market Manager will be in contact with you to explore how we may forge a relationship together.  During the interim, if you have any additional questions or comments, please do not hesitate to contact directly at any time.<br/><br/>We thank you for your interest in our company and our products for minimally invasive surgery.Your Market Manager will be contacting your shortly.<br/><br/>Gary Haberland President - CEO');
						}
						
						$('#loading').css('visibility','hidden');
					}
				
				);
			}
			e.preventDefault();
	})

});
