<!--

//Fecha Compatible
var isnMonths=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
var isnDays= new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado","Domingo");
var colorAnt;
today=new Date();
function getFullYear(today)
{
var rightYear = today.getYear();
if (rightYear < 1000) rightYear += 1900;
return rightYear;
}

//Restaura la capa
function manodivOff(a) {
	visor = navigator.appName;
	if (visor == "Microsoft Internet Explorer"){
	    a.style.color = colorAnt;
		//a.style.color='#000000';
    } else {
        a.style.color = colorAnt;
		//a.style.color='#000000';
    }
}

//Muestra la mano como un link y cambia el estilo de la capa
function manodivOn(a) {
	visor = navigator.appName;
	if (visor == "Microsoft Internet Explorer"){
        a.style.cursor='hand';
        colorAnt = a.style.color;
		a.style.color='#ffffff';
    } else {
        a.style.cursor='pointer';
        colorAnt = a.style.color;
		a.style.color='#ffffff';
    }
}

//Muestra la mano como un link
function mano(a) {
	visor = navigator.appName;
	if (visor == "Microsoft Internet Explorer"){
        a.style.cursor='hand';
    } else {
        a.style.cursor='pointer';
    }
}

//Oculta la URL
function ocultaURL(){
	window.defaultStatus="Peña El Soniquete";
}

//Refrescar pagina si cambia tamanyo en Nav4
function MM_reloadPage(init) {
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

//Necesario para los PopUps
//onclick="NewWindow(this.href,'name','400','300','yes');return false"
var win= null;
function NewWindow(mypage,myname,w,h,scroll){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars='+scroll+',';
      settings +='resizable=no';
  win=window.open(mypage,myname,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}

function NewWindow2(mypage,myname,w,h,scroll){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars='+scroll+',';
      settings +='resizable=yes';
  win=window.open(mypage,myname,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}

function formatoFecha(fecha)
{
	var dia,mes,anyo;
	var i=fecha.value.indexOf("/");
	dia=fecha.value.substring(0,i);
	var cadena=fecha.value.substring(i+1,fecha.value.length+1);
	var j=cadena.indexOf("/");
	mes=cadena.substring(0,j);
	anyo=cadena.substring(j+1,cadena.length+1)
	//Obligo a introducir una cadena de números de formato "__/__/____"
	var bError=false;
	/* var esFecha = /^(.+\/.+\/.+)*$/; */
	var esFecha = /^(..\/..\/....)*$/;
	var esFecha1 = /^(.\/..\/....)*$/;
	var esFecha2 = /^(..\/.\/....)*$/;
	var esFecha3 = /^(.\/.\/....)*$/;

	if (fecha.value=="")
	{
	bError=true;
	}
	else
	{
	 	if (!esFecha.test(fecha.value)&& !esFecha1.test(fecha.value) && !esFecha2.test(fecha.value) && !esFecha3.test(fecha.value))
	 	{
			bError=true;
		}
	}
	//---------------    	
		if (bError)
		{
			return false;
		}
		else
		{
			//Una vez comprobado el formato, si es correcto, compruebo que la fecha sean números:
		var m;
		var n;
		var strg;
			m=fecha.value.indexOf("/");
			if (isNaN(fecha.value.substring(0,m)))
			{
				return false;
			}
			strg=fecha.value.substring(m+1,fecha.value.length+1);
			n=cadena.indexOf("/");
			if (isNaN(cadena.substring(0,n)))
			{
				return false;
			}
			if (isNaN(strg.substring(n+1,strg.length+1)))
			{
				return false;
			}
		}
	//------------------------
	if (dia>31||dia<1||mes>12||mes<1)
	{
		return false;
	}
	if (dia==31)
	{
		if (mes==4||mes==6||mes==9||mes==11)
		{
			return false;
		}
	}
	if (dia>28 && (mes=="2" || mes=="02"))
	{
		if (dia==30||dia==31)
		{
			return false;
		}
		else
		{
			var bisiesto;
			bisiesto="" + anyo / 4;
			for (i=0;i<=bisiesto.length-1;i++)
			{
				if(bisiesto.substring(i,i+1)==".")
				{
					return false;
				}
			}
		}
		if(anyo.length==4&&anyo.charAt(2)==0&&anyo.charAt(3)==0&&anyo.substring(1,anyo.length)!=000)
		{
			return false;
		}
	}
	return true;
}
function FormatoSinMillares( cNumero ) {

	// Realiza la comprobación básica de caracteres
	cNumero = FormatoSoloNumericos( cNumero );
	cNumero = FormatoConSigno( cNumero );

	// Si el primer caracter es el signo, se ignora
	var cSigno;
	if ( cNumero.charAt(0) == "+" || cNumero.charAt(0) == "-" ) {
		cSigno = cNumero.charAt(0);
		cNumero = cNumero.substring( 1 );
	} else {
		cSigno = "";
	}

	// Quitamos los puntos
	while( cNumero.indexOf( "." ) != -1 ) {
		cNumero = cNumero.replace( ".", "" );
	}
	return (cSigno+cNumero);
}

function FormatoSinSigno( cNumero ) {

	// Realiza la comprobación básica de caracteres
	cNumero = FormatoSoloNumericos( cNumero );

	//----------------------------
	// Eliminamos cualquier signo 
	//----------------------------
	while( cNumero.indexOf( "+", 0 )  != -1 || cNumero.indexOf( "-", 0 ) != -1 ) {
		cNumero = cNumero.replace( "+", "" ).replace( "-", "" );
	}
	return cNumero
}

function FormatoSoloNumericos( cNumero ) {

	// Comprueba que sólo se hayan introducido números
	for ( nPos = 0; nPos < cNumero.length; nPos++ ) {
		var cCaracter = cNumero.charAt( nPos )
		if ( isNaN( parseInt( cCaracter ) ) 
		     && cCaracter != "-"
		     && cCaracter != "+"
		     && cCaracter != "."
		     && cCaracter != "," ) {
			return "";
		}
	}
	return cNumero;
}

function FormatoConSigno( cNumero ) {

	// Realiza la comprobación básica de caracteres
	cNumero = FormatoSoloNumericos( cNumero );

	// Eliminamos cualquier signo posterior al primer caracter
	while( cNumero.indexOf( "+", 1 )  != -1 || cNumero.indexOf( "-", 1 ) != -1 ) {
		cNumero = cNumero.substring(0,1) + cNumero.substring(1).replace( "+", "" ).replace( "-", "" );
	}
	return cNumero
}

function FormatoConDecimales( cNumero, nDecimales ) {

	// Realiza la comprobación básica de caracteres
	cNumero = FormatoSoloNumericos( cNumero );
	cNumero = FormatoConSigno( cNumero );

	if (cNumero==""){
		return cNumero;
	}
	else{
		// Obtiene la posición de los decimales
		var nPosicionComa = cNumero.indexOf(",");
		if ( -1 == nPosicionComa  ) {
			nPosicionComa = cNumero.length;
		}
	
		// Parte Entera
		var cEntero;
		if ( nPosicionComa > 0 ) {
			cEntero = cNumero.substring( 0 , nPosicionComa );
		} else {
			cEntero = "0";
		}
		
		// Parte Decimal
		var cDecimal;
		if ( nPosicionComa < cNumero.length-1 ) {
			cDecimal = cNumero.substring( nPosicionComa+1 );	
		} else {
			cDecimal = "";
		}
		cDecimal = FormatoSinSigno( FormatoSinMillares( cDecimal ) )
		while ( cDecimal.indexOf( "," ) != -1 ) {
			cDecimal = cDecimal.replace( ",","" )
		}
		
		// Rellenar o truncar la parte decimal
		if ( cDecimal.length > nDecimales ) {
			cDecimal = cDecimal.substring( 0, nDecimales );
		} else { 
			while ( cDecimal.length < nDecimales ) {
				cDecimal += "0";
			}
		}
		return (cEntero+","+cDecimal);
	}
}	
	
function FormatoConMillares( cNumero ) {

	// Primero se eliminan los millares 
	// (incluye una comprobación básica de formato)
	cNumero = FormatoSinMillares( cNumero );
	cNumero = FormatoConSigno( cNumero );

	// Si el primer caracter es el signo, se ignora
	var cSigno;
	if ( cNumero.charAt(0) == "+" || cNumero.charAt(0) == "-" ) {
		cSigno = cNumero.charAt(0);
		cNumero = cNumero.substring( 1 );
	} else {
		cSigno = "";
	}
	
	// Se elimina la parte decimal
	var cDecimal;
	if ( -1 != cNumero.indexOf(",")  ) {
		cDecimal = cNumero.substring( cNumero.indexOf(",") );
		cNumero = cNumero.substring( 0, cNumero.indexOf(",") );
	} else {
		cDecimal = "";
	}

	// Situamos los separadores
	var cValorNuevo = ""
	while ( cNumero.length > 3 ) { 
		cValorNuevo = "." + cNumero.substring( cNumero.length-3, cNumero.length ) + cValorNuevo;
		cNumero = cNumero.substring( 0, cNumero.length-3 );
	}
	return (cSigno + cNumero + cValorNuevo + cDecimal);
}

//Validar Email
function validarEmail(valor) {
  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){
   return (true)
  } else {
   return (false);
  }
 }
// -->