
$(document).ready(function() {

	$(".hideOther").hide();
	$("#postResult").hide();
	
	$("#product").change(function () {
    	if($("option:selected",$(this)).text() == 'Other (please specify)'){
    		$(".hideOther").show();
    		$(".hideProduct").hide();
    	}	    	
    });
	
	//add onsubmit event to form
	$("#formFAQ").submit(function() {
		
			
			
			
		if (validateForm($(this),"#validationMessage")){
			if (validateField("otherproduct",$(this),"Please specify your product.","#validationMessage")){
			
				$("#submitButton").hide();
				$("#validationMessage").removeClass().text("enviando...");
		
				$.post("../include/emailFAQ.php", $(this).serialize(), function(){  	
					//if(data.length > 0 ){
    		   		
    		   			$("#faq_form").html("<div style='height:130px'><p class='rightPaleHeader'>Gracias. Su pregunta fue enviada.</p></div>");
    		   			$("#formFAQ").html("<b></b>");
						$("#formFAQ").hide();
    		   			
						//$("#postResult").show();
					
					
					//}
    	   	
					return false;
				});
			}
		}
		
		return false;		
		
	});
	

});
