//###################################################################################
// pop ups
//###################################################################################
function PopUp(url, nome, largura, altura, sroll)
{
	var esq = (screen.width - largura) / 2;
	var top = (screen.height - altura) / 2;
	window.open(''+ url +'',''+ nome +'','width=' + largura + ',height=' + altura + ',top=' + top + ',left=' + esq + ',scrollbars='+ sroll +'');
}

//###################################################################################
function mostraiframe(linha) {
var linha = document.getElementById(linha);
  if (linha.style.display=='none') {
   linha.style.display='';
  } else {
   linha.style.display='none';
  }
}

//###################################################################################
function limpa_string(S){
    // Deixa so' os digitos no numero
    var Digitos = "0123456789";
    var temp = "";
    var digito = "";
    for (var i=0; i<S.length; i++){
      digito = S.charAt(i);
      if (Digitos.indexOf(digito)>=0){temp=temp+digito}
    }
    return temp
}

//###################################################################################
function valida_CPF(s)
{
	var i;
	s = limpa_string(s);
	var c = s.substr(0,9);
	var dv = s.substr(9,2);
	var d1 = 0;
	for (i = 0; i < 9; i++)
	{
		d1 += c.charAt(i)*(10-i);
	}
        if (d1 == 0) return false;
	d1 = 11 - (d1 % 11);
	if (d1 > 9) d1 = 0;
	if (dv.charAt(0) != d1)
	{
		return false;
	}

	d1 *= 2;
	for (i = 0; i < 9; i++)
	{
		d1 += c.charAt(i)*(11-i);
	}
	d1 = 11 - (d1 % 11);
	if (d1 > 9) d1 = 0;
	if (dv.charAt(1) != d1)
	{
		return false;
	}
        return true;
}

//###################################################################################
function valida_CNPJ(s)
{
	var i;
	s = limpa_string(s);
	var c = s.substr(0,12);
	var dv = s.substr(12,2);
	var d1 = 0;
	for (i = 0; i < 12; i++)
	{
		d1 += c.charAt(11-i)*(2+(i % 8));
	}
        if (d1 == 0) return false;
        d1 = 11 - (d1 % 11);
	if (d1 > 9) d1 = 0;
	if (dv.charAt(0) != d1)
	{
		return false;
	}

	d1 *= 2;
	for (i = 0; i < 12; i++)
	{
		d1 += c.charAt(11-i)*(2+((i+1) % 8));
	}
	d1 = 11 - (d1 % 11);
	if (d1 > 9) d1 = 0;
	if (dv.charAt(1) != d1)
	{
		return false;
	}
        return true;
}

//###################################################################################
function valida_numeros(s)
{
	var i; 
	var dif = 0;
	for (i = 0; i < s.length; i++)
	{
		var c = s.charAt(i);
		if (!((c >= "0") && (c <= "9")))
		{
			dif = 1;
		}
	}
	if (dif == 1)
	{
		return false;
	}
	return true;
}
//###################################################################################
// pessoa física / jurídica
//###################################################################################

//###################################################################################
// mascarar entradas
//###################################################################################
function mascaraEntrada(objeto, sMask, evtKeyPress) // onkeypress="javascript:return mascaraEntrada(this,'99999-999',event);"
{
	var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;

	if (document.all)         { nTecla = evtKeyPress.keyCode; }
	else if (document.layers) { nTecla = evtKeyPress.which; }
	else                      { nTecla = evtKeyPress.which; if (nTecla == 8) { return true; } }

	sValue = objeto.value;

	sValue = sValue.toString().replace( "-", "" );
	sValue = sValue.toString().replace( "-", "" );
	sValue = sValue.toString().replace( ".", "" );
	sValue = sValue.toString().replace( ".", "" );
	sValue = sValue.toString().replace( "/", "" );
	sValue = sValue.toString().replace( "/", "" );
	sValue = sValue.toString().replace( ":", "" );
	sValue = sValue.toString().replace( ":", "" );
	sValue = sValue.toString().replace( "(", "" );
	sValue = sValue.toString().replace( "(", "" );
	sValue = sValue.toString().replace( ")", "" );
	sValue = sValue.toString().replace( ")", "" );
	sValue = sValue.toString().replace( " ", "" );
	sValue = sValue.toString().replace( " ", "" );
	fldLen = sValue.length;
	mskLen = sMask.length;

	i = 0;
	nCount = 0;
	sCod = "";
	mskLen = fldLen;

	while (i <= mskLen)
	{
		bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/") || (sMask.charAt(i) == ":"))
		bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))
		if (bolMask)
		{
			sCod += sMask.charAt(i);
			mskLen++;
		}
		else
		{
			sCod += sValue.charAt(nCount);
			nCount++;
		}
		i++;
	}

	objeto.value = sCod;

	if (nTecla != 8)
	{
		if (sMask.charAt(i-1) == "9")
		{
			return ((nTecla > 47) && (nTecla < 58));
		}
		else { return true; }
	}
	else { return true; }
}

function isNumber(caracter) // onkeypress="javascript:return isNumber(event);"
{
	var tecla = (window.Event) ? caracter.which : caracter.keyCode;
	if (tecla > 47 && tecla < 58)
	{
		return true;
	}
	else
	{
		if (tecla != 8 && tecla != 13 && tecla != 0)
		{
			return false;
		}
		else
		{
			return true;
		}
	}
}

//***********************************************************************************************
// validar email
//***********************************************************************************************
 function validaEmail(email)
{
  var emailInvalido = false
  var stringTemp = new String(email)
  var index = stringTemp.indexOf("@");
  if (index > 0)
  {
    var pindex = stringTemp.indexOf(".",index);
    if ((pindex > index+1) && (stringTemp.length > pindex+1))
	emailInvalido = true;
  }
  return emailInvalido;
}


//###################################################################################
// valida formulário de Contato youroffice
//###################################################################################
function validarContato(f)
{
	
	if (f.nome.value == '')
	{
		window.alert('Por favor, digite seu nome completo');
		f.nome.className = "textreq";
		f.nome.focus();
		return false;
	}
	/*if (f.endereco.value == '')
	{
		window.alert('Por favor, digite seu Endere\xE7o.');
		f.endereco.className = "textreq";
		f.endereco.focus();
		return false;
	}
	if (f.cidade.value == '')
	{
		window.alert('Por favor, digite o nome da cidade');
		f.cidade.className = "textreq";
		f.cidade.focus();
		return false;
	}
	if (f.estado.value == '')
	{
		window.alert('Por favor, selecione seu Estado');
		f.estado.className = "textreq";
		f.estado.focus();
		return false;
	}
	if (f.cep.value.length < 9)
	{
		window.alert('Por favor, digite seu CEP corretamente.');
		f.cep.className = "textreq";
		f.cep.focus();
		return false;
	}
	if (f.pais.value == '')
	{
		window.alert('Por favor, digite o Pa\xEDs');
		f.pais.className = "textreq";
		f.pais.focus();
		return false;
	}*/
	if (f.email.value.length==0){
        window.alert('Favor preencher Email.');
		f.email.className = "textreq";
        f.email.focus();
		return false;
	}
    if (!validaEmail(f.email.value)){
       window.alert('Favor preencher Email corretamente');
	   f.email.className = "textreq";
       f.email.focus();
		return false;
	}
	if (f.telefone.value == '')
	{
		window.alert('Por favor, digite seu Telefone.');
		f.telefone.className = "textreq";
		f.telefone.focus();
		return false;
	}
	/*if (f.sexo.value == '')
	{
		window.alert('Por favor, selecione seu sexo');
		f.sexo.className = "textreq";
		f.sexo.focus();
		return false;
	}
	if (f.empresa.value == '')
	{
		window.alert('Por favor, informe o nome da empresa');
		f.empresa.className = "textreq";
		f.empresa.focus();
		return false;
	}
	if (f.assunto.value == '')
	{
		window.alert('Por favor, selecione o assunto do email');
		f.assunto.className = "textreq";
		f.assunto.focus();
		return false;
	}
	if ((f.escritorio.checked == false) && (f.reuniao.checked == false) && (f.auditorio.checked == false) && (f.salafixa.checked == false) && (f.mensagem.value == ''))
	{
		window.alert('Por favor, selecione sua necessidade de loca\xE7\xE3o ou informe sobre outros interesses');
		return false;
	}
	if ((f.escritorio.checked == true) && (f.localidade.value == ''))
	{
		window.alert('Por favor, selecione a unidade desejada');
		f.localidade.className = "textreq";
		f.localidade.focus();
		return false;
	}
	if ((f.reuniao.checked == true) && (f.pessoassreuniao.value == ''))
	{
		window.alert('Por favor, informe a quantidade de pessoas');
		f.pessoassreuniao.className = "textreq";
		f.pessoassreuniao.focus();
		return false;
	}
	if ((f.reuniao.checked == true) && (f.data_sala_reuniao.value == ''))
	{
		window.alert('Por favor, a data de uso da sala');
		f.data_sala_reuniao.className = "textreq";
		f.data_sala_reuniao.focus();
		return false;
	}
	if ((f.reuniao.checked == true) && (f.horassreuinicio.value == ''))
	{
		window.alert('Por favor, informe o hor\xE1rio de in\xEDcio da utiliza\xE7\xE3o');
		f.horassreuinicio.className = "textreq";
		f.horassreuinicio.focus();
		return false;
	}
	if ((f.reuniao.checked == true) && (f.horassreufim.value == ''))
	{
		window.alert('Por favor, informe o hor\xE1rio final da utiliza\xE7\xE3o');
		f.horassreufim.className = "textreq";
		f.horassreufim.focus();
		return false;
	}*/
	/***************************************************************************/
	/*if ((f.auditorio.checked == true) && (f.pessoassauditorio.value == ''))
	{
		window.alert('Por favor, informe a quantidade de pessoas');
		f.pessoassauditorio.className = "textreq";
		f.pessoassauditorio.focus();
		return false;
	}
	if ((f.auditorio.checked == true) && (f.data_auditorio.value == ''))
	{
		window.alert('Por favor, a data de uso da sala');
		f.data_auditorio.className = "textreq";
		f.data_auditorio.focus();
		return false;
	}
	if ((f.auditorio.checked == true) && (f.horasauditorioinicio.value == ''))
	{
		window.alert('Por favor, informe o hor\xE1rio de in\xEDcio da utiliza\xE7\xE3o');
		f.horasauditorioinicio.className = "textreq";
		f.horasauditorioinicio.focus();
		return false;
	}
	if ((f.auditorio.checked == true) && (f.horasauditoriofim.value == ''))
	{
		window.alert('Por favor, informe o hor\xE1rio final da utiliza\xE7\xE3o');
		f.horasauditoriofim.className = "textreq";
		f.horasauditoriofim.focus();
		return false;
	}*/
	/*********************************************************/
	/*if ((f.salafixa.checked == true) && (f.qtdhoras.value == ''))
	{
		window.alert('Por favor, informe a quantidade de horas de utiliza\xE7\xE3o');
		f.qtdhoras.className = "textreq";
		f.qtdhoras.focus();
		return false;
	}
	if ((f.salafixa.checked == true) && (f.qtdmeses.value == ''))
	{
		window.alert('Por favor, a quantidade de meses de utiliza\xE7\xE3o');
		f.qtdmeses.className = "textreq";
		f.qtdmeses.focus();
		return false;
	}*/
	if (f.mensagem.value == '')
	{
		window.alert('Por favor, informe o assunto do email');
		f.mensagem.className = "textreq";
		f.mensagem.focus();
		return false;
	}
}
//***********************************************************************************************
// mostra help
//***********************************************************************************************
function mostrahelp(linha,img) {
var linha = document.getElementById(linha);
  if (linha.style.display=='none') {
   linha.style.display='';
   if(img != null) {
      img.src='images/ball_glass_redS.gif';
   }
  } else {
   linha.style.display='none';
   if(img != null) {
      img.src='images/duvida.gif';
   }
  }
}

//###################################################################################
// mascara moeda
//###################################################################################
function mascaraMoeda(campo, sepMilesimo, sepDecimal, e) // onKeyPress="javascript:return mascaraMoeda(this,'.',',',event);"
{
	var strCheck = "0123456789";
	var tecla    = (window.Event) ? e.which : e.keyCode;

	if (tecla == 8 || tecla == 9 || tecla == 13 || tecla == 0) { return true; }

	var key = String.fromCharCode(tecla);

	if (strCheck.indexOf(key) == -1) { return false; }

	var len = campo.value.length;
	if (len >= 12) { return false; }

	for( var i = 0; i < len; i++ )
	{
		if ( (campo.value.charAt(i) != "0") && (campo.value.charAt(i) != sepDecimal) ) break;
	}

	var aux = "";
	for(; i < len; i++)
		if (strCheck.indexOf(campo.value.charAt(i)) != -1) aux += campo.value.charAt(i);
	aux += key;
	len = aux.length;
	if (len == 0) campo.value = "";
	if (len == 1) campo.value = "0"+ sepDecimal + "0" + aux;
	if (len == 2) campo.value = "0"+ sepDecimal + aux;
	if (len > 2) {
		var aux2 = "";
		for (var j = 0, i = len - 3; i >= 0; i--) {
			if (j == 3) {
				aux2 += sepMilesimo;
				j = 0;
			}
			aux2 += aux.charAt(i);
			j++;
		}
		var valor = "";
		var len2 = aux2.length;
		for (i = len2 - 1; i >= 0; i--)
		valor += aux2.charAt(i);
		valor += sepDecimal + aux.substr(len - 2, len);
		campo.value = valor;
	}
	return false;
}


//######################################################################################
//     redirecionar
//######################################################################################
function redireciona(pag) {
	window.location.href = pag;
}
//######################################################################################
//    Alertas
//######################################################################################
	function closeDiv(){
		document.getElementById("dropin").style.visibility = "hidden";
	}
//######################################################################################
//    Ver fonte
//######################################################################################	
function verfonte(e) {
	if (navigator.appName == 'Netscape' && 
	(e.which == 3 || e.which == 2)){
		window.alert("PROIBIDA A C\xD3PIA!");
		return false;
	}else if (navigator.appName == 'Microsoft Internet Explorer' && 
	(event.button == 2 || event.button == 3)) {
		window.alert("PROIBIDA A C\xD3PIA!");
		return false;
	}
}
document.onmousedown=verfonte;	
//######################################################################################
//    slidesowh
//######################################################################################
// =======================================

// set the following variables

// =======================================



// Set slideShowSpeed (milliseconds)

var slideShowSpeed = 4000



// Duration of crossfade (seconds)

var crossFadeDuration = 3



// Specify the image files

var Pic = new Array() // don't touch this

// to add more imagens, just continue

// the pattern, adding to the array below



Pic[0] = 'imagens/1.jpg'

Pic[1] = 'imagens/1b.jpg'

Pic[2] = 'imagens/1c.jpg'

Pic[3] = 'imagens/1d.jpg'





// =======================================

// do not edit anything below this line

// =======================================



var t


var j = 0

var p = Pic.length



var preLoad = new Array()

for (i = 0; i < p; i++){

   preLoad[i] = new Image()

   preLoad[i].src = Pic[i]

}



function runSlideShow(){

   if (document.all){

      document.images.SlideShow.style.filter="blendTrans(duration=2)"

      document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"

      document.images.SlideShow.filters.blendTrans.Apply()      

   }

   document.images.SlideShow.src = preLoad[j].src

   if (document.all){

      document.images.SlideShow.filters.blendTrans.Play()

   }

   j = j + 1

   if (j > (p-1)) j=0

   t = setTimeout('runSlideShow()', slideShowSpeed)

}
//######################################################################################
//    buscar palavras
//######################################################################################
function BuscarPalavra()
{
	var txt = document.BuscaProduto.Busca.value;
	if(txt == "" || txt.length < 3)
	{
		alert("VocÃª deve digitar no mÃ­nimo 3 caracteres.");
		return;
	}
	else
	{
			document.BuscaProduto.action="busca.asp?PalavraChave="+document.BuscaProduto.Busca.value;
			document.BuscaProduto.submit();
		}
}
//######################################################################################
//   tipos escritórios
//######################################################################################
function tipoVirtual(){
	if (document.formcontato.escritorio.checked)
	{
		document.getElementById("localidade").style.display  = "";
		document.formcontato.salafixa.disabled = true;
		document.formcontato.reuniao.disabled = true;
		document.formcontato.auditorio.disabled = true;
		}
		else 
	{	
		document.getElementById("localidade").style.display  = "none";
		document.formcontato.salafixa.disabled = false;
		document.formcontato.reuniao.disabled = false;
		document.formcontato.auditorio.disabled = false;
		}
}
function tipoFixa(){
	if (document.formcontato.salafixa.checked)
	{
		document.getElementById("sfixa").style.display  = "";
		document.formcontato.escritorio.disabled = true;
		document.formcontato.reuniao.disabled = true;
		document.formcontato.auditorio.disabled = true;
		}
		else 
	{	
		document.getElementById("sfixa").style.display  = "none";
		document.formcontato.escritorio.disabled = false;
		document.formcontato.reuniao.disabled = false;
		document.formcontato.auditorio.disabled = false;
		}
}
function tipoReuniao(){
	if (document.formcontato.reuniao.checked)
	{
		document.getElementById("sreuniao").style.display  = "";
		document.formcontato.salafixa.disabled = true;
		document.formcontato.escritorio.disabled = true;
		document.formcontato.auditorio.disabled = true;
		}
		else 
	{	
		document.getElementById("sreuniao").style.display  = "none";
		document.formcontato.salafixa.disabled = false;
		document.formcontato.escritorio.disabled = false;
		document.formcontato.auditorio.disabled = false;
		}
}
function tipoAuditorio(){
	if (document.formcontato.auditorio.checked)
	{
		document.getElementById("sauditorio").style.display  = "";
		document.formcontato.salafixa.disabled = true;
		document.formcontato.reuniao.disabled = true;
		document.formcontato.escritorio.disabled = true;
		}
		else 
	{	
		document.getElementById("sauditorio").style.display  = "none";
		document.formcontato.salafixa.disabled = false;
		document.formcontato.reuniao.disabled = false;
		document.formcontato.escritorio.disabled = false;
		}
}	
//######################################################################################
//    validar indique
//######################################################################################
function validarIndique(f)
{
	if (f.nome.value == '')
	{
		window.alert('Por favor, digite seu nome.');
		f.nome.className = "textreq";
        f.nome.focus();
		return false;
	}

	if (f.email.value.length==0){
        window.alert('Favor preencher Email.');
		f.email.className = "textreq";
        f.email.focus();
		return false;
	}
    if (!validaEmail(f.email.value)){
       window.alert('Favor preencher Email corretamente');
	   f.email.className = "textreq";
       f.email.focus();
		return false;
	}
	if (f.nome_amigo.value == '')
	{
		window.alert('Por favor, digite o nome de seu amigo(a).');
		f.nome_amigo.className = "textreq";
        f.nome_amigo.focus();
		return false;
	}

	if (f.email_amigo.value.length==0){
        window.alert('Favor preencher Email.');
		f.email_amigo.className = "textreq";
        f.email_amigo.focus();
		return false;
	}
    if (!validaEmail(f.email_amigo.value)){
       window.alert('Favor preencher Email corretamente');
	   f.email_amigo.className = "textreq";
       f.email_amigo.focus();
		return false;
	}
	
	if (f.comentario.value == '')
	{
	 window.alert('Favor preencher digite seu coment\xE1rio');
	   f.comentario.className = "textreq";
       f.comentario.focus();
		return false;
	}
}
//######################################################################################
//    validar arquivo de curriculo
//######################################################################################
function validarArquivo(arq)
{
	arq = arq.toLowerCase();
	var arrExt = new Array();
	arrExt     = arq.split(".");
	var ext    = arrExt[ arrExt.length - 1 ]
	if ((ext != 'doc') && (ext != 'pdf'))
	{
		return false;
	}
	else
	{
		return true;
	}
}
//######################################################################################
//    validar trabalhe conosco
//######################################################################################
function validarTrabalhe(f)
{
	if (f.areaInteresse.value == '')
	{
		window.alert('Por favor, selecione a \xE1rea de interesse.');
		f.areaInteresse.className = "textreq";
        f.areaInteresse.focus();
		return false;
	}
	if ((f.areaInteresse.value == 'Outros') && (f.areaInteresseOutros.value == ''))
	{
		window.alert('Por favor, informe qual outra \xE1rea seria de seu interesse.');
		f.areaInteresseOutros.className = "textreq";
        f.areaInteresseOutros.focus();
		return false;
	}
	if (f.posicao.value == '')
	{
		window.alert('Por favor, selecione posi\xE7\xE3o de interesse.');
		f.posicao.className = "textreq";
        f.posicao.focus();
		return false;
	}
	if ((f.posicao.value == 'Outros') && (f.posicaoOutros.value == ''))
	{
		window.alert('Por favor, informe qual outra posi\xE7\xE3o seria de seu interesse.');
		f.posicaoOutros.className = "textreq";
        f.posicaoOutros.focus();
		return false;
	}
	if (f.nome.value == '')
	{
		window.alert('Por favor, digite seu nome completo');
		f.nome.className = "textreq";
		f.nome.focus();
		return false;
	}
	if (f.endereco.value == '')
	{
		window.alert('Por favor, digite seu Endere\xE7o.');
		f.endereco.className = "textreq";
		f.endereco.focus();
		return false;
	}
	if (f.cidade.value == '')
	{
		window.alert('Por favor, digite o nome da cidade');
		f.cidade.className = "textreq";
		f.cidade.focus();
		return false;
	}
	if (f.estado.value == '')
	{
		window.alert('Por favor, selecione seu Estado');
		f.estado.className = "textreq";
		f.estado.focus();
		return false;
	}
	if (f.cep.value.length < 9)
	{
		window.alert('Por favor, digite seu CEP corretamente.');
		f.cep.className = "textreq";
		f.cep.focus();
		return false;
	}
	
	if (f.email.value.length==0){
        window.alert('Favor preencher Email.');
		f.email.className = "textreq";
        f.email.focus();
		return false;
	}
    if (!validaEmail(f.email.value)){
       window.alert('Favor preencher Email corretamente');
	   f.email.className = "textreq";
       f.email.focus();
		return false;
	}
	if (f.telefone.value == '')
	{
		window.alert('Por favor, digite seu Telefone.');
		f.telefone.className = "textreq";
		f.telefone.focus();
		return false;
	}
	if (f.sexo.value == '')
	{
		window.alert('Por favor, selecione seu sexo');
		f.sexo.className = "textreq";
		f.sexo.focus();
		return false;
	}
	if (f.txtDataNasc.value == '')
	{
		window.alert('Por favor, informe a data de seu nascimento');
		f.txtDataNasc.className = "textreq";
		f.txtDataNasc.focus();
		return false;
	}
	if (f.ingles.value == '')
	{
		window.alert('Por favor, selecione seu n\xEDvel de conhecimento de Ingl\xEAs');
		f.ingles.className = "textreq";
		f.ingles.focus();
		return false;
	}
	if (f.espanhol.value == '')
	{
		window.alert('Por favor, selecione seu n\xEDvel de conhecimento de Espanhol');
		f.espanhol.className = "textreq";
		f.espanhol.focus();
		return false;
	}
	if ((f.outro.value !== '') && (f.outroNivel.value == ''))
	{
		window.alert('Por favor, selecione seu n\xEDvel de conhecimento do outro idioma indicado');
		f.outroNivel.className = "textreq";
		f.outroNivel.focus();
		return false;
	}
	if (f.upcurriculo.value == '')
	{
		window.alert("Por favor, selecione o arquivo de curriculo a ser enviado.");
		f.upcurriculo.className = "textreq";
		f.upcurriculo.focus();
		return false;
	}
	if (validarArquivo(f.upcurriculo.value) == false)
	{
		window.alert("Por favor, selecione o arquivo de curriculo corretamente.\n\nArquivos válidos: DOC, PDF.");
		f.upcurriculo.className = "textreq";
		f.upcurriculo.focus();
		return false;
	}
}
//######################################################################################
//    validar cadastro newsletter
//######################################################################################
function validarCadastroNews(f)
{
	if (f.nomenews.value == '')
	{
		window.alert('Por favor, digite seu nome.');
		f.nomenews.className = "textreq";
        f.nomenews.focus();
		return false;
	}
	if (f.emailnews.value.length==0){
        window.alert('Favor preencher Email.');
		f.emailnews.className = "textreq";
        f.emailnews.focus();
		return false;
	}
    if (!validaEmail(f.emailnews.value)){
       window.alert('Favor preencher Email corretamente');
	   f.emailnews.className = "textreq";
       f.emailnews.focus();
		return false;
	}
}
//###################################################################################
// consiste dados do login da listagem
//###################################################################################
function check_login() {
   var fr = document.autent;

   if (fr.user_id.value.length == 0) {
      alert("O e-mail \xE9 um campo obrigat\xF3rio !");
      fr.user_id.focus();
      return false;
   }

   if (fr.user_id.value.indexOf('@', 0) == -1 || fr.user_id.value.indexOf('.', 0) == -1) {
      alert("Por favor, preencha corretamente o campo e-mail."); 
      fr.user_id.focus();
      return false;
   }

   if (fr.esquecisenha.checked == false) {
      if (fr.senha.value.length == 0) {
         alert("A senha \xE9 um campo obrigat\xF3rio !");
         fr.senha.focus();
         return false;
      }
   }
   return true;
}
//###################################################################################
// consiste dados do novo usuário da listagem
//###################################################################################
function check_newlogin() {
   var fr = document.new_user;

   if (fr.user_id.value.length == 0) {
      alert("O e-mail \xE9 um campo obrigat\xF3rio !");
      fr.user_id.focus();
      return false;
   }

   if (fr.user_id.value.indexOf('@', 0) == -1 || fr.user_id.value.indexOf('.', 0) == -1) {
      alert("Por favor, preencha corretamente o campo e-mail."); 
      fr.user_id.focus();
      return false;
   }
   return true;
}
//###################################################################################
// auto tab
//###################################################################################
var isNN = (navigator.appName.indexOf("Netscape")!=-1);

function autoTab(input,len, e) {
    var keyCode = (isNN) ? e.which : e.keyCode; 
    var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
    if(input.value.length >= len && !containsElement(filter,keyCode)) {
        input.value = input.value.slice(0, len);
        input.form[(getIndex(input)+1) % input.form.length].focus();
}

function containsElement(arr, ele) {
    var found = false, index = 0;
    while(!found && index < arr.length)
        if(arr[index] == ele)
            found = true;
        else
            index++;
        return found;
    }

function getIndex(input) {
    var index = -1, i = 0, found = false;
    while (i < input.form.length && index == -1)
        if (input.form[i] == input)index = i;
        else i++;
        return index;
    }
return true;
}