	// VALIDACION DEL FORMULARIO DE REGISTRO
function validacion()	{ 			
		var val = document.registro;		
		var valida_email = /(^(.+\@.+\..+)|^)$/	
		var valida_email2 = /(^(.+\@.+\..+)|^)$/		
	if (val.Nombre.value==''){	
		alert('Campo Nombre requerido')
		return false;
		}
	if (val.tx_email.value==''){	
		alert('Campo Email requerido')
		return false;
		}
			
	if(!valida_email.test(val.tx_email.value))
		{
		alert('Por favor verifique email.')
		return false;
		}
	if (val.tx_ciudad.value==''){	
		alert('Campo Ciudad requerido')
		return false;
		}
	if (val.tx_telf.value==''){	
		alert('Campo Telefono requerido')
		return false;
		} 		
			if (empresa.style.display==''){
					if(!valida_email2.test(val.tx_email1.value))
						{
						alert('Por favor verifique email de Empresa .')
						return false;
						}		
					if (val.tx_email1.value==''){	
						alert('Correo Electronico de Empresa Requerido ')
						return false;
						}
				} 
				var todos = val.grupos;
				//alert(todos)
				var allValid = true;
				  for(x=0;x<todos.length;x++){
						if(todos[x].type=="checkbox" && todos[x].checked){
						  allValid = false;
						  break; 
    					}
  					}
					if (!allValid) {
					}else{
						alert("Debe seleccionar un Grupo");
						return false; 
						}	
			return true		
	}
	
	// VALIDACION DEL FORMULARIO DE CONTACTENOS
function validacion2()	{ 			
		var val = document.contact;		
		var valida_email = /(^(.+\@.+\..+)|^)$/	
	if (val.tx_empresa.value==''){	
		alert('Campo Nombre Empresa Requerido.')
		return false;
		}
	if (val.Nombre.value==''){	
		alert('Campo Nombre Solicitante Requerido.')
		return false;
		}
			
	if (val.tx_telf.value==''){	
		alert('Campo Telefono requerido.')
		return false;
		} 
	if(val.tx_email_empresa.value=='')
		{
		alert('Campo email Requerido.')
		return false;
		}
	if(!valida_email.test(val.tx_email_empresa.value))
		{
		alert('Por favor verifique email.')
		return false;
		}
		var todos = val.formacontact;
		//alert(todos)
		var allValid = true;
		  for(x=0;x<todos.length;x++){
				if(todos[x].type=="checkbox" && todos[x].checked){
				  allValid = false;
				  break; 
				}
			}
			if (!allValid) {
			}else{
				alert("Por Favor indique de que forma le gustaria que le contactaramos\n Email ó Telefonica ?");
				return false; 
				}		
		if (val.operador.value==''){	
			alert('Área a Contactar Requerido.')
			return false;
		}
	return true		
	}

// FUNCION PARA BLOQUEAR NUMEROS EN KEY

function onKeyPressBlockNumbers(e)
{
	var key;
	var keychar;
	var reg;

	if(window.event)  { key = e.keyCode; }
	else if(e.which)  { key = e.which; }
	
	else { return true; }

	keychar = String.fromCharCode(key);
	reg = /\d/;
	return !reg.test(keychar);
}

// FUNCION PARA BLOQUEAR ALFABETO EN KEY

function onKeyPressBlockAlphabet(e)
{
	var key;
	var keychar;
	var reg;
	if(window.event) { key = e.keyCode; }
	else if(e.which) { key = e.which;   }
	else  { return true;}
	keychar = String.fromCharCode(key);
	reg = /\D/;
	return !reg.test(keychar);
}
// FUNCION PARA VALIDAR LOS FORMATOS DE UN ARCHIVO
function LimitAttach(tField,iType) 
{
		if(formuser.File1.value == '')
	{
	alert("Debe Ingresar una Foto ");
			formuser.File1.focus();
			return false;
	}
	else {
		
			file=tField.value;
			if (iType==1) { 
			extArray = new Array(".gif",".jpg",".jpeg");
			}
			if (iType==2) {
			extArray = new Array(".swf");
			}
			if (iType==3) {
			extArray = new Array(".exe",".sit",".zip",".tar",".swf",".mov",".hqx",".ra",".wmf",".mp3",".qt",".med",".et");
			}
			if (iType==4) {
			extArray = new Array(".mov",".ra",".wmf",".mp3",".qt",".med",".et",".wav");
			}
			if (iType==5) {
			extArray = new Array(".html",".htm",".shtml");
			}
			if (iType==6) {
			extArray = new Array(".doc",".xls",".ppt");
			}
			if (iType==7) {
			extArray = new Array(".txt",".htm",".html",".pdf",".swf");
			}
			
			allowSubmit = false;
			if (!file) return false;
			
			while (file.indexOf("\\") != -1) file = file.slice(file.indexOf("\\") + 1);
			ext = file.slice(file.indexOf(".")).toLowerCase();
			for (var i = 0; i < extArray.length; i++) {
			if (extArray[i] == ext) {
			allowSubmit = true;
			
				}
			} 
			
			if (!allowSubmit) 
			{
			alert("Usted sólo puede subir archivos con extensiones " + (extArray.join(" ")) + "\nPor favor seleccione un nuevo archivo");
			return false;
			}
		 //return true;
		 }
		
}
function emailCheck (emailStr,campo) {
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")

var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
	alert("Error, la dirección de correo es incorrecta")
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

if (user.match(userPat)==null) {
    // user is not valid
    alert("Error, la dirección de correo es incorrecta")
    return false
}

var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("Error, la dirección de correo es incorrecta")
		return false
	    }
    }
    return true
}

var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   alert("Error, la dirección de correo es incorrecta")
   return false
}

if (len<2) {
   alert("Error, la dirección de correo es incorrecta")
   return false
   
}

return true;
}

 

