function buscar(){

	d = document.formulario;

	if(d.busca.value != ""){
		d.method = "POST";
		d.action = "../home/busca.asp";
		d.submit();
	}
	else alert((idioma=="port")? "Digite algo para poder buscar." : "Type any word to search.");
	
}

function tentabuscar(){
	if(event.keyCode==13) buscar();
}


function navegacao_rapida(){

	d = document.formulario;
	url = d.rapida.options[d.rapida.selectedIndex].value;
	
	if(url != "") top.location = url;
	
}


function imprimir(){

	if(window.print){

		if(document.all){
			menu_esquerdo.style.display = "none";
			topo.style.display = "none";
			rodape.style.display = "none";
		}

		window.print();

		if(document.all){
			menu_esquerdo.style.display = "block";
			topo.style.display = "block";
			rodape.style.display = "block";
		}

	}
	else alert((idioma=="port")? "Desculpe seu browser não suporta esta função. Por favor utilize a barra de ferramentas para imprimir a página." : "Sorry, your browser don't support this function.");

}

function redirecionacombo(combo, janela){

	url = combo.options[combo.selectedIndex].value;

	if(url != ""){
		if(janela=="novajanela") self.open(url, "_blank");
		else self.location = url;
	}

}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function balancos(idioma){
	window.open("http://www.mediagroup.com.br/BalInt/index.asp?empresa=CBD&idioma=" + idioma, "BalIntCBD" + idioma, 
				"width=" + (screen.availWidth-10) + ",height=" + (screen.availHeight-60) + ",top=0,left=0,resizable=yes,scrollbars=yes,status=yes");
}

function detalhes_serie(idioma, acao, mes, ano){
	window.open("http://www.apligraf.com.br/webfeed/cbd/historico001.php?drop=nao&idioma=" + idioma + "&ativo=" + acao + "&ano=" + ano + "&mes=" + mes + "", "", "width=350,height=400,scrollbars=yes")
}

function janela(url, w, h){
	open(url, "popupbusca", "width=" + w + ",height=" + h + ",left=" + ((screen.availWidth-w)/2) + ",top=" + ((screen.availHeight-h)/2));
}

function abrir(url){
	open(url);
}

//  script DHTMLcombo:

var DHTMLcomboaberta = "";
var DHTMLcomboindex = 100;

function DHTMLcombo(combo){

	app = navigator.appVersion;

	if(navigator.userAgent.indexOf("Windows NT 5.1")!=-1){ combo.seta = "66,17,82,0"; combo.setaT = 66; combo.setaW = 17; }
	else if(app.substring(app.indexOf("MSIE ")+5,app.indexOf("MSIE ")+8)<5.5){ combo.seta = "68,16,84,0"; combo.setaT = 68; combo.setaW = 16; }
	else { combo.seta = "68,16,84,0"; combo.setaT = 68; combo.setaW = 16; }

	combo.nval = ((combo.valores.length-1) * 16) + 1;
	combo.altura = combo.nval>97? 97 : combo.nval;

	combo.tags = '<span style="position: relative; width: ' + combo.width + 'px; z-index: ' + (DHTMLcomboindex--) + ';">';

	combo.tags += '<span id=combo' + combo.name + ' class=' + combo.caixa + ' style="position: absolute; width: ' + combo.width + 'px; height: 16px; '+
				  'overflow: auto; overflow-x: hidden; ' + (combo.nval>97?'':'border-right: 1px solid #42A3DC;') + ' clip: rect(0,' + (combo.width-combo.setaW) + ',' + combo.setaW + ',0); '+
				  'z-index: ' + (DHTMLcomboindex--) + ';">';

	combo.tags += '<table width=' + combo.width + ' cellpadding=0 cellspacing=0 border=0>';

	for(var x in combo.valores){
		valor = combo.valores[x];
		combo.tags += "<tr valign=top class=\"" + combo.apagado + "\" "+
						"onmousedown=\"" + valor.link + "\" "+
						"onmouseover=\"this.className='" + combo.aceso + "'\" "+
						"onmouseout=\"this.className='" + combo.apagado + "'\">"+
						"<td width=" + (combo.width-combo.setaW-20) + ">&nbsp;" + valor.titulo + "</td>"+
					  "</tr>";
	}
						//"<td width=20><img src=/vivo/_imagens/icone_" + valor.icone + ".gif border=0 width=12 height=12 hspace=4 vspace=2><td>"+

	combo.tags += '</table>';
	combo.tags += '</span>';
	
	combo.tags += '<span ' + (combo.valores.length>0? 'onScroll' : 'comandos') + '="fechacombo(); DHTMLcomboaberta=' + combo.name + '; '+
				  'combo' + combo.name + '.style.clip=\'rect(0,' + (combo.width) + ',400,0)\'; '+
				  'combo' + combo.name + '.style.height=' + combo.altura + '; '+
				  'combo' + combo.name + '.style.overflow=\'auto\';" '+
				  'class=' + combo.caixa + ' style="position: absolute; border: none; direction: rtl; '+
				  'left: ' + (combo.width-combo.setaW) + 'px; overflow: scroll; top: -' + combo.setaT + '; '+
				  'clip: rect(' + combo.seta + '); width: 20px; height: 100px; z-index: ' + (DHTMLcomboindex--) + ';";">'+
				  '<span style="height: 1000000000000000px"></span></span>';
	combo.tags += '</span>';

	document.write(combo.tags);

}


function fechacombo(){
	if(DHTMLcomboaberta!="") {
		DHTMLcomboaberta = eval(DHTMLcomboaberta);
		eval('combo' + DHTMLcomboaberta.name + '.style.clip=\'rect(0,' + (DHTMLcomboaberta.width-DHTMLcomboaberta.setaW) + ',400,0)\'; '+
			 'combo' + DHTMLcomboaberta.name + '.style.height=16; combo' + DHTMLcomboaberta.name + '.style.overflow=\'hidden\';');
		DHTMLcomboaberta = "";
	}
}
