/*
	Assec 2002 ixPP  1.0  ( acesso )
 // 	
 // 
 //
 //       Coder  ppires@assec.pt
 //       file ixmenu.js( da  pagina principal)

*/

    
//window.captureEvents(event.RESIZE);   
window.onresize=ixredimensiona;

    
      
//window.onscroll=ixscroll;
 function ixscroll(){
 // posicionaIMGTopo();
     return true;
       }


function LayerVis(layer,modo){
   if (!layer) return;
   
 /* 
   if ((modo=='') or (modo == 'true')) var visivel = 'visible';
     else var  visivel = 'none';
*/

     if (document.all) 
         layer.style.display= modo;
      else 
          layer.display= modo;
     
}


function LayerWH(layer,w,h){
   if (!layer) return;
   
 /* 
   if ((modo=='') or (modo == 'true')) var visivel = 'visible';
     else var  visivel = 'none';
*/

   if (document.all){ 
         layer.style.width= w;
         layer.style.height= h;
         }
      else 
          layer.display= modo;
     
}




 function arranca(){
     posicionaIMGTopo();
     document.getElementById('layerzmain').style.visibility= "visible";
    

    }
    
    
 function PosicionaLayer(layer,pposx,pposy){
     this.pposx = pposx;
     this.pposy = pposy;
    
      if (!layer) return;
     
    
      if (document.all) {
        layer.style.left=pposx+"px"; 
        layer.style.top=pposy+"px"; 
         layer.style.visibility= "visible";

        }
      else {
          layer.left = this.pposx;
          layer.top  = this.pposy;
          
         layer.visibility= "visible";
      
        }
                  
}

function GetHeight(layer){
        
     if (!layer) return 0;
     if (document.all) {
       if (false && layer.style.pixelHeight)
              return (layer.style.pixelHeight);
            else
               return (layer.clientHeight);
        }
      else {
            if (false && layer.style.pixelHeight)
              return (layer.style.pixelHeight);
            else
               return (layer.clientHeight);
        }
     return (-1);
      
}       

 function posicionaIMGTopo(){
     var  l= new Object ;
     var posx= 0;
     var posy= 0;
     
     
     if (document.all){ l =  document.all;  }
       else {
         l =  document;
          };
     
     var largura =  parseInt(document.body.clientWidth) || parseInt(document.documentElement.clientWidth ); 
	 
	 if (largura > 880)  posx= (largura -880)/2;
				 
    
		var altura =  parseInt(document.body.clientHeight) || parseInt(document.documentElement.clientHeight ); 
	 
         
		if (altura > 590 )  posy = ( altura- 590)/2
 

        if (posy < 0  ) posy = 0;
	    if (posx < 0  ) posx = 0;

        window.posx = posx;
        window.posy = posy;
        
        
		PosicionaLayer(l.layerzmain , parseInt(posx+192), parseInt(posy+149));
		PosicionaLayer(l.layerzmenu , parseInt(posx), parseInt(posy+149));
	   	
       };

         
         
  function ixredimensiona(){

      posicionaIMGTopo();
       return  true;
     }



function  fviewn(){
    var now=new Date()

    v=(now.getSeconds())*10000 + (now.getMinutes())*1000 +
        (now.getDate())*100 + (now.getMonth())*100+(now.getHours()) ;
    v=v+1;
   return v;
}





function sp (){

  var l = document.getElementById('limpressor'+plingua);
  if ( l ) 
    l.style.display = 'none';

  }
 function nosp (){
  var l = document.getElementById('limpressor'+plingua);
  if ( l ) l.style.display = 'block';

  }

 var bhist = 0;
 function  ixfuncao(valor,lingua){
      if (!lingua || lingua == '') plingua = 1;
		else plingua = lingua;

      if ( valor != 0 )
               sp();
            else { 
				nosp();
				mostraCaminho('');
				}


     
      
        zix = valor;
    if ( !zmain.ixlpfuncao ){

           burl = location.href ;
		   
		   var tmp = burl.split('?');
	 
           zmain.location.href=tmp[0]+ 'main.php?cix='+escape(valor)
                +"&lang="+ escape(lingua)
                +'&v='+ fviewn();
          return;

     }
        zmain.ixlpfuncao(valor,lingua);
        posicionaIMGTopo();
		
		if ( bhist == 0)   bhist = zmain.history.length ;
	
        //return;
        }

 function  busca(valor,lingua){
     zmain.busca(valor)
     posicionaIMGTopo();
    }


    function zprint(){
	 zmain.zix = zix;
     zmain.zprint();
    }


 function mostraCaminho(caminho){
  var l = document.getElementById('llocalizacao');
  if ( !l ) return;
  
  l.innerHTML = caminho;  
  l.style.display = 'block';
 }


 function reload() { 
  window.location.reload();
 }


  function gmenix(valor){
   var l = document.getElementById('ifmenix');
   if ( !l ) return;
   l.src='db/menix.php?cod='+valor;
  
  }

  function voltarAtras(){
    if ( zmain.history.length > bhist )
		zmain.history.go(-1);
	}
     
 

