// Amc Gestion Personalizada
// Script para Abrir ventanas emergentes
// Parametros de Entada:  Direccion,ancho,alto

function finestra(url,h,w) {
	izq = (screen.width/2)-(w/2)
	der = (screen.height/2)-(h/2)
	formato = 'scrollbars=1,menubar=no,locationbar=no,statusbar=0,toolbar=no,height=' + h + ',width=' + w + ',left='+izq+',Top='+der
	window.open(url,'ventana',formato)
}
function finestra1(url,h,w,nombre) {
	izq = (screen.width/2)-(w/2)
	der = (screen.height/2)-(h/2)
	formato = 'scrollbars=0,menubar=no,locationbar=no,statusbar=no,toolbar=no,height=' + h + ',width=' + w + ',left='+izq+',Top='+der
	window.open(url,nombre,formato)
}
function formatofecha(e,ctl){
var keynum;
var retorna=new Boolean(0)

	retorna = false;
	if(window.event) // IE
		{
		keynum = e.keyCode;
		}
	else if(e.which) // Netscape/Firefox/Opera
		{
		keynum = e.which;
		}
	if ((keynum == 8) || (keynum == 9) || (keynum == 46) || (keynum > 36 && keynum < 41))
		{
		retorna = false;
		}
	else
		{
		if ((keynum > 47 && keynum < 58) || (keynum > 95 && keynum < 106))
			{
			retorna = true;
			}
		}

	if (retorna == true)
		{
		if ((ctl.value.length==2)||(ctl.value.length==5))
			{
			ctl.value=ctl.value+"/";	
			}
		}
}

function formatohora(ctl){
	if (ctl.value.length==2){
		ctl.value=ctl.value+":";	
	}
}

function validadatos(e, modo){
var keynum;
var retorna=new Boolean(0)

	if(window.event) // IE
		{
		keynum = e.keyCode;
		}
	else if(e.which) // Netscape/Firefox/Opera
		{
		keynum = e.which;
		}
	if ((keynum == 8) || (keynum == 9) || (keynum == 16) || (keynum == 46) || (keynum > 36 && keynum < 41))
		{
		retorna = true;
		}
	else
		{
		if (modo == 1) //0123456789
			{
			if ((keynum > 47 && keynum < 58) || (keynum > 95 && keynum < 106))
				{
				retorna = true;
				}
			}
		else if (modo == 2) //0123456789.,-/
			{
			if ((keynum > 47 && keynum < 58) || (keynum > 95 && keynum < 106) || (keynum > 108 && keynum < 112) || (keynum > 187 && keynum < 191))
				{
				retorna = true;
				}
			}
		}
	if (retorna == true)
		{
		return true;
		}
	else
		{
		return false;
		}
}