function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function dar_fecha(){
	dias = new Array ("Domingo","Lunes","Martes","Mi&eacute;rcoles","Jueves","Viernes","S&aacute;bado");
	meses= new Array ("Enero","Febrero","Marzo","Abril","Mayo",	"Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
	fecha= new Date();
	indice = fecha.getMonth();
	indice_d = fecha.getDay();
	document.write(dias[indice_d] + ", " +fecha.getDate()+ " de " + meses[indice]	+" de " + fecha.getFullYear());
}

function abrir(pagina,ancho,alto,status){
	window.open(pagina,'','width='+ancho+',height='+alto+',status='+status+',top=200,left=300');
}

function cerrar(){
    window.opener.refrescar();
 	window.close();
}

function cerrar_letra(letra){
	window.opener.recargar_letra(letra);
 	window.close();
}

function refrescar(){
	window.location.reload();
}

function exit(){
	window.location.href='exit.php';
}

function centrar() { 
    iz=(screen.width-document.body.clientWidth) / 2; 
    de=(screen.height-document.body.clientHeight) / 2; 
    moveTo(iz,de); 
}

function IsNumeric(valor){ 
	var log=valor.length; 
	var sw="S"; 
	for (x=0; x<log; x++){ 
		v1=valor.substr(x,1); 
		v2 = parseInt(v1); 
		//Compruebo si es un valor numérico 
		if (isNaN(v2)) { sw= "N";} 
	} 
	if (sw=="S") {
		return true;
	} else {
		return false; 
	} 
} 
	
var primerslap=false; 
var segundoslap=false; 
	
function formateafecha(fecha) 
	{ 
	var long = fecha.length; 
	var dia; 
	var mes; 
	var ano; 
	
	if ((long>=2) && (primerslap==false)) { dia=fecha.substr(0,2); 
	if ((IsNumeric(dia)==true) && (dia<=31) && (dia!="00")) { fecha=fecha.substr(0,2)+"/"+fecha.substr(3,7); primerslap=true; } 
	else { fecha=""; primerslap=false;} 
	} 
	else 
	{ dia=fecha.substr(0,1); 
	if (IsNumeric(dia)==false) 
	{fecha="";} 
	if ((long<=2) && (primerslap=true)) {fecha=fecha.substr(0,1); primerslap=false; } 
	} 
	if ((long>=5) && (segundoslap==false)) 
	{ mes=fecha.substr(3,2); 
	if ((IsNumeric(mes)==true) &&(mes<=12) && (mes!="00")) { fecha=fecha.substr(0,5)+"/"+fecha.substr(6,4); segundoslap=true; } 
	else { fecha=fecha.substr(0,3);; segundoslap=false;} 
	} 
	else { if ((long<=5) && (segundoslap=true)) { fecha=fecha.substr(0,4); segundoslap=false; } } 
	if (long>=7) 
	{ ano=fecha.substr(6,4); 
	if (IsNumeric(ano)==false) { fecha=fecha.substr(0,6); } 
	else { if (long==10){ if ((ano==0) || (ano<1900) || (ano>2100)) { fecha=fecha.substr(0,6); } } } 
	}
	if (long>=10) 
	{ 
		fecha=fecha.substr(0,10); 
		dia=fecha.substr(0,2); 
		mes=fecha.substr(3,2); 
		ano=fecha.substr(6,4); 
		// Año no viciesto y es febrero y el dia es mayor a 28 
		if ( (ano%4 != 0) && (mes ==02) && (dia > 28) ) { fecha=fecha.substr(0,2)+"/"; } 
	} 
	return (fecha); 
}
