function nuevavent(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable = no'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
			
function chkemail(Control){

	//	DECLARACION DE VARIABLES

	var liLongMail;
	var lsParte1;
	var lsParte2;
	var lsParte3;
	var psMail;

	
	psMail = Control.value


	//	por defecto se admite la existencia de varios puntos en cualquier parte.
	//	comprobamos que el campo no sea nulo y que no existan espacios en todo el string.

	if(psMail=="" || psMail.indexOf(" ")!=-1)				//campo vacío.
		{
		return false;
		}
		
	//	descomponemos el string en tres partes y vemos su composición.

	liLongMail = psMail.length												//	long. del string.
	

	lsParte1=psMail.substr(0,psMail.indexOf("@"))							//	[1er. cter. - @]
	lsParte2=psMail.substr(psMail.indexOf("@")+1,liLongMail)				//	[@ - long. máx.]
	lsParte2=lsParte2.substr(0,lsParte2.indexOf("."))


	if (lsParte1=="" || lsParte2==""){										//	existencia de "" en parte1 y parte2.
		alert("La direccion de correo no es correcta")
		Control.value = "";
		if( Control != null ) Control.focus(); 
		return false;
		}

	lsParte3=psMail.substr(lsParte1.length+lsParte2.length+2,liLongMail-1)	//	[. - long. máx.]

	if (lsParte3==""){														//	existencia de blancos en parte3.
		alert("La direccion de correo no es correcta")
		Control.value = "";
		if( Control != null ) Control.focus(); 
		return false;
		}
	if (lsParte2.indexOf("@")!=-1 || lsParte3.indexOf("@")!=-1){			//	exist. de más de una "@"
		alert("La direccion de correo no es correcta")
		Control.value = "";
		if( Control != null ) Control.focus(); 
		return false;														//	en parte2 o parte3.
		}

	return true
}

function GenerarClave(){
	var result

	var valor
	var i
	var Caracter1 = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9")
	var Caracter2 = new Array("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")

	result = ''
	for (i = 0; i < 3; i++)
	{
		valor = Math.round(Math.random() * 51);
		result = result + Caracter2[valor];
	}

	for (i = 0; i < 2; i++)
	{
		valor = Math.round(Math.random() * 9);
		result = result + Caracter1[valor];
	}

	for (i = 0; i < 2; i++)
	{
		valor = Math.round(Math.random() * 51);
		result = result + Caracter2[valor];
	}

	valor = Math.round(Math.random() * 9);
	result = result + Caracter1[valor];

	return result
}
