// Javascript - Fábio Gonçalves Teixeira

try{
    xmlhttp = new XMLHttpRequest();
}catch(ee){
    try{
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
        try{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(E){
            xmlhttp = false;
        }
    }
}


function downloadTeste(l, arq, url){
	document.form.enctype = '';
	document.form.action = '/ras/produto/download.asp?redirect='+url;
	document.form.local.value = l;
	document.form.arquivo.value = arq;
	document.form.acao.value = 'download';
	document.form.submit();
}



function validaSolicitacaoPrimeiraParte(frm){
	var msg = ' Preencha corretamente o(s) campo(s) abaixo:\n';//
	var erro = false;
	
	if(frm.rSocial.value == ''){
		msg += ' - Razão social\n';
		if(!erro){
			erro = true;
			frm.rSocial.select();
		}	
	}
	if(frm.end.value == ''){
		msg += ' - Endereço\n';
		if(!erro){
			erro = true;
			frm.end.select();
		}
	}
	if(frm.numero.value == ''){
		msg += ' - Número\n';
		if(!erro){
			erro = true;
			frm.end.select();
		}
	}
	var cep = frm.cep.value.replace('-', '');
	if(cep == '' || isNaN(cep) || cep.length < 8){
		msg += ' - Cep\n';
		if(!erro){
			erro = true;
			frm.cep.select();
		}
	}
	if(frm.bairro.value == ''){
		msg += ' - Bairro\n';
		if(!erro){
			erro = true;
			frm.bairro.select();
		}
	}
	if(frm.cidade.value == ''){
		msg += ' - Cidade\n';
		if(!erro){
			erro = true;
			frm.cidade.select();
		}
	}
	if(frm.estado.value == 'NULL'){
		msg += ' - Estado\n';
		if(!erro){
			erro = true;
			frm.estado.focus();
		}
	}

	if(frm.contato.value == ''){
		msg += ' - Contato\n';
		if(!erro){
			erro = true;
			frm.contato.select();
		}
	}
	
	var dddTel = frm.dddTel.value;
	if(dddTel == '' || isNaN(dddTel) || dddTel.length < 3){
		msg += ' - DDD do telefone (999)\n';
		if(!erro){
			erro = true;
			frm.dddTel.select();
		}
	}
	var tel = frm.tel.value;
	if(tel == '' || isNaN(tel) || tel.length < 8){
		msg += ' - Telefone (99999999)\n';
		if(!erro){
			erro = true;
			frm.tel.select();
		}
	}
	
	if(frm.email.value == '' || !validaEmail(frm.email.value) ){
		msg += ' - Email\n';
		if(!erro){
			erro = true;
			frm.email.select();
		}
	}
	
	if(frm.segmento.value == 'NULL'){
		msg += ' - Segmento\n';
		if(!erro){
			erro = true;
			frm.segmento.focus();
		}
	}

	if(frm.grupoProduto.value == 'NULL'){
		msg += ' -  Produto\n';
		if(!erro){
			erro = true;
			frm.grupoProduto.focus();
		}
	}
	if(erro){
		alert(msg);
	}else{
		document.getElementById('parteDoFrm').value = 'primeiraParte' ;
		if(	document.getElementById('idCotacao').value != ''){
			document.getElementById('acao').value = 'update';
		}else{
			document.getElementById('acao').value = 'gravar'
		}
		document.frm.submit();
	}
}

function validaSolicitacaoProduto(frm){
	var msg = ' Preencha corretamente o(s) campo(s) abaixo:\n';//
	var erro = false;
	if(frm.embalagem.value == ''){
		msg += ' - Embalagem\n';
		if(!erro){
			erro = true;
			frm.embalagem.select();
		}	
	}
	if(frm.produto.value == ''){
		msg += ' - Produto\n';
		if(!erro){
			erro = true;
			frm.produto.select();
		}	
	}
	if(frm.quantidade.value == '' || isNaN(frm.quantidade.value)){
		msg += ' - Quantidade do produto\n';
		if(!erro){
			erro = true;
			frm.quantidade.select();
		}	
	}
	if(erro){
		alert(msg);
	}else{
		document.getElementById('acao').value = 'gravarProdutos' ;
		document.getElementById('parteDoFrm').value = 'segundaParte' ;
		document.frm.submit();
	}
}

function validaSolicitacaoEntrega(frm){
	var msg = ' Preencha corretamente o(s) campo(s) abaixo:\n';//
	var erro = false;
	if(frm.endEntrega.value == ''){
		msg += ' - Endereço de entrega\n';
		if(!erro){
			erro = true;
			frm.endEntrega.select();
		}	
	}
	if(frm.numeroEntrega.value == '' || isNaN(frm.numeroEntrega.value) ){
		msg += ' - Número do local\n';
		if(!erro){
			erro = true;
			frm.numeroEntrega.select();
		}
	}
	var cepEntrega = frm.cepEntrega.value.replace('-', '');
	if(cepEntrega== '' || isNaN(cepEntrega) || cepEntrega.length < 8){
		msg += ' - CEP do local\n';
		if(!erro){
			erro = true;
			frm.cepEntrega.select();
		}
	}
	if(frm.bairroEntrega.value == ''){
		msg += ' - Bairro do locaol\n';
		if(!erro){
			erro = true;
			frm.bairroEntrega.select();
		}
	}
	if(frm.cidadeEntrega.value == ''){
		msg += ' - Cidade\n';
		if(!erro){
			erro = true;
			frm.cidadeEntrega.select();
		}
	}
	if(frm.estado2.value == 'NULL'){
		msg += ' - Estado\n';
		if(!erro){
			erro = true;
			frm.estado2.focus();
		}
	}
	if(erro){
		alert(msg);
	}else{
		document.getElementById('parteDoFrm').value = 'terceiraParte';
		document.getElementById('acao').value = 'gravarEntrega' ;
		document.frm.submit();
	}


}
function deletarSolicitacaoProduto(idProduto){
	document.getElementById('parteDoFrm').value = 'segundaParte' ;
	document.getElementById('acao').value = 'deletarProduto' ;
	document.getElementById('idProduto').value = idProduto ;
	document.frm.submit();	
}

function btVoltarSolicitacao(){
	window.location.href = 'solicitacao.asp';
}

var intervalo;

function validaEmailLogin(frm){
	var msg = 'Preencha corretamente o E-mail !';//
	var erro = false;
	if(frm.emailLogin.value != '' && !validaEmail(frm.emailLogin.value) ){
		if(!erro){
			erro = true;
			frm.emailLogin.focus();
		}
	}
	if(erro){
		alert(msg);
		return false;
	}else{
		return true;
	}
}


//-------------------------------------------------------------------------------------------------------------------------------
// w3cookies
// Forma de uso:
// Criar: w3cookies.create('nome_do_cookie', 'valor', dias_para_expirar);
// Ler: w3cookies.read('nome_do_cookie');
// Deletar: w3cookies.erase('nome_do_cookie');
var w3cookies = {
	date: new Date(),
	create: function(strName, strValue, intDays) {
		if ( intDays ) {
			this.date.setTime(this.date.getTime()+(intDays*24*60*60*1000));
			var expires = "; expires=" + this.date.toGMTString();
		} else {
			var expires = "";
		}
		document.cookie = strName + "=" + strValue + expires + "; path=/";
	},

	read: function(strName) {
		var strNameIgual = strName + "=";
		var arrCookies = document.cookie.split(";");
		for ( var i = 0, strCookie; strCookie = arrCookies[i]; i++ ) {
			while ( strCookie.charAt(0) == " ") {
				strCookie = strCookie.substring(1,strCookie.length);
			}
			if ( strCookie.indexOf(strNameIgual) == 0 ) {
				return strCookie.substring(strNameIgual.length,strCookie.length);
			}
		}
		return null;
	},
	erase: function(strName) {
		this.create(strName,"",-1);
	}
}

//horarioAtual()
function horarioAtual(){
	rodaRelogio();
	intervalo = setInterval(rodaRelogio, 60000);
}

//rodaRelogio()
function rodaRelogio(){
	var dt = new Date();
	
	var hr = dt.getHours();
	if(hr < 10) hr = '0'+hr;
	
	var minutos = dt.getMinutes();
	if(minutos < 10) minutos = '0'+minutos;
	
	var sec = dt.getSeconds();
	if(sec <10) sec = '0'+sec;
	
	document.getElementById('relogio').innerHTML = hr + ':' + minutos;
	if(minutos == '30' && sec == '00') document.form.submit();
}

//menuLateral(subMenu)
function menuLateral(idMenu, url){
	var seta =  idMenu + 'Seta';	
	var menu = w3cookies.read('menu');
	
	if(document.getElementById(idMenu).style.display == 'none'){
		document.getElementById(idMenu).style.display = 'block';
		document.getElementById(seta).src = '/imagens/geral/menu/bulletDown.gif';
		
		if(menu != null){
			if(menu.indexOf('|'+idMenu+'|') == -1) menu += '|'+idMenu+'|';
		}else{
			menu = '|'+idMenu+'|';
		}
	}else{
		document.getElementById(idMenu).style.display = 'none';
		document.getElementById(seta).src = '/imagens/geral/menu/bullet.gif';
		
		menu = menu.replace('|'+idMenu+'|', '');
	}
	
	w3cookies.create('menu', menu, 1);
	
	if(url.length > 0) window.location.href = url;
}

//funcao que muda os beckgraunds das abas dos produtos
function mudaBG(div, acao){
	if(acao == 'hover'){
		document.getElementById(div+'AbaEsq').style.background = "url(/imagens/geral/produtos/abaEsquerdaHover.jpg)";
		document.getElementById(div+'AbaCon').style.background = "url(/imagens/geral/produtos/bgAbaHover.jpg)";
		document.getElementById(div+'AbaDir').style.background = "url(/imagens/geral/produtos/abaDireitaHover.jpg)";
	}else{
		document.getElementById(div+'AbaEsq').style.background = "url(/imagens/geral/produtos/abaEsquerda.jpg)";
		document.getElementById(div+'AbaCon').style.background = "url(/imagens/geral/produtos/bgAba.jpg)";
		document.getElementById(div+'AbaDir').style.background = "url(/imagens/geral/produtos/abaDireita.jpg)";
	}
}


//função que cria os links das marcar patenteadas
//linkMarcaComercial(idAreaAtuacao, idMarcaComercial)
function linkMarcaComercial(idMercadoAtuacao, idMarcaComercial){
	document.getElementById('idMercadoAtuacao').value = idMercadoAtuacao;
	document.getElementById('idMarcaComercial').value = idMarcaComercial;
	document.form.submit();
}
	
//valida checkbox interesse.asp
function validaCheckbox(frm){
	var unt = true;
	if(frm.checkbox == '[object HTMLInputElement]'){
		if(frm.checkbox.checked){
			return true;			
		}else{
			alert('Selecione alguma opção');
			return false;
		}
	}else{
		for(var i=0; i<frm.checkbox.length; i++){
	 		if(frm.checkbox[x].checked){
				return true;
			}
		}
	}
}

//cadastro.asp
function cadastroSite(){
	
	var msg = "Preencha o(s) campo(s) corretamente:\n";
	var mandaMsg = false;
	if (document.getElementById('email').value == ''){
		msg += "- E-mail\n";
		mandaMsg = true;
	}else if(!validaEmail(document.getElementById('email').value)){
		msg += "- E - mail incorreto\n";
		mandaMsg = true;
	}
	
	if (document.getElementById('senha').value == ''){
		msg += "- Senha\n";
		mandaMsg = true;
	}else if (!(document.getElementById('senha').value == document.getElementById('csenha').value)){
		msg += "- A confirmação da senha esta incorreta\n";
		mandaMsg = true;
	}
	
	if (document.getElementById('nome').value == ''){
		msg += "- Nome\n";
		mandaMsg = true;
	}
	if (document.getElementById('empresa').value == ''){
		msg += "- Empresa\n";
		mandaMsg = true;
	}
	if (document.getElementById('DDDtel').value == '' || isNaN (document.getElementById('DDDtel').value)){
		msg += "- DDD do telefone\n";
		mandaMsg = true;
	}
	if(document.getElementById('tel').value == '' || isNaN (document.getElementById('tel').value.replace('-',''))){
		msg += "- Telefone\n";
		mandaMsg = true;
	}

	if(document.getElementById('enderecoNumero').value != '' && isNaN (document.getElementById('enderecoNumero').value)){
		msg += "- Numero do endereço\n";
		mandaMsg = true;
	}

	if(document.getElementById('uf').value == 'NULL'){
		msg += "- Estado\n";
		mandaMsg = true;
	}

	if(document.getElementById('cidade').value == ''){
		msg += "- Cidade\n";
		mandaMsg = true;
	}

	if(document.getElementById('cep1').value == '' || isNaN(document.getElementById('cep1').value)){
		msg += "- CEP\n";
		mandaMsg = true;
	}
	if(document.getElementById('cep2').value == '' || isNaN(document.getElementById('cep2').value)){
		msg += "- CEP\n";
		mandaMsg = true;
	}


	if (mandaMsg == true){
		alert(msg);	
		return false;
	}else{
		document.getElementById('acao').value = "cadastroSite";
		return true;
	}
}


//cadastro.asp
function cadastroSite2(){
	
	var msg = "Preencha o(s) campo(s) corretamente:\n";
	var mandaMsg = false;
	if (document.getElementById('email').value == ''){
		msg += "- E-mail\n";
		mandaMsg = true;
	}else if(!validaEmail(document.getElementById('email').value)){
		msg += "- E - mail incorreto\n";
		mandaMsg = true;
	}
	
	if (document.getElementById('senha').value == ''){
		msg += "- Senha\n";
		mandaMsg = true;
	}else if (!(document.getElementById('senha').value == document.getElementById('csenha').value)){
		msg += "- A confirmação da senha esta incorreta\n";
		mandaMsg = true;
	}
	
	if (document.getElementById('nome').value == ''){
		msg += "- Nome\n";
		mandaMsg = true;
	}
	if (document.getElementById('empresa').value == ''){
		msg += "- Empresa\n";
		mandaMsg = true;
	}
	if (document.getElementById('DDDtel').value == '' || isNaN (document.getElementById('DDDtel').value)){
		msg += "- DDD do telefone\n";
		mandaMsg = true;
	}
	if(document.getElementById('tel').value == '' || isNaN (document.getElementById('tel').value.replace('-',''))){
		msg += "- Telefone\n";
		mandaMsg = true;
	}

	if (mandaMsg == true){
		alert(msg);	
		return false;
	}else{
		document.getElementById('acao').value = "cadastroSite";
		return true;
	}
}


function BtVoltarCadastro(){
	document.getElementById('TabelaMsg').style.display = "none";	
	document.getElementById('LblCadastro').style.display = "block";
	document.getElementById('TabelaCadastro').style.display = displayTabl;
	
}

function BtVoltarLogin(){
	document.getElementById('TabelaMsg').style.display = "none";	
	document.getElementById('lblLogar').style.display = "block";
	document.getElementById('divLogar').style.display = "block";
	
}

function ValidaLogOn(form){
	var msg = "Preencha o(s) campo(s) corretamente:\n";
	var mandaMsg = false;
	if (document.getElementById('email').value == ''){
		msg += "- E-mail\n";
		mandaMsg = true;
	}else if(!validaEmail(document.getElementById('email').value)){
		msg += "- E-mail incorreto\n";
		mandaMsg = true;
	}
	if (document.getElementById('senha').value == ''){
		msg += "- Senha\n";
		mandaMsg = true;
	}

	if (mandaMsg == true){
		alert(msg);
		return false;
	}else{
		document.getElementById('acao').value = "logarSite" ;
		return true;
	}
}

function segmentoSelecionado(idSegmento){
	//alert(idSegmento);
	//document.getElementById('segmento').value = idSegmento;
	document.getElementById('form').action = "lstProdutos.asp?segmento="+idSegmento;
	document.getElementById('form').submit();
}

function segmentoSelecionadoPrincipal(idSegmento, idioma){
	window.location.href = "/versao/"+idioma+"/produtos/lstProdutos.asp?segmento="+idSegmento+"&lstProdutoPagina=segmento";
}
function grupoProdutoSelecionado(idGrupoProduto, idioma){
	window.location.href = "/versao/"+idioma+"/produtos/lstProdutos.asp?grupoProduto="+idGrupoProduto+"&lstProdutoPagina=grupoProduto";
}
function marcaComercialSelecionadoPrincipal(idmarcaComercial, idioma){
	window.location.href = "/versao/"+idioma+"/produtos/lstProdutos.asp?marcaComercial="+idmarcaComercial+"&lstProdutoPagina=marcaComercial";
}
//
function preencheCombo(combo, tipo){
	try{
		if(intervalo == null && !combo[0].selected){
			var param;
			var rd = Math.random();

			if(tipo == 'estado'){
				defaultCmb('cidade');
			}

			tmpTipo = tipo;

			//Remove todos os registros
			for(var x=0; x<document.getElementById(tipo).length; x++){
				document.getElementById(tipo).remove(0);
			}

			addOption(document.getElementById(tipo), 'NULL', 'Aguarde...');

			xmlhttp.open("GET", '/funcao/asp/procDados.asp?rd='+rd+'&acao=buscar&tipo='+tipo+'&idEstado='+combo.value, true);
			xmlhttp.setRequestHeader("encoding", "ISO-8859-1"); 
			xmlhttp.send(null);

			intervalo = window.setInterval(fPreencheCombo, 500);
		}else{

			if(tipo == 'estado'){
				defaultCmb('estado');
				defaultCmb('cidade');
			}else if(tipo == 'cidade'){
				defaultCmb('cidade');
			}
		}
	}catch(e){
		alert(e);
	}
}

//
function fPreencheCombo(){
	try{
		if(xmlhttp.readyState == 4){
			clearInterval(intervalo);
			intervalo = null;

			var valorRetorno = xmlhttp.responseText;

			if(tmpTipo == 'estado'){
				document.getElementById('tdEstado').innerHTML = valorRetorno;
			}else if(tmpTipo == 'cidade'){
				document.getElementById('tdCidade').innerHTML = valorRetorno;
			}
		}
	}catch(e){
		alert(e);
		clearInterval(intervalo);
		intervalo = null;
	}
}

//Adiciona um novo registro a um comboBox
//addOption(cmb, vl, txt)
//sel.options[i] = new Option(opts_texts[i], opts_values[i]);
function addOption(cmb, vl, txt){
	var newOpt = document.createElement('option');
	newOpt.value = vl;
	newOpt.text = txt;

	try{
		cmb.add(newOpt, null); //Não funciona no IE
	}catch(e){
		cmb.add(newOpt); //IE
	}
}

//defaultCmb(tipo)
function defaultCmb(tipo){
	var comboTipo = document.getElementById(tipo);
	var lenComboTipo = comboTipo.length;
	var valueTipo = 'NULL';
	var textTipo;

	//Remove todos os registros
	for(var x=0; x<lenComboTipo; x++){
		comboTipo.remove(0);
	}

	if(tipo == 'estado'){
		textTipo = '';
	}else if(tipo == 'cidade'){
		textTipo = '';
	}

	addOption(comboTipo, valueTipo, textTipo);
}

function filtroCombo(cmb, url){
	var tipo = document.getElementById('tipo').value;

	if(tipo == 'EspecificacaoCliente'){
		if(cmb.name == 'grupoProduto'){
			document.getElementById('linha')[0].selected = true;
		}

		if(cmb.name == 'linha'){
			document.getElementById('grupoProduto')[0].selected = true;
		}
	}

	document.form.action = url;
	document.form.submit();
}

//ordenaLista(spn, url)
function ordenaLista(spn, url){
	document.getElementById('filtroAbc').value = spn;
	document.getElementById('form').action = url;

	var valueTipo = document.getElementById('tipo').value;
	var act;

	if(valueTipo == 'Produto'){
		document.form.grupoProduto[0].selected = true;
		document.form.segmento[0].selected = true;
		document.form.marcaComercial[0].selected = true;
		act = 'lstProdutos.asp';
	}else if(valueTipo == 'Contato'){
		act = 'lstProdutos.asp';
	}else if(valueTipo == 'MarcaComercial'){

	}

	document.getElementById('pagAtual').value = '0';
	document.getElementById('numPag').value = '0';
	document.form.action = url;
	document.form.submit();
}

//paginacao(img)
function paginacao(img, url){
	if(img.src.indexOf('Dsb.jpg') == -1){
		document.getElementById('form').action = url;

		if(img.id == 'arwFirst'){
			document.getElementById('pagAtual').value = 0;
		}else if(img.id == 'arwPrev'){
			document.getElementById('pagAtual').value--;
		}else if(img.id == 'arwNext'){
			document.getElementById('pagAtual').value++;
		}else if(img.id == 'arwLast'){
			document.getElementById('pagAtual').value = document.getElementById('numPag').value - 1;
		}
		document.form.action = url;
		document.form.submit();
	}
}

//irParaPg(url)
function irParaPg(url){
	var pag = document.getElementById('pag').value;
	var pagAtual = document.getElementById('pagAtual').value;
	var numPag = document.getElementById('numPag').value;

	if (!isNaN(pag) || pag.length > 0){
		if(parseInt(pag) <= parseInt(numPag) && parseInt(pag) > 0){
			document.getElementById('pagAtual').value = pag-1;
			document.form.action = url;
			document.form.submit();
		}
	}
}

function produtoSelecionado(idProduto){
	document.getElementById('idProduto').value = idProduto;
	document.form.action = "dadosProduto.asp";
	document.form.submit();
}

function comboSelecionado(combo, vazioNulo, valor){
	if (vazioNulo == 'no' ){
		document.getElementById('pagAtual').value = 0;
		document.getElementById('numPag').value = 0;
		document.form.action = "lstProdutos.asp";
		document.form.submit();
	}else{
		if (valor != 'NULL'){
			document.getElementById('pagAtual').value = 0;
			document.getElementById('numPag').value = 0;
			document.form.action = "lstProdutos.asp";
			document.form.submit();
		}
	}
}

function comboInfoTecnico(combo, vazioNulo, valo){
	var pagina = document.getElementById('pagina').value;
	if (vazioNulo == 'no' ){
		document.getElementById('pagAtual').value = 0;
		document.getElementById('numPag').value = 0;
		document.form.action = "info_Interno.asp?pagina="+pagina;
		document.form.submit();
	}else{
		if (valor != 'NULL'){
			document.getElementById('pagAtual').value = 0;
			document.getElementById('numPag').value = 0;
			document.form.action = "info_Interno.asp?pagina="+pagina;
			document.form.submit();
		}
	}
}

function comboPalestras(combo, vazioNulo, valo){
	var pagina = document.getElementById('pagina').value;
	if (vazioNulo == 'no' ){
		document.getElementById('pagAtual').value = 0;
		document.getElementById('numPag').value = 0;
		document.form.action = "palestras.asp?pagina="+pagina;
		document.form.submit();
	}else{
		if (valor != 'NULL'){
			document.getElementById('pagAtual').value = 0;
			document.getElementById('numPag').value = 0;
			document.form.action = "palestras.asp?pagina="+pagina;
			document.form.submit();
		}
	}
}

function comboPalestras(combo, vazioNulo, valo){
	var pagina = document.getElementById('pagina').value;
	if (vazioNulo == 'no' ){
		document.getElementById('pagAtual').value = 0;
		document.getElementById('numPag').value = 0;
		document.form.action = "palestras.asp?pagina="+pagina;
		document.form.submit();
	}else{
		if (valor != 'NULL'){
			document.getElementById('pagAtual').value = 0;
			document.getElementById('numPag').value = 0;
			document.form.action = "palestras.asp?pagina="+pagina;
			document.form.submit();
		}
	}
}

function comboInformativos(combo, vazioNulo, valo){
	var pagina = document.getElementById('pagina').value;
	if (vazioNulo == 'no' ){
		document.getElementById('pagAtual').value = 0;
		document.getElementById('numPag').value = 0;
		document.form.action = "informativos.asp?pagina="+pagina;
		document.form.submit();
	}else{
		if (valor != 'NULL'){
			document.getElementById('pagAtual').value = 0;
			document.getElementById('numPag').value = 0;
			document.form.action = "informativos.asp?pagina="+pagina;
			document.form.submit();
		}
	}
}

function comboLaudos(combo, vazioNulo, valo){
	var pagina = document.getElementById('pagina').value;
	if (vazioNulo == 'no' ){
		document.getElementById('pagAtual').value = 0;
		document.getElementById('numPag').value = 0;
		document.form.action = "laudos.asp?pagina="+pagina;
		document.form.submit();
	}else{
		if (valor != 'NULL'){
			document.getElementById('pagAtual').value = 0;
			document.getElementById('numPag').value = 0;
			document.form.action = "laudos.asp?pagina="+pagina;
			document.form.submit();
		}
	}
}


function comboSelecionadoAnexo(combo, vazioNulo, valor, tipo){
	document.getElementById('tipoSelecionado').value = tipo;
	/*if(tipo == 'grupoProduto'){
		document.getElementById('linha')[0].selected = true;
		document.getElementById('linha').value = "";
	}else{
		document.getElementById('grupoProduto')[0].selected = true;
		document.getElementById('grupoProduto').value = "";
	}*/
	if (vazioNulo == 'no' ){
		document.getElementById('pagAtual').value = 0;
		document.getElementById('numPag').value = 0;
		document.form.action = "especificacao_cliente.asp";
		document.form.submit();
	}else{
		if (valor != 'NULL'){
			document.getElementById('pagAtual').value = 0;
			document.getElementById('numPag').value = 0;
			document.form.action = "especificacao_cliente.asp";
			document.form.submit();
		}
	}
}
//document.getElementById(sdasd)[0].selected = true;
//buscaTimeNacional()
function buscaTimeNacional(){
	document.getElementById('pagAtual').value = 0;
	document.getElementById('numPag').value = 0;
	document.form.submit();
}

function mostrarProduto(idProduto){
	document.getElementById('idProduto').value = idProduto;
	document.form.action = "produtos_selecionado.asp?cdprod="+idProduto;
	document.form.submit();
}

function voltarLst(){
	document.getElementById('form').action = 'lstProdutos.asp';
	document.getElementById('form').submit();
}
function pgProdutos(){
	document.getElementById('form').action = 'produtos.asp';
	document.getElementById('form').submit();
}
function pgPEventos(){
	document.getElementById('form').action = 'pEventos.asp';
	document.getElementById('form').submit();
}
function pgNoticias(){
	document.getElementById('form').action = 'pNoticias.asp';
	document.getElementById('form').submit();
}
function pgContato(){
	document.getElementById('form').action = 'pContato.asp';
	document.getElementById('form').submit();
}

function infFase(id, texto){
	html_div = document.getElementById(id);
	html_div.innerHTML = texto;
}

/* Noticia */
//linkNoticia(idNoticia)
function linkNoticia(idNoticia){
	document.getElementById('idNoticia').value = idNoticia;
	document.form.action = 'noticia.asp';
	document.form.submit();
}

//linkDiversas(idSetor)
function linkSaibaMais(idNoticia, act){
	document.getElementById('idNoticia').value = idNoticia;
	document.form.action = act;
	document.form.submit();
}

//linkDiversas(idSetor)
function linkDiversas(idSetor){
	document.getElementById('idSetor').value = idSetor;
	document.form.action = 'diversas.asp';
	document.form.submit();
}

//navegacao(nPaginas, img)
function mudaPagina(nPaginas, img){

	if(nPaginas > 1){
		if(img.src.indexOf('btnProximo.jpg') > -1){
			document.getElementById('pagina').value++;
			document.form.submit();
		}else if(img.src.indexOf('btnAnterior.jpg') > -1){
			document.getElementById('pagina').value--;
			document.form.submit();
		}
	}
}
/* Noticia */