<!--
<!--
//####################################################################################################
//!-- Funcao que actualiza a pagina quando se altera o tamanho da janela no Nav4
function ReloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=ReloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
ReloadPage(true);
//====================================================================================================
// -->


//####################################################################################################
//!-- Funcao que procura um objecto na pagia
function FindObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=FindObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
//====================================================================================================


//####################################################################################################
//!-- Funcao que altera um propriedade num objecto
function ChangeProp(objName,x,theProp,theValue) { //v6.0
  var obj = FindObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}
//====================================================================================================


//####################################################################################################
//!-- Funcoes usadas no formulario de pesquisa
 function SetDistrito(SD_Obj,SD_Url){
   if (SD_Obj.selectedIndex!=0){
       window.location.href = SD_Url +'?page=search&srx_dst='+ SD_Obj.options[SD_Obj.selectedIndex].value;
   }
 }
 function ClearFrmStyle(RFS_Obj){
   ChangeProp(RFS_Obj.name,'','style.fontStyle','normal','DIV');
 }
 function ResetFrmStyle(RFS_Obj){
   ChangeProp(RFS_Obj.name,'','style.fontStyle','italic','DIV');
 }
 function validar(FrmObj){
   var erro = '';
   if(FrmObj.srx_dst.selectedIndex!=0){
     if(FrmObj.srx_cns.selectedIndex==0){
       erro += 'O formulário de pesquisa não foi correctamente preenchido.\n';
       erro += 'Alguns campos não foram preenchidos/seleccionados correctamente.\n\n';
       erro += 'Tem que seleccionar um Concelho.\n';
       alert(erro + '\nPor favor, verifique os campos e tente novamente.');
       return false;
     }
   }
 }
//====================================================================================================

//####################################################################################################
//!-- Funcao que impossibilita o uso dos botoes do rato para ver o codigo
function disableRightClick(e){
  if(!document.rightClickDisabled) { // initialize
    if(document.layers) {
      document.captureEvents(Event.MOUSEDOWN);
      document.onmousedown = disableRightClick;
    }
    else document.oncontextmenu = disableRightClick;
    return document.rightClickDisabled = true;
  }
  if(document.layers || (document.getElementById && !document.all)) {
    if (e.which==2||e.which==3) { return false; }
  }
  else { return false; }
}
disableRightClick();
//====================================================================================================

//####################################################################################################
//!-- Funcao usada pelos destaques, para mudar a cor das linhas
function DstkRsChangeBg(Obj,ClassColor){
 var NewClassColor = '';
  if (ClassColor == 'over'){ NewClassColor='DstkRsOver'; }
  if (ClassColor == 'out'){ NewClassColor='DstkRs'; }
  Obj.className = NewClassColor;
}
//====================================================================================================

//####################################################################################################
//!-- Funcao usada pela pesquisa, para mudar a cor das linhas
function SrxRsChangeBg(Obj,ClassColor){
 var NewClassColor = '';
  if (ClassColor == 'over'){ NewClassColor='SrxRsOver'; }
  if (ClassColor == 'out'){ NewClassColor='SrxRs'; }
  Obj.className = NewClassColor;
}
//====================================================================================================

//-->
