function MM_validateBuscador() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateBuscador.arguments;
    for (i=0; i<(args.length-2); i+=3){
		test=args[i+2];
		val=document.forms['buscador'].elements[(args[i])];	
		valor=val.value;	

		if (val){
			nm=val.name;
			if(nm=="sName"){			
				nm="el texto a buscar";	
			}
			if((val=valor)!=""){
				if (test.indexOf('isEmail')!=-1) {
					p=val.indexOf('@');
					if (p<1 || p==(val.length-1)) errors+='- '+val+' no es un email válido.\n';
				}else if (test!='R') {
					num = parseFloat(val);
					if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
					if (test.indexOf('inRange') != -1) {
						p=test.indexOf(':');
						min=test.substring(8,p);
						max=test.substring(p+1);
						if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
					}
				}
			}else if(test.charAt(0) == 'R')errors += '- '+nm+' debe estar completo.\n';
		}
    }
	if (errors) alert('Error al enviar el formulario:\n'+errors);
    document.MM_returnValue = (errors == '');
} }

function MM_validateFormLogin() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateFormLogin.arguments;
    for (i=0; i<(args.length-2); i+=3){
		test=args[i+2];
		val=document.forms['login'].elements[(args[i])];	
		if(val.value=="usuario" || val.value=="password"){			
			valor="";			
		}else{
			valor=val.value;	
		}
		if (val){
			nm=val.name;
			if(nm=="customerName"){			
				nm="usuario";	
			}
			if(nm=="customerPassword"){			
				nm="password";	
			}
			if((val=valor)!=""){
				if (test.indexOf('isEmail')!=-1) {
					p=val.indexOf('@');
					if (p<1 || p==(val.length-1)) errors+='- '+val+' no es un email válido.\n';
				}else if (test!='R') {
					num = parseFloat(val);
					if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
					if (test.indexOf('inRange') != -1) {
						p=test.indexOf(':');
						min=test.substring(8,p);
						max=test.substring(p+1);
						if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
					}
				}
			}else if(test.charAt(0) == 'R')errors += '- '+nm+' debe estar completo.\n';
		}
    }
	if (errors) alert('Error al enviar el formulario:\n'+errors);
    document.MM_returnValue = (errors == '');
} }

function MM_validateFormLogin2() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateFormLogin2.arguments;
    for (i=0; i<(args.length-2); i+=3){
		test=args[i+2];
		val=document.forms['login2'].elements[(args[i])];	
		if(val.value=="usuario" || val.value=="password"){			
			valor="";			
		}else{
			valor=val.value;	
		}
		if (val){
			nm=val.name;
			if(nm=="customerName"){			
				nm="usuario";	
			}
			if(nm=="customerPassword"){			
				nm="password";	
			}
			if((val=valor)!=""){
				if (test.indexOf('isEmail')!=-1) {
					p=val.indexOf('@');
					if (p<1 || p==(val.length-1)) errors+='- '+val+' no es un email válido.\n';
				}else if (test!='R') {
					num = parseFloat(val);
					if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
					if (test.indexOf('inRange') != -1) {
						p=test.indexOf(':');
						min=test.substring(8,p);
						max=test.substring(p+1);
						if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
					}
				}
			}else if(test.charAt(0) == 'R')errors += '- '+nm+' debe estar completo.\n';
		}
    }
	if (errors) alert('Error al enviar el formulario:\n'+errors);
    document.MM_returnValue = (errors == '');
} }


function MM_validateFormContact() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateFormContact.arguments;
    for (i=0; i<(args.length-2); i+=3){
		test=args[i+2];
		val=document.forms['consulta'].elements[(args[i])];	
		/*
		if(val.value=="nombre y apellido" || val.value=="email"){			
			valor="";			
		}else{
			valor=val.value;	
		}
		*/
		valor=val.value;
		if (val){
			nm=val.name;
			if(nm=="txtFirstName"){			
				nm="Nombre y Apellido";	
			}
			if(nm=="txtEmail"){			
				nm="E-mail";	
			}
			if(nm=="txtPhone"){			
				nm="Teléfono";	
			}
			if(nm=="txtCity"){			
				nm="Ciudad";	
			}
			if(nm=="Comentario"){			
				nm="Comentario";	
			}
			if((val=valor)!=""){
				if (test.indexOf('isEmail')!=-1) {
					p=val.indexOf('@');
					if (p<1 || p==(val.length-1)) errors+='- '+val+' no es un email válido.\n';
				}else if (test!='R') {
					num = parseFloat(val);
					if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
					if (test.indexOf('inRange') != -1) {
						p=test.indexOf(':');
						min=test.substring(8,p);
						max=test.substring(p+1);
						if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
					}
				}
			}else if(test.charAt(0) == 'R')errors += '- '+nm+' debe estar completo.\n';
		}
    }
	if (errors) alert('Error al enviar el formulario:\n'+errors);
    document.MM_returnValue = (errors == '');
} }




function MM_validateFormTurnos() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateFormTurnos.arguments;
    for (i=0; i<(args.length-2); i+=3){
		test=args[i+2];
		val=document.forms['consulta'].elements[(args[i])];	
		valor=val.value;
		if (val){
			nm=val.name;
			if(nm=="txtSpec"){			
				nm="Especialidad";	
			}
			if(nm=="txtDoctor"){			
				nm="Especialista";	
			}
			if(nm=="txtFecha"){			
				nm="Fecha y Hora más conveniente ";	
			}
			if(nm=="txtFirstName"){			
				nm="Nombre y Apellido";	
			}
			if(nm=="txtEmail"){			
				nm="E-mail";	
			}
			if(nm=="txtPhone"){			
				nm="Teléfono";	
			}
			if(nm=="txtCity"){			
				nm="Ciudad";	
			}
			if((val=valor)!=""){
				if (test.indexOf('isEmail')!=-1) {
					p=val.indexOf('@');
					if (p<1 || p==(val.length-1)) errors+='- '+val+' no es un email válido.\n';
				}else if (test!='R') {
					num = parseFloat(val);
					if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
					if (test.indexOf('inRange') != -1) {
						p=test.indexOf(':');
						min=test.substring(8,p);
						max=test.substring(p+1);
						if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
					}
				}
			}else if(test.charAt(0) == 'R')errors += '- '+nm+' debe estar completo.\n';
		}
    }
	if (errors) alert('Error al enviar el formulario:\n'+errors);
    document.MM_returnValue = (errors == '');
} }


function MM_validateFormComment() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateFormComment.arguments;
    for (i=0; i<(args.length-2); i+=3){
		test=args[i+2];
		val=document.forms['myform'].elements[(args[i])];	
		if(val.value=="nombre y apellido" || val.value=="email"){			
			valor="";			
		}else{
			valor=val.value;	
		}
		if (val){
			nm=val.name;
			if(nm=="postName"){			
				nm="nombre";	
			}
			if(nm=="postMail"){			
				nm="email";	
			}
			if(nm=="postText"){			
				nm="comentario";	
			}
			if((val=valor)!=""){
				if (test.indexOf('isEmail')!=-1) {
					p=val.indexOf('@');
					if (p<1 || p==(val.length-1)) errors+='- '+val+' no es un email válido.\n';
				}else if (test!='R') {
					num = parseFloat(val);
					if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
					if (test.indexOf('inRange') != -1) {
						p=test.indexOf(':');
						min=test.substring(8,p);
						max=test.substring(p+1);
						if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
					}
				}
			}else if(test.charAt(0) == 'R')errors += '- '+nm+' debe estar completo.\n';
		}
    }
	if (errors) alert('Error al enviar el formulario:\n'+errors);
    document.MM_returnValue = (errors == '');
} }



function MM_validateFormReg() { //v4.0
	error_text="Error al enviar el formulario";	
	error_email="no es un email válido";
	error_pie="debe estar completo";
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateFormReg.arguments;	
	var k = 0;
    for (i=0; i<(args.length-2); i+=3){
		test=args[i+2];
		val=document.forms['f_registracion'][args[i]];
		valor=val.value;
		
		if (val){
			nm=val.name;			


			
			if(nm=="customerName"){			
				nm="email";	
			}
			if(nm=="customerPassword"){			
				nm="password";	
			}
			if(nm=="customerCompany"){			
				nm="empresa";	
			}
			
			if(nm=="customerIdentificationNumber"){			
				nm="DNI";
			}
			
			if(nm=="customerFirstName"){	
				nm="Nombre";	
			}
			if(nm=="customerLastName"){	
				nm="Apellido";	
			}
			if(nm=="customerPhone"){			
				nm="Teléfono";	
			}
			if(nm=="customerMobile"){			
				nm="Celular";	
			}
			if(nm=="customerAddress"){			
				nm="Direccion";	
			}
			if(nm=="customerCity"){			
				nm="Ciudad";	
			}
			if(nm=="customerState"){			
				nm="Provincia";	
			}
			if(nm=="customerPostalCode"){			
				nm="Código Postal";	
			}
			if(nm=="conditions"){			
				nm="Términos y Condiciones";	
			}
			
			if(val != null && test=='checked'){
               if(!val.checked)
                  errors += '- '+nm+' debe estar seleccionado.\n';
            }else if(valor!="" && valor!=nm){
				if (test.indexOf('isEmail')!=-1) {
					p=valor.indexOf('@');
					if (p<1 || p==(valor.length-1)) errors+='- '+valor+' '+error_email+'.\n';
				}else if (test!='R') {
					num = parseFloat(val);
					if (isNaN(valor)) errors+='- '+nm+' must contain a number.\n';
					if (test.indexOf('inRange') != -1) {
						p=test.indexOf(':');
						min=test.substring(8,p);
						max=test.substring(p+1);
						if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
					}
				}
			}else if(test.charAt(0) == 'R')errors += '- '+nm+' '+error_pie+'.\n';
		}
    }
	if(errors){
		alert(error_text+':\n'+errors);
	}else{
		//document.forms['f_registracion'].submit();
	}
	
    document.MM_returnValue = (errors == '');
}
}

