/* muestra - oculta un elemento de la pagina*/
 function verOno(obj){
   if(!document.getElementById(obj))return alert("No existe el elemento: \n"+obj);
	 objeto=document.getElementById(obj);
	 if(objeto.style.display!="none")
	    objeto.style.display="none";
			else{
	        if(document.all) objeto.style.display="block";
			      else{
			           if(objeto.tagName=="TABLE")objeto.style.display="table";
			              else if(objeto.tagName=="TD")objeto.style.display="table-cell";
			                   else if(objeto.tagName=="TR")objeto.style.display="table-row";
			                        else objeto.style.display="block";
			          }
           }					
 }

/*oculta el resto de DIV donde se encuentra incluido*/ 
/*esta funcion se emplea en actualizarMenu()*/
function ocultarDiv(obj){
   //oculta el resto de submenus
	 submenus=document.getElementsByTagName("DIV");
	 for (var i=0; i<submenus.length; i++) {
	 		 	if(submenus[i].attributes.getNamedItem('class'))
				   /* tras la linea anterior compruebo value porque IE en la linea anterior siempre true*/
				   if(submenus[i].attributes.getNamedItem('class').value){
				    //oculta submenus menos el de igual nombre 
						if(submenus[i].attributes.getNamedItem('class').value=="contenido")
							 {
							 if(submenus[i].id !=obj)submenus[i].style.display="none";
							 }
						}	 
        }
} 

/*se emplea para desplejar y ocultar los menus */
function actualizarMenu(obj){
verOno(obj);
ocultarDiv(obj);
if(document.getElementById("marco"))document.getElementById("marco").innerHTML="..";
}



/*la emplean los bloques div de clase noticia*/
function verOcultar(obj){
  if(parseInt(obj.parentNode.style.height)== 22)obj.parentNode.style.height="auto";
   else obj.parentNode.style.height="22px";
}
 
/*carga los IFRAME*/ 
 function cargaIframes(pagina,indice){
   if(pagina)
      if(document.getElementById('zonaCentral'))document.getElementById('zonaCentral').src=pagina;
   if(indice)
      if(document.getElementById('zonaIndice'))document.getElementById('zonaIndice').src=indice;			
} 
/* muestra - oculta una linea de tabla*/
 function submenu(obj,pagina,indice){
   if(pagina)
      if(document.getElementById('zonaCentral'))document.getElementById('zonaCentral').src=pagina;
   if(indice)
      if(document.getElementById('zonaIndice'))document.getElementById('zonaIndice').src=indice;			
   if(!document.getElementById(obj))return alert("No existe el elemento: \n"+obj);

	 if(document.getElementById("marco"))document.getElementById("marco").innerHTML=obj;
	 objeto=document.getElementById(obj);
   //oculta el resto de submenus
	 submenus=objeto.parentNode.getElementsByTagName("DIV");
	 for (var i=0; i<submenus.length; i++)
	    if(submenus[i].style.position=="absolute")
			  if(submenus[i].id !=obj )submenus[i].style.visibility="hidden";
       
	 //muestra - oculta el submenus
	 /*if(objeto.style.visibility!="hidden")
	    objeto.style.visibility="hidden";
			else */	objeto.style.visibility="visible";
 }

 function submenuPadre(obj){
  var w; w=this.parent;
  if(!w.document.getElementById(obj))return //alert("No existe el elemento: \n"+obj);

	 objeto=w.document.getElementById(obj);
   //oculta el resto de submenus
	 submenus=w.document.getElementsByTagName("DIV");
	 for (var i=0; i<submenus.length; i++)
	    if(submenus[i].style.position=="absolute")
				 if(submenus[i].attributes.getNamedItem('class'))
				    if(submenus[i].attributes.getNamedItem('class').value)
						  if(submenus[i].attributes.getNamedItem('class').value=="base_menus")
            			  if(submenus[i].id !=obj )submenus[i].style.visibility="hidden";
	 //muestra el submenu
	 	objeto.style.visibility="visible";
 } 

 
 //ajusta el tamaņo de los iframe de la pagina
 function ajustaIframe(menos){
 var x=document.getElementById('zonaCentral');
 //=document.getElementsByTagName("IFRAME");
 var ah;
 if(!x)return false  /*sale si no hay IFRAMES*/
 

 if (self.innerHeight) // todos menos el puto Explorer
    ah = window.innerHeight - menos;
    else if (document.documentElement && document.documentElement.clientHeight)
	  // Explorer 6 en modo Strict
    	ah = document.documentElement.clientHeight -menos;
        else if (document.body) // otros Explorers de mierda
          	ah = document.body.clientHeight - menos;
 x.style.height=ah+"px";

 //v.style.height=ah+"px";	
}


/*Usada en onload para colocar titulo de las paginas de contenidos*/
function coloca_titulo(obj){
var w; w=this.parent;
if(w.document.getElementById('marco'))
   w.document.getElementById('marco').firstChild.nodeValue=document.title;
	 w.document.title=document.title;
if(obj)submenuPadre(obj);	 
	 
}  

/*Usada en onload para colocar titulo de las paginas indice*/
function coloca_titulo_indice(){
var w; w=this.parent;
if(w.document.getElementById('titulo_indice'))
   w.document.getElementById('titulo_indice').firstChild.nodeValue=document.title;
   w.document.title=document.title;
cargalink();
}

function cargalink(){
 var w; w=this.parent;
 if(w.document.getElementById('marco')){
    var x=document.getElementsByTagName("A");
    if(!x)return false
		
		var ind=document.location.pathname.lastIndexOf("/");
		if(ind!=0)ind++;
    var ruta;
		if(document.all)ruta="";else ruta=document.location.pathname.substring(0,ind);
		w.document.getElementById('zonaCentral').src=ruta+x[0].attributes.getNamedItem('href').value;
 }		 
}





/******************/


function visor_cuadro(cuadro,ancho,alto){
texto='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"';
texto+='"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
texto+='<html xmlns="http://www.w3.org/1999/xhtml" ><head>';
texto+='<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />';
texto+='<meta http-equiv="Content-Language" content="es" />';
texto+='<meta name="copyright" content="&copy; 2004 cossio.net" />';
texto+='<title>Visor imagenes</title>';
texto+='<link rel="stylesheet" type="text/css" href="http://www.cossio.net/_maquetacion/css/cossio.css" />';
texto+='</head><body onload="ajustaDiv(60)"><script type="text/javascript">';
texto+='altoimagen='+alto+';';
texto+='anchoimagen='+ancho+';';
texto +="function zoomImagen(valorzoom){";
texto +="im=document.getElementById('idventana');";
texto +="(valorzoom==-2)? alto1='100%' : ((valorzoom !=-1 &&valorzoom!=100)?";
texto +="alto1=String(Math.round(Math.abs(valorzoom)*altoimagen/100))+'px': alto1='auto');";
texto +="(valorzoom==-1)? ancho1='100%' : ((valorzoom !=-2 &&valorzoom!=100)?";
texto +="ancho1=String(Math.round(Math.abs(valorzoom)*anchoimagen/100))+'px': ancho1='auto');";
texto +="im.style.width=ancho1;";
texto +="im.style.height=alto1;";
texto +="return true;}";
texto +="function ajustaDiv(menos){";
texto +="x=document.getElementById('div_central');";
texto +="var ah;";
texto +="if (self.innerHeight) ah = window.innerHeight - menos;";
texto +="else if (document.documentElement && document.documentElement.clientHeight)";
texto +="ah = document.documentElement.clientHeight -menos;";
texto +="else if (document.body)	ah = document.body.clientHeight - menos;"; 
texto +="x.style.height=ah+'px';";
texto +="}";

texto +="</script>";
texto+='<div class="noticia">';
texto+='<h1 style="text-align:center">';
texto+="<input type = 'button'  value='25%' onclick='zoomImagen(25)'/>";
texto+="<input type = 'button'  value='50%' onclick='zoomImagen(50)'/>";
texto+="<input type = 'button'  value='75%' onclick='zoomImagen(75)'/>";
texto+="<input type = 'button'  value='100%' onclick='zoomImagen(100)'/>";
texto+="<input type = 'button'  value='150%' onclick='zoomImagen(150)'/>";
texto+="<input type = 'button'  value='200%' onclick='zoomImagen(200)'/>";
texto+="<input type = 'button'  value='300%' onclick='zoomImagen(300)'/>";
texto+="<input type = 'button'  value='Ancho' onclick='zoomImagen(-1)'/>";
texto+="<input type = 'button'  value='Alto' onclick='zoomImagen(-2)'/>";
texto+="</h1>";
texto+='<div id="div_central" style="text-align:center;overflow:auto">';
texto+='<img src="'+cuadro+'" alt="" id="idventana" name="idventana"/>';
texto+='<p style="text-align:center"><input type="button" value="Cerrar"';
texto+='onclick="window.close()" /> <input type="button" value="Imprimir"';
texto+='onclick="window.print()" /></p>';
texto+='</div>';
texto+='</div></body></html>';

 v=window.open("","visor","screenY=0,screenX=0,top=0,left=0,width="+screen.width+",height="+screen.height+", scrollbars,resizable");
v.document.write(texto);
v.document.close();
 }
/************************/
/*BANNER*/
function oculta(){
if(!document.getElementById("banner"))return;
obj=document.getElementById("banner");
obj.style.display="none";
}

 if (window.innerHeight) // todos menos el puto Explorer
    altura = window.innerHeight;
    else if (document.documentElement && document.documentElement.clientHeight)
	  // Explorer 6 en modo Strict
    	altura = document.documentElement.clientHeight;
        else if (document.body) // otros Explorers de mierda
          	altura = document.body.clientHeight;
 if (window.innerWidth) // todos menos el puto Explorer
    anchura = window.innerWidth;
    else if (document.documentElement && document.documentElement.clientWidth)
	  // Explorer 6 en modo Strict
    	anchura = document.documentElement.clientWidth;
        else if (document.body) // otros Explorers de mierda
          	anchura = document.body.clientWidth;						

posX=20;
posY=20;
derecha=true;
abajo=true;
function mover(){
if(!document.getElementById("banner"))return;
obj=document.getElementById("banner");
if(obj.style.display=="none"){ return}

if(derecha){
  if(posX<anchura-172)posX +=10;else derecha=false;
	}else
	{
	if(posX>0)posX-=12;else derecha=true;
	}
	
if(abajo){
  if(posY<altura-220)posY +=5;else abajo=false;
	}else
	{
	if(posY>0)posY-=8;else abajo=true;
	}	
	
obj.style.left=posX+"px";
obj.style.top=posY+"px";
setTimeout("mover()",100);
}

function party(tiempo){
setTimeout("oculta()",tiempo);
mover();
}						
/*FIN BANNER*/

