function check_email(e) {
	var ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";

	for(i=0; i < e.length ;i++){
		if(ok.indexOf(e.charAt(i))<0){ 
			return (false);
		}	
	} 

	if (document.images) {
		var re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
		var re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		if (!e.match(re) && e.match(re_two)) {
			return (-1);		
		} 
	
	}

}

function valmail(f)
{
	if(!check_email(f.email.value)){
	alert("Email Incorrecto.");
	f.email.focus(); 
	// if the browser is Netscape 6 or IE
	if(document.all || document.getElementByID){
	// change the color of text field
	f.email.style.background = "yellow";
	}
	// make sure the form is not submitted
	return false;
	}
}

function Mid(str, start, len)
{
// Make sure start and len are within proper bounds
    if (start < 0 || len < 0) return "";
    var iEnd, iLen = String(str).length;
    if (start + len > iLen)
          iEnd = iLen;
    else
          iEnd = start + len;
    return String(str).substring(start,iEnd);
}

function numeros(n){
var dni = String;
dni=n;
var val = new Array;
var total=1;
	for(var i=0;i<(dni.length);i++){
		val[i]=0;
		if(Mid(dni,i,1)==" "){
			val[i]=0;
		}
		else{
			for(var e=0;e<10;e++){
				/*document.write("<br>"+Mid(dni,i,1));*/
				if(Mid(dni,i,1)==e){						
					val[i]=1;				
				}
			}
		}	
	}

	for (var i=0;i<(dni.length);i++){
		total=total*val[i];
	}	
	if(total=="0"){	
		return false;		
	}
	else{		
		return true;		
	}
}

