var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;

function newPage(nextFile) {
	var thisFile = findThisFileName ();
	if (nextFile == thisFile) return;
	if (nextFile.indexOf("/") != -1) {
		self.location.href=nextFile;
	} else {
		self.location.href="/htmls/"+nextFile+"?inpg";
	}
}

if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
  document.write('<SCRIPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('Sub menu_FSCommand(ByVal command, ByVal args)\n');
  document.write(' call menu_DoFSCommand(command, args)\n');
  document.write('end sub\n');
  document.write('Sub topo_FSCommand(ByVal command, ByVal args)\n');
  document.write(' call topo_DoFSCommand(command, args)\n');
  document.write('end sub\n');
  document.write('</SCRIPT\> \n');
} 

var fotoWindow;
function popImg(filename,extraInfo) {
	var extraHeight = extraInfo ?40 : 0;
	if (fotoWindow){
		fotoWindow.close();
	}
	fotoWindow=window.open("", "fotoWindow", "height=150,width=150,resize=yes,scrollbars=yes,status=yes");
	fotoWindow.document.write("<HTML>");
	fotoWindow.document.write("<HEAD>");
	fotoWindow.document.write("<SCRIPT LANGUAGE=\"JavaScript\">function resizeMe(picRef) {MM_showHideLayers('tempLayer','','hide');if (window.screen){ var Wlimit = screen.width-70; var Hlimit = screen.height-80; } var picW = picRef.width+50; var picH = picRef.height+70+"+extraHeight+"; var targetW = (Wlimit) ? (picW > Wlimit) ? Wlimit : picW : picW; var targetH = (Hlimit) ? (picH > Hlimit) ? Hlimit : picH : picH; window.resizeTo(targetW,targetH); var window_left = (window.screen.width/2) - ((targetW/2) + 5); 	var window_top = (window.screen.height/2) - ((targetH/2) + 22); 	window.moveTo(window_left,window_top);} </SCR"+"IPT>");
	fotoWindow.document.write('<script language="JavaScript" type="text/JavaScript">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);function MM_findObj(n, d) { 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=MM_findObj(n,d.layers[i].document);if(!x && d.getElementById) x=d.getElementById(n); return x;}function MM_showHideLayers() { var i,p,v,obj,args=MM_showHideLayers.arguments;for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];if (obj.style) { obj=obj.style; v=(v==\'show\')?\'visible\':(v==\'hide\')?\'hidden\':v; }obj.visibility=v; }}</scr'+'ipt>');
	fotoWindow.document.write("<TITLE>Imagem</TITLE>");
	fotoWindow.document.write("<HEAD>");
	fotoWindow.document.write("<BO"+"DY onmouseover=\"window.status='';return true;\" leftmargin='10' topmargin='10' marginwidth='10' marginheight='10' bgcolor='#cccccc'>");
	fotoWindow.document.write('<div id="tempLayer" style="position:absolute; left:0; top:0; width:150; height:150; z-index:10; background-color: #cccccc; layer-background-color: #cccccc; border: 1px none #333333; visibility: visible; overflow: visible;"><table width="130" height="130"  border="0" cellpadding="0" cellspacing="0"><tr><td align="center" valign="middle"><font face="Verdana" size="2">Por favor aguarde.</font></td></tr></table></div>');
	fotoWindow.document.write("<A href=javascript:self.close()>");
	fotoWindow.document.write("<IMG name=foto id=foto src="+filename+" onLoad=resizeMe(this) border=0 alt=\"clique para fechar esta imagem\"></a>");
	if (extraInfo) {fotoWindow.document.write('<p align="center"><font face="Verdana" size="2">'+extraInfo+'</font></p>');}
	fotoWindow.document.write("</body></HTML>");
}

var infoWindow;
function popinfo(file,w,h) {
	if (infoWindow){
		infoWindow.close();
	}
	infoWindow=window.open(file, "infoWindow", "height="+h+",width="+w+",resize=no,scrollbars=yes,status=yes");
}

function findThisFileName () {
	var thisFile = self.location.href.substr(self.location.href.lastIndexOf("/")+1);
	if (thisFile.indexOf("?") >= 0){
		thisFile = thisFile.substr(0,thisFile.indexOf("?"));
	}
	return thisFile;
}

function fillLayer(objName,newText) { 
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}

//-----------------------------------------

function MM_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=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_setTextOfLayer(objName,x,newText) { //v4.01
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}

//-----------------------------------------------

function swapMenuImage(layerId,isOver) {
//	newImage = (isOver) ? "url(<FilePath: CustomField_tilemenu_over>)" : "url(<FilePath: CustomField_tilemenu_out>)";
//	newColor = (isOver) ? "#<Field: CustomField_cor_menu_over>" : "#<Field: CustomField_cor_menu>";
	newImage = (isOver) ? "url(/_imgs/bgtile/menu_on.jpg)" : "url(/_imgs/bgtile/menu_off.jpg)";
	newColor = (isOver) ? "#1d3910" : "#1d3910";
	document.getElementById(layerId).style.backgroundImage = newImage;
	document.getElementById(layerId).style.backgroundColor = newColor;
}

var expandedMenus = new Array();
function swapMenuText (layerId) {
	if (tree[layerId].length == 3) {
		window.location.href = (tree[layerId][2]) ? tree[layerId][2] : '/cgi-bin/getinfos.pl?'+tree[layerId][1];
		return false;
	} else if (expandedMenus[layerId]) {
		MM_setTextOfLayer(layerId,'',"<img src=/imgs/spacer.gif width=1 height=25 align=absmiddle><span class=menus><b>"+tree[layerId][0]+"</b></span>"+spacerCode);
		expandedMenus[layerId] = false;
	} else {
		MM_setTextOfLayer(layerId,'',"<img src=/imgs/spacer.gif width=1 height=25 align=absmiddle><span class=menus><b>"+tree[layerId][0]+"</b></span>"+printSubmenus(layerId)+spacerCode);
		expandedMenus[layerId] = true;
	}
}

function printSubmenus(menuId) {
	var output = '<span class=menus>';
	for(var i=3; i<tree[menuId].length; i+=3){
		output += '<br><img src=/imgs/menu_linha.gif vspace=2 hspace=0><br>&nbsp;&nbsp;&nbsp;»<a href="';
		output += (tree[menuId][i+2]) ? tree[menuId][i+2] : '/cgi-bin/getinfos.pl?'+tree[menuId][i+1];
		output += '" class=menus>'+tree[menuId][i]+'</a>';
	}
	output += '</span>';
	return output;
}

var spacerCode='<br><img src=/imgs/menu_linha.gif>';

function buildMainMenus () {
	var output = '';
	for(var i=0 in tree){
		output += "<div id="+i+" class=menu_normal onMouseOver=swapMenuImage('"+i+"',1) onMouseOut=swapMenuImage('"+i+"',0); onClick=swapMenuText('"+i+"')><img src=/imgs/spacer.gif width=1 height=25 align=absmiddle><span class=menus><b>"+tree[i][0]+spacerCode+"</b></span></div>\n";
	}
	document.write(output);
	
	randHeader ();
}

function randHeader () {
	var rand_no = Math.ceil(9*Math.random());// 5 = # de CSS's
	obj=MM_findObj('headerimg');
	if (obj){
		obj.className="cx_cabecalho"+rand_no;
	}
}
//randHeader();

var tree = new Array();

tree['pginainicial'] = ['PÁGINA INICIAL'];
tree['pginainicial'].push('EkkyEukAyFjFHtessJ');
tree['pginainicial'].push('http://www.apatrelagem.com/htmls/home.shtml');
tree['apa'] = ['APA '];
tree['apa'].push('EkkyplEFVpdHDbjCha');
tree['apa'].push('');
tree['oficiaisdeconcursos'] = ['OFICIAIS DE CONCURSOS'];
tree['oficiaisdeconcursos'].push('EkupAElyZZtZhdGVHB');
tree['oficiaisdeconcursos'].push('');
tree['impressos'] = ['IMPRESSOS'];
tree['impressos'].push('EkkAyuEuZpICSDXcaj');
tree['impressos'].push('');
tree['seguros'] = ['SEGUROS'];
tree['seguros'].push('EkFVEVEpylhamAbpqq');
tree['seguros'].push('');
tree['tradioelazer'] = ['TRADIÇÃO E LAZER'];
tree['tradioelazer'].push('EkkyplyppZvBpYiBuS');
tree['tradioelazer'].push('');
tree['concursoscompletos'] = ['CONCURSOS COMPLETOS'];
tree['concursoscompletos'].push('EkkyplypVliNxADqOe');
tree['concursoscompletos'].push('');
tree['derbieseiniciao'] = ['DERBIES E INICIAÇÃO'];
tree['derbieseiniciao'].push('EkkyplypluBAxdYasW');
tree['derbieseiniciao'].push('');
tree['clubeseregies'] = ['CLUBES E REGIÕES'];
tree['clubeseregies'].push('EkkyplyEEAVgLQaCgV');
tree['clubeseregies'].push('');
tree['anuriocomercial'] = ['ANUÁRIO COMERCIAL'];
tree['anuriocomercial'].push('EkkyplyEuVhWVGgdpf');
tree['anuriocomercial'].push('');
tree['calendrios2009'] = ['CALENDÁRIOS 2009'];
tree['calendrios2009'].push('EkFFyyuAyFsiQZmyVd');
tree['calendrios2009'].push('');
tree['resultadosinternac2009'] = ['RESULTADOS INTERNAC.2009'];
tree['resultadosinternac2009'].push('EkkypAkklpUidAjJYP');
tree['resultadosinternac2009'].push('');
tree['resultadosnacionais2009'] = ['RESULTADOS NACIONAIS 2009'];
tree['resultadosnacionais2009'].push('EkkllVylFuOuPpCiYB');
tree['resultadosnacionais2009'].push('');
tree['linksparaverfilmes'] = ['Links para ver filmes'];
tree['linksparaverfilmes'].push('EkkZpkAykZJEDhJkHG');
tree['linksparaverfilmes'].push('');
tree['links'] = ['Links'];
tree['links'].push('EEyAVZVpZljsAhUIGa');
tree['links'].push('');
tree['agenda'] = ['Agenda'];
tree['agenda'].push('EkkZlZEZpEmJuhenDx');
tree['agenda'].push('http://www.apatrelagem.com/htmls/agenda.shtml');

tree['impressos'].push('SEGUROS');
tree['impressos'].push('EkFFVEkEZuGDeBEqvD');
tree['impressos'].push('');
tree['derbieseiniciao'].push('Concorrentes inscritos');
tree['derbieseiniciao'].push('EkFVZVyZFyqOPdKdvl');
tree['derbieseiniciao'].push('');
tree['linksparaverfilmes'].push('CAI-W de MECHELEN');
tree['linksparaverfilmes'].push('EkFEukVlykWSIhbPwp');
tree['linksparaverfilmes'].push('http://www.paardensport.tv/');
tree['oficiaisdeconcursos'].push('Concursos Completos');
tree['oficiaisdeconcursos'].push('EkupAElZkyCLZYWrcG');
tree['oficiaisdeconcursos'].push('');
tree['impressos'].push('INSCRIÇÃO NA APA');
tree['impressos'].push('EkkAyuEVFyUPpbGSMh');
tree['impressos'].push('');
tree['resultadosnacionais2009'].push('Concursos Completos');
tree['resultadosnacionais2009'].push('EkkypAklypQddrEXgu');
tree['resultadosnacionais2009'].push('');
tree['clubeseregies'].push('Norte');
tree['clubeseregies'].push('EkkypApVZEepesYFDX');
tree['clubeseregies'].push('');
tree['derbieseiniciao'].push('Agenda Regional');
tree['derbieseiniciao'].push('EkkypApEyZNvPsLXrX');
tree['derbieseiniciao'].push('');
tree['concursoscompletos'].push('Agenda Nacional');
tree['concursoscompletos'].push('EkkyplyuEyHtImLihS');
tree['concursoscompletos'].push('');
tree['tradioelazer'].push('Agenda');
tree['tradioelazer'].push('EkkyplykkAHIvxvdsC');
tree['tradioelazer'].push('');
tree['apa'].push('O que é a APA ');
tree['apa'].push('EkkyplkukVUOVfRtRO');
tree['apa'].push('');
tree['linksparaverfilmes'].push('BEESD - FREDERICO BECK ');
tree['linksparaverfilmes'].push('EkkZpkAZAuyGfAhwCg');
tree['linksparaverfilmes'].push('http://attelage.org/f_video_read.php?id=1623');
tree['oficiaisdeconcursos'].push('Derbies');
tree['oficiaisdeconcursos'].push('EkupAElZZEVuAEVILs');
tree['oficiaisdeconcursos'].push('');
tree['impressos'].push('ACTUALIZAÇÃO DE DADOS');
tree['impressos'].push('EkFpZVpyZFTovHKZNd');
tree['impressos'].push('');
tree['linksparaverfilmes'].push('BEESD - ANA CRIST.GUERREIRO');
tree['linksparaverfilmes'].push('EkkZpkAlyEFFMwRoBS');
tree['linksparaverfilmes'].push('http://attelage.org/f_video_read.php?id=1614');
tree['resultadosnacionais2009'].push('Concursos Combinados');
tree['resultadosnacionais2009'].push('EkkypAklAFYyRlPBri');
tree['resultadosnacionais2009'].push('');
tree['derbieseiniciao'].push('Agenda Nacional');
tree['derbieseiniciao'].push('EkkypApEAVOdwewrEb');
tree['derbieseiniciao'].push('');
tree['apa'].push('Breve história da modalidade');
tree['apa'].push('EkkyplAFkFSMvLRyOn');
tree['apa'].push('');
tree['concursoscompletos'].push('Agenda Internacional');
tree['concursoscompletos'].push('EkkyplyuVuEVLyOGnJ');
tree['concursoscompletos'].push('');
tree['tradioelazer'].push('Artigos de Tradição e Lazer');
tree['tradioelazer'].push('EkkyplykVlCxIuyRwL');
tree['tradioelazer'].push('');
tree['impressos'].push('PRÉ-INSCRIÇÃO DE DERBIES');
tree['impressos'].push('EkFpZVpZEuzFBghaqi');
tree['impressos'].push('');
tree['linksparaverfilmes'].push('BEESD - CHRISTOPHER BECK');
tree['linksparaverfilmes'].push('EkkZpkAAFuqtrxUCyX');
tree['linksparaverfilmes'].push('http://attelage.org/f_video_read.php?id=1610');
tree['resultadosnacionais2009'].push('Derbies - Regional Norte');
tree['resultadosnacionais2009'].push('EkkypAkAkVEURHHjhm');
tree['resultadosnacionais2009'].push('');
tree['clubeseregies'].push('Centro');
tree['clubeseregies'].push('EkkypApyFZuZlVhOyk');
tree['clubeseregies'].push('');
tree['derbieseiniciao'].push('Artigos de Derbies e Iniciação');
tree['derbieseiniciao'].push('EkkypApkyECrjwDUVs');
tree['derbieseiniciao'].push('');
tree['concursoscompletos'].push('Artigos de Concursos');
tree['concursoscompletos'].push('EkkyplyulkVwocYdwx');
tree['concursoscompletos'].push('');
tree['tradioelazer'].push('Regulamentos');
tree['tradioelazer'].push('EkkyplyklVbOWqgSTH');
tree['tradioelazer'].push('');
tree['apa'].push('Politica, Missão e Objectivos');
tree['apa'].push('EkkyplkullYwgfUSFb');
tree['apa'].push('');
tree['impressos'].push('INSCRIÇÃO EM PROVAS');
tree['impressos'].push('EkFpZVpZVpDWoEuKDt');
tree['impressos'].push('');
tree['resultadosnacionais2009'].push('Derbies - Regional Centro');
tree['resultadosnacionais2009'].push('EkkAppAyZlLlchqpPd');
tree['resultadosnacionais2009'].push('');
tree['clubeseregies'].push('Sul');
tree['clubeseregies'].push('EkkypApylpXcRLfbTw');
tree['clubeseregies'].push('');
tree['tradioelazer'].push('TREC atrelado');
tree['tradioelazer'].push('EkkyplyFEFGUKsyZWx');
tree['tradioelazer'].push('');
tree['apa'].push('Corpos Sociais');
tree['apa'].push('EkkyplkVkZzDRQakjB');
tree['apa'].push('');
tree['impressos'].push('RESULTADOS DERBIES');
tree['impressos'].push('EkuEpkVFllWfYpUTyV');
tree['impressos'].push('');
tree['clubeseregies'].push('Ilhas');
tree['clubeseregies'].push('EkkypApZEkxvsaAMFq');
tree['clubeseregies'].push('');
tree['concursoscompletos'].push('Regulamentos');
tree['concursoscompletos'].push('EkkyplyVukXARgNMoM');
tree['concursoscompletos'].push('');
tree['apa'].push('Lista de Sócios');
tree['apa'].push('EkkyplkVykWYykyfGy');
tree['apa'].push('');
tree['resultadosnacionais2009'].push('Derbies - Regional Sul');
tree['resultadosnacionais2009'].push('EkkAppAZpZjMgUFCcN');
tree['resultadosnacionais2009'].push('');
tree['derbieseiniciao'].push('Ranking Regional');
tree['derbieseiniciao'].push('EkkypApFAlCamZkvlH');
tree['derbieseiniciao'].push('');
tree['apa'].push('Sócios Honorários');
tree['apa'].push('EkkyplkVlAYTMuvcXj');
tree['apa'].push('');
tree['impressos'].push('Derbies - Programa tipo');
tree['impressos'].push('EkFZAAylyFUmteDrwe');
tree['impressos'].push('');
tree['derbieseiniciao'].push('Regulamentos');
tree['derbieseiniciao'].push('EkkypApVEFbQoXtpeW');
tree['derbieseiniciao'].push('');
tree['apa'].push('Estatutos');
tree['apa'].push('EkkyplkyFVtILYyzib');
tree['apa'].push('');
tree['apa'].push('Normas e Legislação');
tree['apa'].push('EkFEZAyllAaWtwNksa');
tree['apa'].push('');
tree['apa'].push('Organizadores de eventos');
tree['apa'].push('EkkyplllZFpuFzqwmu');
tree['apa'].push('');
tree['apa'].push('Artigos gerais');
tree['apa'].push('EkkykupyyECDfCTlKK');
tree['apa'].push('');
tree['apa'].push('Noticias-Decisões da Direcção');
tree['apa'].push('EkkyVEuZupMAUccROk');
tree['apa'].push('');
tree[101] = ['Galerias'];
tree[101].push('');
tree[101].push('/htmls/galerias.shtml');
 
tree[103] = ['Loja'];
tree[103].push('');
tree[103].push('/htmls/loja.shtml');
  tree['forum'] = ['Fórum'];
tree['forum'].push('');
tree['forum'].push('/cgi-bin/forum/index.pl');

tree[105] = ['Contactos'];
tree[105].push('');
tree[105].push('/htmls/contactos.shtml');

