//pre-load....
var img1 = new(Image);
img1.src = "imagens/link-img.gif";
var img2 = new(Image);
img2.src = "imagens/link-img-hover.gif";



w = 0 ;
altura = 300;
idTimeout = 0;
idTempo = 0;
contador = 0;
andar = false;

function Reset(){
w = document.getElementById("lf-selector");
w.style.top = "-"+altura+"px";
}


function limpa(){
for (a=0;a < 100;a++){
clearInterval(idTimeout);
}

andar = false;
}

function anda(t){
andar = true;
b = w.style.top;
b = b.slice(0,-2);
if (t==0){//descer
  if (b < 0){
	   b = Math.round(b)+20;
	   w.style.top = b+"px";
	  } else {limpa();return true;}
} else {//subir
  if (b > (-1*altura)){
	   b = Math.round(b)-20;
	   w.style.top = b+"px";
	  } else {limpa();return true;}
}

}

function baixo(n){
	anda(n);
}

function contagem(){
contador++;
if (contador > 7){
	lfup();
	clearInterval(idTempo);
	contador = 0;
	return true;
	} else {
	document.getElementById("progress").style.width = (contador*10)+'%';
//	document.getElementById("fechar").innerHTML = "Fechar";
	}

}

function lfdown(){
if (!andar) {
	clearInterval(idTimeout);
	idTimeout = setInterval("baixo(0)", 1);
	contador = 0;
	clearInterval(idTempo);
	idTempo = setInterval("contagem( )",500);
}

}

function lfup(){
if (!andar) {
	clearInterval(idTimeout);
	idTimeout = setInterval("baixo(1)", 1);
	document.getElementById("progress").style.width = '1px';
	}

}

function ShowDesc(n){
liToShow = document.getElementById("li-"+n);
liToShow.style.display = "block";
}

function HideDesc(){
if (document.all){//ie
b = document.all.tags("div");
c = b.length;
for (a=0;a<c;a++){
 if (b[a].className=="li-desc"){
 b[a].style.display = "none";
 }
}
}//ie
else {
c = 13;
for (a=1;a<=c;a++){
 var myVar = "li-"+a;	
 var b = document.getElementById(myVar);	
 if (b){
 if (b.className=="li-desc"){
 b.style.display = "none";
 }//if
 }//if
}//for
}
}
function Bk(){
setInterval("ChangeBk( )",10000);
}

function ChangeBk(){
c = Math.floor(Math.random()*(4))+1;
switch (c) {
case 1 : b = "url(imagens/c4.jpg) no-repeat";break;
case 2 : b = "url(imagens/c2.jpg) no-repeat";break;
case 3 : b = "url(imagens/c3.jpg) no-repeat";break;
case 4 : b = "url(imagens/c1.jpg) no-repeat";break;
}
a = document.getElementById("content");
if (a.style.background != ''){
a.style.background = b;}
}

function TiraCardinal(st){
if (st.indexOf('#')>= 0){
			return (st.substring(0,st.length-1));
			} else return st;
}

function espera()
{
var date = new Date();
var curDate = null;

do { curDate = new Date(); }
while(curDate-date < 1000);
}

function nada(){
	return;
}
						 
function ChangeStyle(n){
	//alert('Peço desculpa:\nEmbora a função de troca de estilos esteja a funcionar, os estilos ainda não estão.\nBrevemente poderá voltar e verificar');
	//return true;
document.forms['estilo'].look.value = n;
document.forms['estilo'].action = location.href;
document.forms['estilo'].submit();
//ie6 hack
if (isIe6()) {
espera();
location.reload();
}
lfup();
return;
}




var detect = navigator.userAgent.toLowerCase();
var OS,browser,total,thestring;
var version = 0;

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

function isIe6(){
<!-- // JavaScript by PPK


if (checkIt('konqueror'))
{
	browser = "Konqueror";
	OS = "Linux";
}
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('firefox')) browser = "Firefox"
else if (checkIt('msie')) browser = "IE";//"Internet Explorer"
else if (!checkIt('compatible'))
{
	browser = "Netscape Navigator"
	version = detect.charAt(8);
}
else browser = "An unknown browser";

if (!version) version = detect.charAt(place + thestring.length);

if (!OS)
{
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac"
	else if (checkIt('win')) OS = "Windows"
	else OS = "...an unknown operating system";
}


return (browser=="IE" && (version <= 6));
// -->
}