// JavaScript Document

function changeFrom(option) 
{ 

	switch (option) {
		case '0':
			document.getElementById('selectFrom2').options[3] = null;		
			document.getElementById('selectFrom2').options[2] = null;
			document.getElementById('selectFrom2').options[1] = null;
			document.getElementById('selectFrom2').options[0] = new Option('Información','info@wpb.es');  								
			break;
		case '1':
			document.getElementById('selectFrom2').options[3] = null;		
			document.getElementById('selectFrom2').options[2] = new Option('David (drr00)','drr00@wpb.es'); 
			document.getElementById('selectFrom2').options[0] = new Option('Ivan','ivan@wpb.es');  
			document.getElementById('selectFrom2').options[1] = new Option('Pablo','pablo@wpb.es');  			
			break;
		case '2':
			document.getElementById('selectFrom2').options[3] = null;		
			document.getElementById('selectFrom2').options[2] = null;
			document.getElementById('selectFrom2').options[1] = null;
			document.getElementById('selectFrom2').options[0] = new Option('Cronometraje','cronometraje@wpb.es');  
			break;
		case '3':
			document.getElementById('selectFrom2').options[0] = new Option('David','david@wpb.es'); 
			document.getElementById('selectFrom2').options[1] = new Option('Jimy','jimy23@wpb.es'); 
			document.getElementById('selectFrom2').options[2] = new Option('Antonio (Brigada)','brigada@wpb.es'); 	
			document.getElementById('selectFrom2').options[3] = null;
			break;		
	}


} 


function isMail(_email) 
{
	var emailReg = /^[a-z][a-z-_0-9\.]+@[a-z-_=>0-9\.]+\.[a-z]{2,3}$/i
	return emailReg.test(_email);
}




function checkForm(theForm)
{
 theForm.txtNombre.value = trim(theForm.txtNombre.value);
 if (theForm.txtNombre.value.length == 0)
 {
    alert("Por favor introduzca su nombre");
    theForm.txtNombre.focus();
    return (false);
 }


  theForm.txtTelefono.value = trim(theForm.txtTelefono.value);
 //Chequea si el formato es de 9 dígitos
 if (theForm.txtTelefono.value.length < 9)
 {
	alert("Utilice nueve dígitos para el \"Teléfono\"");
	theForm.txtTelefono.focus();
	return (false);
 }	
 //Chequea si son todo números
 if (isNaN(theForm.txtTelefono.value)) {
	alert("El \"Teléfono\" no es correcto");
	theForm.txtTelefono.focus();
	return (false);
 }


 theForm.txtEMail.value = trim(theForm.txtEMail.value);
 if (theForm.txtEMail.value.length == 0)
 {
    alert("Por favor introduzca su e-mail");
    theForm.txtEMail.focus();
    return (false);
 } 
 if (!isMail(theForm.txtEMail.value)) 
 {
	alert("El e-mail no es correcto");
    theForm.txtEMail.focus();
    return (false);		 
 }
 
 
 theForm.txtComentarios.value = trim(theForm.txtComentarios.value);
 if (theForm.txtComentarios.value.length == 0)
 {
    alert("Por favor introduzca sus comentarios");
    theForm.txtComentarios.focus();
    return (false);
 }

 
 
 
  return (true);

}

