function sel_aba (aba, destino) {
	document.all.aba_destaque.className = 'aba_nao_selec';
	document.all.aba_ofertas.className = 'aba_nao_selec';

	document.all[aba].className = 'aba_selec';

	document.all.frm_ajax.src = destino;
}

// ########################################################################### //
function valida_mail_g (mail) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail.value)){
	} else {
		if (mail.value == '') {

		} else {
			alert('O formato do endereço de e-mail está incorreto.');
			mail.focus()
		}
	}
}

// ########################################################################### //

function popup (url, w, h) {
	apopup = window.open(url,'','width=' + w + ',height=' + h + ',resizable=no,scrollbars=no');
}
// ########################################################################### //
// Com Scroolbar
function popup2 (url, w, h) {
	apopup = window.open(url,'','width=' + w + ',height=' + h + ',resizable=no,scrollbars=yes');
}

// ########################################################################### //

function chkDados (formulario) {
	
	if (formulario.Departamento.value == '0') {
		alert('Selecione o departamento desejado.');
		formulario.ds_nome.focus();
		return false;
	}
	if (formulario.ds_nome.value == '') {
		alert('Campo " Nome ", preenchimento obrigatório.');
		formulario.ds_nome.focus();
		return false;
	}
	if (formulario.ds_email.value == '') {
		alert('Campo " Email ", preenchimento obrigatório.');
		formulario.ds_email.focus();
		return false;
	}
	if (formulario.ds_telefone.value == '') {
		alert('Campo " Telefone ", preenchimento obrigatório.');
		formulario.ds_telefone.focus();
		return false;
	}

	if (formulario.ds_mensagem.value == '') {
		alert('Campo " Mensagem ", preenchimento obrigatório.');
		formulario.ds_mensagem.focus();
		return false;
	}

	return true;

}

// ########################################################################### //

function goAjax(url, metodo, modo, tagRetorno, parametros) {
      xmlhttp = null;
	  try {xmlhttp = new XMLHttpRequest();
	  }catch(ee) {
      try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
      } catch (e1) {
            try {
                  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e2) {
                  xmlhttp = null;
            }
      }
	  }

      document.getElementById(tagRetorno).innerHTML='<table style="width: 99%; height: 100%;"><tr><td width="99%" align="center"><div style="border: 3px solid #003300; width: 100px;height: 100px; padding-top: 25px; background: #ffffff;"><img src="img_site/ampulheta.gif" height="65px" width="60px"><div style="margin-top: 10px;">Carregando</div></div></td></tr></table>'
      //document.getElementById(tagRetorno).innerHTML='Carregando...';

	if(metodo == "GET") {
	    xmlhttp.open("GET", url + '&rel' + Math.random(), modo);
	} else {        
        xmlhttp.open("POST", url + '&rel' + Math.random(), modo);
		xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=iso-8859-1");
	    xmlhttp.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
		xmlhttp.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
        xmlhttp.setRequestHeader("Pragma", "no-cache");
      }    

      xmlhttp.onreadystatechange = function() {

            if(xmlhttp.readyState == 4) {

                  retorno=xmlhttp.responseText;

            document.getElementById(tagRetorno).innerHTML=retorno;

            }

      }

        if(metodo == "GET") {

                  xmlhttp.send(null);

        } else {        

                  xmlhttp.send(parametros);

        }

      }

// ########################################################################### //
function text(id) {
if (document.all[id].style.display == 'block'){
		document.all[id].style.display = 'none';
	} else {
		for (var a = 1; a <= 3 ; a++){
		document.all['d' + a].style.display = 'none';
	}

	document.all[id].style.display = 'block';
}
}