$(document).ready(function(){$("#copy form").submit(function(){var name=jQuery.trim(this.name.value);var email=jQuery.trim(this.email.value);var story=jQuery.trim(this.story.value);var errorFields=[];var numErrors=0;var article="a";if(name.length<1){errorFields[numErrors]="name";numErrors++;}
if(email.length<1){errorFields[numErrors]="email";if(numErrors<1)
article="an";numErrors++;}
if(story.length<1){errorFields[numErrors]="story";numErrors++;}
if(numErrors>0){var errorString=errorFields[0];if(numErrors>2)
errorString=errorString+", "+errorFields[1]+" and "+errorFields[2];else if(numErrors>1)
errorString=errorString+" and "+errorFields[1];$("#copy div.results").html("");$("#copy div.error").html("Debe ingresar "+article+" "+errorString+".");}
else{$("#copy div.results").html("");$("#copy div.error").html("");this.submit.disabled=true;$.ajax({"type":"POST","url":"submit.asp","data":{"name":name,"email":email,"story":story,"async":"1"},"dataType":"json","success":function(json){if(json.success){$("#copy form").fadeTo("slow",0.05,function(){$(this).slideUp("fast",function(){$("#copy div.results").html("Hemos recibido su historia. Gracias.");});});}
else{$("#copy div.error").html("Error de conexión del servidor. Intente nuevamente.");$("#copy form #form-submit input").disabled=false;}},"error":function(XMLHttpRequest,textStatus,errorThrown){$("#copy div.results").html("");$("#copy div.error").html("Error de conexión del servidor. Intente nuevamente.");$("#copy form #form-submit input").disabled=false;}});}
return false;});});