/* 
	© copyright 2006 webuild solutions
	http://www.webuild.pt
	
*/

// trocaCss		/////////////////////////////////////////////////////////
function thumbsFX(alvo,estilo){
	alvo.className = estilo;	
}

//open window	/////////////////////////////////////////////////////////
function MM_openBrWindow(theURL,winName,features) { //v2.0
	window.open(theURL,winName,features);
}


//muda fundo	/////////////////////////////////////////////////////////
function bk(objecto,cor,imagem) {
	if(imagem == "imagemOut"){
		imagem = "url(images/setaAzul.gif)";//mouseOver
		verMenu = "hidden";
	} 
	else if(imagem == 'imagemOver'){
		imagem = "url(images/setaBranca.gif)";//mouseOut
		verMenu = "visible";
	} else {
		imagem = "none";
	}	
	objecto.style.backgroundColor = cor;
	objecto.firstChild.style.backgroundImage = imagem;
}

//fx caixa de pesquisa //////////////////////////////////////////////////
//Versão que deduz a linguagem activa, poderá se fazer uma função que recebe 
//a linguagem como parametro, mas esta funciona sempre.
var PESQUISA_PT = "Pesquisar"
var PESQUISA_ING = "Search"

var pesquisa_lang = "PT"	//variavel de controlo interna
function pesquisa(x,y,z) {	//Box Pesquisa
	if (x.value==PESQUISA_PT || x.value==PESQUISA_ING){		
		if 	(x.value==PESQUISA_PT) {
			pesquisa_lang = "PT"
		} else {	//ING
			pesquisa_lang = "ING"
		}
		x.value="";
	} else {
		if (x.value==""){
			//Liga
			if (pesquisa_lang == "PT") {
				x.value=PESQUISA_PT;
			}
			else {	//ING
				x.value=PESQUISA_ING;
			}
		}
	}

	document.getElementById('boxPesquisa').style.borderColor = y; //fundo
	x.style.color = z;			//letras
}

//fx caixa de pesquisa //////////////////////////////////////////////////
//function pesquisa(x,y,z) {//Box Pesquisa
/*	if (x.value=="Palavra-chave..."){
		x.value="";
	} else 
	if (x.value==""){
		x.value="Palavra-chave...";
	}

	document.getElementById('boxPesquisa').style.borderColor = y; //fundo
	document.getElementById('boxPesquisaTextBox').style.color = z; //letras
*/
//}


//menu slide de entrada /////////////////////////////////////////////////
function MenuSlide(Obj){
	//alert(Obj);//debug target
	var target = document.getElementById(Obj);
	if(target.style.display == "block"){
		target.style.display = "none";
	} else {
		target.style.display = "block";
	}
}


//menu		/////////////////////////////////////////////////////////////
var timerteste = null;//timer desligado 
var timerOn = false;//timer ligado se igual a "true" 
var tempo = 500; 

function StartTimer(Obj){ 
 	
	if (timerOn == false){
		clearTimeout(timerteste); //se o timer estiver ligado faz reset
		
		Obj = new String(Obj);
		newObj = Obj.substring(7,8);
		newObj = new Number(newObj);

		menuoff = "MenuLateralOff('submenu"+ newObj +"')"; //apaga o menu
		timerteste = setTimeout(menuoff, tempo);
	}
}

function StopTimer(){ 
 	if (timerOn != null){
		clearTimeout(timerteste); 
		timerteste = null;
		timerOn = false;}
}


//menu lateral	/////////////////////////////////////////////////////////

function MenuLateral(Obj){
	var target = document.getElementById(Obj);
	if(target.style.display == "block"){
		target.style.display = "none";
	} else {
		target.style.display = "block";
	}
}

function cleanMenus(){
	for (var i=1; i< 5; i++){
		var xpto ="submenu" + i;
		if (document.getElementById(xpto).style.display == "block"){
			document.getElementById(xpto).style.display = "none";
		}
	}			
}
function MenuLateralOn(Obj){
	cleanMenus();
	var target = document.getElementById(Obj);
	target.style.display = "block";
}

function MenuLateralOff(Obj){
	var target = document.getElementById(Obj);
	target.style.display = "none";
}
///////////////////////////////////////////////////////////////////////