//Se abre una ventana centrada en la pantalla
function AbrirCentrado(url, ancho, alto, barra) { 
   izquierda = (screen.width) ? (screen.width-ancho)/2 : 100 
   arriba = (screen.height) ? (screen.height-alto)/2 : 100 
   opciones = 'toolbar=0,location=0,directories=0,status=' + barra + ',menubar=0,scrollbars=0,resizable=0,width=' + ancho + ',height=' + alto + ',left=' + izquierda + ',top=' + arriba + '' 
   window.open(url, 'popUp', opciones)
}

function cambiaColor (elementoID,over)
{
if (over==1)
	{
	elementoID.style.color="yellow";
	elementoID.style.backgroundColor="#000066"
	}
else
	{
	elementoID.style.color="white";
	elementoID.style.backgroundColor="#6666FF"
	}
}

//Cambia el color sólo del texto
function cambiaColorTexto (elementoID,over)
{
if (over==1)
	{
	elementoID.style.color="yellow";
	}
else
	{
	elementoID.style.color="white";
	}
}

//Carga la imagen que debe mostrarse al pasar sobre el menú
function cargaPasando (elementoID, imagen)
{
	if (imagen == "Inicio") {elementoID.src="img/inicio_sobre.gif";}
	else if (imagen == "Quien") {elementoID.src="img/quien_sobre.gif";}
}

//Carga la imagen que debe mostrarse al salir el cursor del menú
function cargaNormal (elementoID, imagen)
{ 
	if (imagen == "Inicio") elementoID.src="inicio.gif";
	else if (imagen == "Quien") elementoID.src="quien.gif";
}

//Carga la página en el marco actual
function cargarPagina (nombre)
{
document.location.href=nombre;
}
//Devuelve el nº de años transcurridos desde 1992 (año de apertura)
function devuelveAntiguedad()
{
var fecha = new Date();
var anno = fecha.getFullYear();
var annos = anno - 1992;
document.write(annos);
}
function esFecha(unaFecha) {
//Devuelve cierto si la cadena unaFecha puede ser interpretada como una fecha válida
    var Fecha= new String(unaFecha);   // Crea un string   
    var RealFecha= new Date();   // Para sacar la fecha de hoy   
    // Cadena Año   
    var Ano= new String(Fecha.substring(Fecha.lastIndexOf("/")+1,Fecha.length));   
    // Cadena Mes   
    var Mes= new String(Fecha.substring(Fecha.indexOf("/")+1,Fecha.lastIndexOf("/")));   
    // Cadena Día   
    var Dia= new String(Fecha.substring(0,Fecha.indexOf("/"))); 
  
    if (isNaN(Ano) || Ano.length<4 || parseFloat(Ano)<1900) return false; 
    if (isNaN(Mes) || parseFloat(Mes)<1 || parseFloat(Mes)>12) return false;
    if (isNaN(Dia) || parseInt(Dia, 10)<1 || parseInt(Dia, 10)>31) return false;
    if (Mes==4 || Mes==6 || Mes==9 || Mes==11 || Mes==2) {
      if (Mes==2 && Dia > 28 || Dia>30) return false;
    }   
  return true;     
}
//Texto tipografico
var it=0
function initialize()
{
mytext=typing.innerText
var myheight=typing.offsetHeight
typing.innerText=''
document.all.typing.style.height=myheight
document.all.typing.style.visibility="visible"
document.all.typing.style.color="white"
typeit()
}
function typeit()
{
typing.insertAdjacentText("beforeEnd",mytext.charAt(it))
if (it<mytext.length-1){
it++
setTimeout("typeit()",100)
}
else
return
}
//Abre una ventana nueva con la url como parametro
function cargarVentana (ruta,ancho,alto)
	{
	leftPos=20;
	topPos=20;
	ventana=window.open(ruta,"","width="+ancho+",height="+alto+",left="+leftPos+",top="+topPos+"");
	}
	
//Muestra texto en la barra de estado
function textoBarra (msg)
{
	status = msg;
}
	
//funciones para tratar imagenes
function high(which2)
{
theobject=which2;
highlighting=setInterval("highlightit(theobject)",50);
	
}
function low(which2)
{
clearInterval(highlighting);
which2.filters.alpha.opacity=50;
}
function highlightit(cur2)
{
if(cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=5
else if(window.highlighting)
clearInterval(highlighting)
}
//Se marcan o desmarcan todos los checkbox del formulario nombreForm
//Si marcar = 1 se marcan, si marcar = 0 se desmarcan
function marcaTodos (nombreForm, marcar) {
	for(i=0; i < document.forms[nombreForm].elements.length; i++)
		if(document.forms[nombreForm].elements[i].type == "checkbox")
				document.forms[nombreForm].elements[i].checked = marcar;
}
//funcion para mostrar un tag
function mostrarTag(texto)
{
document.all("tag").style.posLeft=window.event.x+80;
document.all("tag").style.posTop=window.event.y;
document.all("tag").innerText=texto;
document.all("tag").style.visibility="visible";
}
function ocultarTag()
{
document.all("tag").style.visibility="hidden";
}
function moverTag()
{
document.all("tag").style.posLeft=window.event.x+80;
document.all("tag").style.posTop=window.event.y;
}
