function logado_aa(){
alert("não é permitido o login ao site, estando logado a área administrativa\ndesconecte-se da área administrativa e em seguida tente novamente.");
}
function detalhe (URL){
   window.open(URL,"janela1","width=500,height=300,scrollbars=YES")
}
function window_cadastro (URL){
   window.open(URL,"janela1","width=200,height=200,scrollbars=YES")
}
function concluireserva()
{
var data = document.reg.data.value
if (data==""){
	alert("Entre com a data de início da veiculação");
	document.reg.data.focus()
	return false
	}
var periodo = document.reg.periodo.value
if (periodo==""){
	alert("Entre com período da veiculação");
	document.reg.periodo.focus()
	return false
	}	
}
function buscasite()
{
var busca = document.reg.busca.value
if (busca==""){
	alert("Entre com sua ocorrência!");
	document.reg.busca.focus()
	return false
	}
}
function logado()
{
alert("Você encontra-se logado e cadastrado no site");
}
function resetimage(src)
{
this.src=src;
this.confirm=true;
this.alt="Reset";
this.write=resetimage_write;
}

function resetimage_write()
{
document.write('<A ');
if (this.rollover)
    {
    if (! this.name)
        {
        alert('to create a rollover you must give the image a name');
        return;
        }

    resetRolls[this.name] = new Object();
    resetRolls[this.name].over = new Image();
    resetRolls[this.name].over.src=this.rollover;
    resetRolls[this.name].out = new Image();
    resetRolls[this.name].out.src=this.src;
    document.write(
        ' onMouseOver="if (document.images)document.images[\'' + 
        this.name + '\'].src=resetRolls[\'' + this.name + '\'].over.src"' + 
        ' onMouseOut="if (document.images)document.images[\'' + 
        this.name + '\'].src=resetRolls[\'' + this.name + '\'].out.src"'
        );
    }
document.write(' HREF="javascript:');
if (this.confirm)
    document.write('if(confirm(\'tem certeza de que deseja apagar o formulário?\'))');
document.write(
    'document.forms[' + 
    (document.forms.length - 1) + '].reset();void(0);">');
document.write('<IMG SRC="' + this.src + '" ALT="' + this.alt + '"');
document.write(' BORDER=0');
if (this.name)document.write(' NAME="' + this.name + '"');
if (this.height)document.write(' HEIGHT=' + this.height);
if (this.width)document.write(' WIDTH=' + this.width);
if (this.otheratts)document.write(' '+ this.otheratts);
document.write('></A>');
}
function reverterimage(src)
{
this.src=src;
this.confirm=true;
this.alt="Reset";
this.write=reverterimage_write;
}
function reverterimage_write()
{
document.write('<A ');
if (this.rollover)
    {
    if (! this.name)
        {
        alert('to create a rollover you must give the image a name');
        return;
        }

    resetRolls[this.name] = new Object();
    resetRolls[this.name].over = new Image();
    resetRolls[this.name].over.src=this.rollover;
    resetRolls[this.name].out = new Image();
    resetRolls[this.name].out.src=this.src;
    document.write(
        ' onMouseOver="if (document.images)document.images[\'' + 
        this.name + '\'].src=resetRolls[\'' + this.name + '\'].over.src"' + 
        ' onMouseOut="if (document.images)document.images[\'' + 
        this.name + '\'].src=resetRolls[\'' + this.name + '\'].out.src"'
        );
    }
document.write(' HREF="javascript:');
if (this.confirm)
    document.write('if(confirm(\'deseja reverter as informações anteriores?\'))');
document.write(
    'document.forms[' + 
    (document.forms.length - 1) + '].reset();void(0);">');
document.write('<IMG SRC="' + this.src + '" ALT="' + this.alt + '"');
document.write(' BORDER=0');
if (this.name)document.write(' NAME="' + this.name + '"');
if (this.height)document.write(' HEIGHT=' + this.height);
if (this.width)document.write(' WIDTH=' + this.width);
if (this.otheratts)document.write(' '+ this.otheratts);
document.write('></A>');
}
function buscalogradouro()
{
var item = document.reg.item.value
if (item==""){
	alert("Digite uma ocorrência!");
	document.reg.item.focus()
	return false
	}
}
function formmail()
{
var destino = document.reg.destino.value
if (destino==""){
	alert("Selecione o Destino!");
	document.reg.destino.focus()
	return false
	}
var nome = document.reg.nome.value
if (nome==""){
	alert("Digite seu nome!");
	document.reg.nome.focus()
	return false
	}
var email = document.reg.email.value;
if (email==""){
	alert("Entre com seu email!")
	document.reg.email.focus()
	return false
	}
if (document.reg.email.value.indexOf('@', 0) == -1 || document.reg.email.value.indexOf('.', 0) == -1){ alert("E-mail invalido!");
	document.reg.email.focus()
	return false
	}	
var mensagem = document.reg.mensagem.value
if (mensagem==""){
	alert("Entre com sua mensagem!");
	document.reg.mensagem.focus()
	return false
	}
}
function cadastro()
{
var first_name = document.reg.first_name.value
if (first_name==""){
	alert("Digite seu nome!");
	document.reg.first_name.focus()
	return false
	}
var last_name = document.reg.last_name.value
if (last_name==""){
	alert("Digite seu sobrenome!");
	document.reg.last_name.focus()
	return false
	}
var nome_empresa = document.reg.nome_empresa.value
if (nome_empresa==""){
	alert("Digite o nome de sua empresa!");
	document.reg.nome_empresa.focus()
	return false
	}		
var endereco = document.reg.endereco.value
if (endereco==""){
	alert("Digite o endereço de sua empresa!");
	document.reg.endereco.focus()
	return false
	}
var bairro = document.reg.bairro.value
if (bairro==""){
	alert("Entre com o bairro!");
	document.reg.bairro.focus()
	return false
	}
var municipio = document.reg.municipio.value
if (municipio==""){
	alert("Entre com o municipio!");
	document.reg.municipio.focus()
	return false
	}
var estado= document.reg.estado.value
if (estado==""){
	alert("Selecione o Estado!");
	document.reg.estado.focus()
	return false
	}
var email = document.reg.email.value;
if (email==""){
	alert("Entre com seu email!")
	document.reg.email.focus()
	return false
	}
if (document.reg.email.value.indexOf('@', 0) == -1 || document.reg.email.value.indexOf('.', 0) == -1){ 	alert("E-mail invalido!");
	document.reg.email.focus()
	return false
	}
/*var CNPJ = document.reg.cnpj.value;
         erro = new String;
				if (CNPJ=='00.000.000/0000-00') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='11.111.111/1111-11') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='22.222.222/2222-22') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='33.333.333/3333-33') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='44.444.444/4444-44') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='55.555.555/5555-55') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='66.666.666/6666-66') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='77.777.777/7777-77') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='88.888.888/8888-88') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='99.999.999/9999-99') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='000.000.000/0000-00') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ.length < 18) erro += "É necessario preencher corretamente o número do CNPJ! \n\n";
                if ((CNPJ.charAt(3) != ".") || (CNPJ.charAt(7) != ".") || (CNPJ.charAt(11) != "/") || (CNPJ.charAt(16) != "-")){
                if (erro.length == 0) erro += "É necessário preencher corretamente o número do CNPJ! \n\n";
    			 }
                 //substituir os caracteres que não são números
               if(document.layers && parseInt(navigator.appVersion) == 4){
                       x = CNPJ.substring(0,3);
                        x += CNPJ. substring (4,7);
                       x += CNPJ. substring (8,11);
                      x += CNPJ. substring (12,16);
                       x += CNPJ. substring (17,18);
                       CNPJ = x;
               } else {
                       CNPJ = CNPJ. replace (".","");
                       CNPJ = CNPJ. replace (".","");
                       CNPJ = CNPJ. replace ("-","");
                       CNPJ = CNPJ. replace ("/","");
               }
               var nonNumbers = /\D/;
               if (nonNumbers.test(CNPJ)) erro += "A verificação de CNPJ suporta apenas números! \n\n";
               var a = [];
               var b = new Number;
               var c = [6,5,4,3,2,9,8,7,6,5,4,3,2];
               for (i=0; i<12; i++){
                       a[i] = CNPJ.charAt(i);
                       b += a[i] * c[i+1];
 }
               if ((x = b % 11) < 2) { a[12] = 0 } else { a[12] = 11-x }
               b = 0;
               for (y=0; y<13; y++) {
                       b += (a[y] * c[y]);
               }
               if ((x = b % 11) < 2) { a[13] = 0; } else { a[13] = 11-x; }
               if ((CNPJ.charAt(12) != a[12]) || (CNPJ.charAt(13) != a[13])){
                       erro +="Dígito verificador com problema!";
               }
			   if (erro.length > 0){
                       alert(erro);
                       return false;
               }*/
var CNPJ = document.reg.cnpj.value;
                 erro = new String;
		    	if (CNPJ=='00.000.000/0000-00') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='11.111.111/1111-11') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='22.222.222/2222-22') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='33.333.333/3333-33') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='44.444.444/4444-44') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='55.555.555/5555-55') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='66.666.666/6666-66') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='77.777.777/7777-77') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='88.888.888/8888-88') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='99.999.999/9999-99') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='000.000.000/0000-00') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ.length < 18) erro += "É necessario preencher corretamente o número do CNPJ! \n\n";
                 if (CNPJ.length < 18) erro += "É necessario preencher corretamente o número do CNPJ! "; 
                 if ((CNPJ.charAt(2) != ".") || (CNPJ.charAt(6) != ".") || (CNPJ.charAt(10) != "/") || (CNPJ.charAt(15) != "-")){
                 if (erro.length == 0) erro += "É necessário preencher corretamente o número do CNPJ! ";
                 }
                 //substituir os caracteres que não são números
               if(document.layers && parseInt(navigator.appVersion) == 4){
                      x = CNPJ.substring(0,2);
                       x += CNPJ. substring (3,6);
                       x += CNPJ. substring (7,10);
                       x += CNPJ. substring (11,15);
                       x += CNPJ. substring (16,18);
                       CNPJ = x; 
               } else {
                       CNPJ = CNPJ. replace (".","");
                       CNPJ = CNPJ. replace (".","");
                       CNPJ = CNPJ. replace ("-","");
                       CNPJ = CNPJ. replace ("/","");
               }
               var nonNumbers = /\D/;
               if (nonNumbers.test(CNPJ)) erro += "A verificação de CNPJ suporta apenas números! "; 
               var a = [];
               var b = new Number;
               var c = [6,5,4,3,2,9,8,7,6,5,4,3,2];
               for (i=0; i<12; i++){
                       a[i] = CNPJ.charAt(i);
                       b += a[i] * c[i+1];
 }
               if ((x = b % 11) < 2) { a[12] = 0 } else { a[12] = 11-x }
               b = 0;
               for (y=0; y<13; y++) {
                       b += (a[y] * c[y]); 
               }
               if ((x = b % 11) < 2) { a[13] = 0; } else { a[13] = 11-x; }
               if ((CNPJ.charAt(12) != a[12]) || (CNPJ.charAt(13) != a[13])){
                       erro +="Dígito verificador com problema!";
               }
               if (erro.length > 0){
                       alert(erro);
                  
  return false;
    }
var username = document.reg.username.value
if (username==""){
	alert("Digite o nome para seu login!");
	document.reg.username.focus()
	return false
	}
if (document.reg.username.value.indexOf('@', 0) > -1 || document.reg.username.value.indexOf('"', 0) > -1 || document.reg.username.value.indexOf('!', 0) > -1 || document.reg.username.value.indexOf('@', 0) > -1 || document.reg.username.value.indexOf('#', 0) > -1 || document.reg.username.value.indexOf('$', 0) > -1 || document.reg.username.value.indexOf('%', 0) > -1 || document.reg.username.value.indexOf('¨', 0) > -1 || document.reg.username.value.indexOf('&', 0) > -1 || document.reg.username.value.indexOf('*', 0) > -1 || document.reg.username.value.indexOf('(', 0) > -1 || document.reg.username.value.indexOf(')', 0) > -1 || document.reg.username.value.indexOf('_', 0) > -1 || document.reg.username.value.indexOf('-', 0) > -1 || document.reg.username.value.indexOf('=', 0) > -1 || document.reg.username.value.indexOf('+', 0) > -1 || document.reg.username.value.indexOf('}', 0) > -1 || document.reg.username.value.indexOf('{', 0) > -1 || document.reg.username.value.indexOf(']', 0) > -1 || document.reg.username.value.indexOf('[', 0) > -1 || document.reg.username.value.indexOf('´', 0) > -1 || document.reg.username.value.indexOf('`', 0) > -1 || document.reg.username.value.indexOf('Ç', 0) > -1 || document.reg.username.value.indexOf('ç', 0) > -1 || document.reg.username.value.indexOf('á', 0) > -1 || document.reg.username.value.indexOf('Á', 0) > -1 || document.reg.username.value.indexOf('é', 0) > -1 || document.reg.username.value.indexOf('É', 0) > -1 || document.reg.username.value.indexOf('í', 0) > -1 || document.reg.username.value.indexOf('Í', 0) > -1 || document.reg.username.value.indexOf('ó', 0) > -1 || document.reg.username.value.indexOf('Ó', 0) > -1 || document.reg.username.value.indexOf('ú', 0) > -1 || document.reg.username.value.indexOf('Ú', 0) > -1 || document.reg.username.value.indexOf('â', 0) > -1 || document.reg.username.value.indexOf('Â', 0) > -1 || document.reg.username.value.indexOf('ê', 0) > -1 || document.reg.username.value.indexOf('Ê', 0) > -1 || document.reg.username.value.indexOf('î', 0) > -1 || document.reg.username.value.indexOf('Î', 0) > -1 || document.reg.username.value.indexOf('ô', 0) > -1 || document.reg.username.value.indexOf('Ô', 0) > -1 || document.reg.username.value.indexOf('û', 0) > -1 || document.reg.username.value.indexOf('Û', 0) > -1 || document.reg.username.value.indexOf('ã', 0) > -1 || document.reg.username.value.indexOf('Ã', 0) > -1 || document.reg.username.value.indexOf('õ', 0) > -1 || document.reg.username.value.indexOf('Õ', 0) > -1 || document.reg.username.value.indexOf('<', 0) > -1 || document.reg.username.value.indexOf('>', 0) > -1 || document.reg.username.value.indexOf(':', 0) > -1 || document.reg.username.value.indexOf(';', 0) > -1 || document.reg.username.value.indexOf('|', 0) > -1 || document.reg.username.value.indexOf('£', 0) > -1 || document.reg.username.value.indexOf('¢', 0) > -1 || document.reg.username.value.indexOf('¬', 0) > -1 || document.reg.username.value.indexOf('§', 0) > -1 || document.reg.username.value.indexOf('º', 0) > -1 || document.reg.username.value.indexOf('²', 0) > -1 || document.reg.username.value.indexOf('³', 0) > -1 || document.reg.username.value.indexOf('^', 0) > -1 || document.reg.username.value.indexOf('~', 0) > -1 || document.reg.username.value.indexOf('?', 0) > -1 || document.reg.username.value.indexOf('.', 0) > -1 || document.reg.username.value.indexOf(',', 0) > -1){ alert("é permitido somente letras e números no login");																																																																																																																																																											
	document.reg.username.focus()
	return false
	}
if (document.reg.username.value.indexOf(' ', 0) > -1){ 
alert("não utilize espaços em seu login");																																																																																																																																																											
	document.reg.username.focus()
	return false
	}	
	//Initialise variables
        var errorMsg = "";
        var errorMsgLong = "";

	     //Check for a password
        if (document.reg.password.value.length <= 3){
               errorMsg += "A Senha deve ter pelo menos 4 caracteres\n";
        }

        //Check both passwords are the same
        if ((document.reg.password.value) != (document.reg.repeat_password.value)){
                errorMsg += "A Senha não coincide com a que você digitou!";
                document.reg.password.value = "";
                document.reg.repeat_password.value = "";
        }
        //If there is a problem with the form then display an error
	if ((errorMsg != "") || (errorMsgLong != "")){
		msg = "";

		errorMsg += alert(msg + errorMsg + "\n" + errorMsgLong);
		return false;
	    }

	return true;
        }	
function alter_cadastro()
{
var nome = document.reg.nome.value
if (nome==""){
	alert("Digite seu nome!");
	document.reg.nome.focus()
	return false
	}
var sobrenome = document.reg.sobrenome.value
if (sobrenome==""){
	alert("Digite seu sobrenome!");
	document.reg.sobrenome.focus()
	return false
	}
var nome_empresa = document.reg.nome_empresa.value
if (nome_empresa==""){
	alert("Digite o nome de sua empresa!");
	document.reg.nome_empresa.focus()
	return false
	}		
var endereco = document.reg.endereco.value
if (endereco==""){
	alert("Digite o endereço de sua empresa!");
	document.reg.endereco.focus()
	return false
	}
var bairro = document.reg.bairro.value
if (bairro==""){
	alert("Entre com o bairro!");
	document.reg.bairro.focus()
	return false
	}
var municipio = document.reg.municipio.value
if (municipio==""){
	alert("Entre com o municipio!");
	document.reg.municipio.focus()
	return false
	}
var estado= document.reg.estado.value
if (estado==""){
	alert("Selecione o Estado!");
	document.reg.estado.focus()
	return false
	}
var mail = document.reg.mail.value;
if (mail==""){
	alert("Entre com seu email!")
	document.reg.mail.focus()
	return false
	}
if (document.reg.mail.value.indexOf('@', 0) == -1 || document.reg.mail.value.indexOf('.', 0) == -1){ 	alert("E-mail invalido!");
	document.reg.mail.focus()
	return false
	}
var CNPJ = document.reg.cnpj.value;
                 erro = new String;
		    	if (CNPJ=='00.000.000/0000-00') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='11.111.111/1111-11') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='22.222.222/2222-22') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='33.333.333/3333-33') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='44.444.444/4444-44') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='55.555.555/5555-55') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='66.666.666/6666-66') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='77.777.777/7777-77') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='88.888.888/8888-88') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='99.999.999/9999-99') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='000.000.000/0000-00') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ.length < 18) erro += "É necessario preencher corretamente o número do CNPJ! \n\n";
                 if (CNPJ.length < 18) erro += "É necessario preencher corretamente o número do CNPJ! "; 
                 if ((CNPJ.charAt(2) != ".") || (CNPJ.charAt(6) != ".") || (CNPJ.charAt(10) != "/") || (CNPJ.charAt(15) != "-")){
                 if (erro.length == 0) erro += "É necessário preencher corretamente o número do CNPJ! ";
                 }
                 //substituir os caracteres que não são números
               if(document.layers && parseInt(navigator.appVersion) == 4){
                      x = CNPJ.substring(0,2);
                       x += CNPJ. substring (3,6);
                       x += CNPJ. substring (7,10);
                       x += CNPJ. substring (11,15);
                       x += CNPJ. substring (16,18);
                       CNPJ = x; 
               } else {
                       CNPJ = CNPJ. replace (".","");
                       CNPJ = CNPJ. replace (".","");
                       CNPJ = CNPJ. replace ("-","");
                       CNPJ = CNPJ. replace ("/","");
               }
               var nonNumbers = /\D/;
               if (nonNumbers.test(CNPJ)) erro += "A verificação de CNPJ suporta apenas números! "; 
               var a = [];
               var b = new Number;
               var c = [6,5,4,3,2,9,8,7,6,5,4,3,2];
               for (i=0; i<12; i++){
                       a[i] = CNPJ.charAt(i);
                       b += a[i] * c[i+1];
 }
               if ((x = b % 11) < 2) { a[12] = 0 } else { a[12] = 11-x }
               b = 0;
               for (y=0; y<13; y++) {
                       b += (a[y] * c[y]); 
               }
               if ((x = b % 11) < 2) { a[13] = 0; } else { a[13] = 11-x; }
               if ((CNPJ.charAt(12) != a[12]) || (CNPJ.charAt(13) != a[13])){
                       erro +="Dígito verificador com problema!";
               }
               if (erro.length > 0){
                       alert(erro);
                  
  return false;
    }
}
function login()
{
var username = document.form1.username.value
if (username==""){
	alert("Digite seu nome de usuário!");
	document.form1.username.focus()
	return false
	}
var password = document.form1.password.value
if (password==""){
	alert("Digite sua Senha de Acesso!");
	document.form1.password.focus()
	return false
	}
}
function alterarsenha()
{
	//Initialise variables
        var errorMsg = "";
        var errorMsgLong = "";

	     //Check for a password
        if (document.reg.password.value.length <= 3){
                errorMsg += "A Senha deve ter pelo menos 4 caracteres\n";
        }

        //Check both passwords are the same
        if ((document.reg.password.value) != (document.reg.repeat_password.value)){
                errorMsg += "A Senha não coincide com a que você digitou!";
                document.reg.password.value = "";
                document.reg.repeat_password.value = "";
        }
        //If there is a problem with the form then display an error
	if ((errorMsg != "") || (errorMsgLong != "")){
		msg = "";

		errorMsg += alert(msg + errorMsg + "\n" + errorMsgLong);
		return false;
	    }

	return true;
        }	
function enviarsenha()
{
var username = document.reg.username.value
if (username==""){
	alert("Digite seu nome de usuário!");
	document.reg.username.focus()
	return false
	}
var email = document.reg.email.value;
if (email==""){
	alert("Entre com seu email!")
	document.reg.email.focus()
	return false
	}
if (document.reg.email.value.indexOf('@', 0) == -1 || document.reg.email.value.indexOf('.', 0) == -1){ alert("E-mail invalido!");
	document.reg.email.focus()
	return false
	}
}
function enviarlogin()
{
var CNPJ = document.reg.cnpj.value;
                 erro = new String;
		    	if (CNPJ=='00.000.000/0000-00') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='11.111.111/1111-11') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='22.222.222/2222-22') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='33.333.333/3333-33') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='44.444.444/4444-44') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='55.555.555/5555-55') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='66.666.666/6666-66') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='77.777.777/7777-77') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='88.888.888/8888-88') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='99.999.999/9999-99') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ=='000.000.000/0000-00') {erro += "CNPJ inválido! \n\n";}
				if (CNPJ.length < 18) erro += "É necessario preencher corretamente o número do CNPJ! \n\n";
                 if ((CNPJ.charAt(2) != ".") || (CNPJ.charAt(6) != ".") || (CNPJ.charAt(10) != "/") || (CNPJ.charAt(15) != "-")){
                 if (erro.length == 0) erro += "É necessário preencher corretamente o número do CNPJ! ";
                 }
                 //substituir os caracteres que não são números
               if(document.layers && parseInt(navigator.appVersion) == 4){
                      x = CNPJ.substring(0,2);
                       x += CNPJ. substring (3,6);
                       x += CNPJ. substring (7,10);
                       x += CNPJ. substring (11,15);
                       x += CNPJ. substring (16,18);
                       CNPJ = x; 
               } else {
                       CNPJ = CNPJ. replace (".","");
                       CNPJ = CNPJ. replace (".","");
                       CNPJ = CNPJ. replace ("-","");
                       CNPJ = CNPJ. replace ("/","");
               }
               var nonNumbers = /\D/;
               if (nonNumbers.test(CNPJ)) erro += "A verificação de CNPJ suporta apenas números! "; 
               var a = [];
               var b = new Number;
               var c = [6,5,4,3,2,9,8,7,6,5,4,3,2];
               for (i=0; i<12; i++){
                       a[i] = CNPJ.charAt(i);
                       b += a[i] * c[i+1];
 }
               if ((x = b % 11) < 2) { a[12] = 0 } else { a[12] = 11-x }
               b = 0;
               for (y=0; y<13; y++) {
                       b += (a[y] * c[y]); 
               }
               if ((x = b % 11) < 2) { a[13] = 0; } else { a[13] = 11-x; }
               if ((CNPJ.charAt(12) != a[12]) || (CNPJ.charAt(13) != a[13])){
                       erro +="Dígito verificador com problema!";
               }
               if (erro.length > 0){
                       alert(erro);
                  
  return false;
    }
var email = document.reg.email.value;
if (email==""){
	alert("Entre com seu email!")
	document.reg.email.focus()
	return false
	}
if (document.reg.email.value.indexOf('@', 0) == -1 || document.reg.email.value.indexOf('.', 0) == -1){ alert("E-mail invalido!");
	document.reg.email.focus()
	return false
	}
}	
function categorias()
{
window.open('relacao_categorias.asp','','scrollbars=yes,resizable=no,width=340,height=400');
}

function saida() {
var sistema = confirm("você tem certeza de que deseja sair?");
if (sistema == true){
window.open('application/logout.php','_parent');
}
}
function altera_senha() {

	//Initialise variables
        var errorMsg = "";
        var errorMsgLong = "";

	     //Check for a password
        if (document.form.password.value.length <= 3){
                errorMsg += "A Senha deve ter pelo menos 4\n caracteres ";
        }

        //Check both passwords are the same
        if ((document.form.password.value) != (document.form.repeat_password.value)){
                errorMsg += "A Senha não coincide com a que você digitou!";
                document.form.password.value = "";
                document.form.repeat_password.value = "";
        }
        //If there is a problem with the form then display an error
	if ((errorMsg != "") || (errorMsgLong != "")){
		msg = "";

		errorMsg += alert(msg + errorMsg + "\n" + errorMsgLong);
		return false;
	    }

	return true;
        }
function desenvolvimento()
{
alert("em desenvolvimento!");
}
function manutencao()
{
alert("Estamos com o nosso sistema em manutenção, por favor, volte dentro de algumas horas.\nDesculpe o incômodo.");
}
function manutencao_temp()
{
alert("Estamos com o nosso sistema temporariamente em manutenção.\nDesculpe o incômodo.");
}
function desativado()
{
alert("FUNÇÃO TEMPORARIAMENTE DESATIVADA");
}
function restrito()
{
alert("ACESSO RESTRITO!!\nvocê não está logado ou sua sessão expirou \npor favor, logue-se novamente");
}
function sobre()
{
alert("©2006 DMC PUBLICIDADE - Todos os Direitos Reservados\n\nEquipe operacional DMC PUBLICIDADE:\n\nComercial: Almira Fernandes\n\t  Daniel Villaça\n\t  Sônia Tavares\n\nFinanceiro: Samira Abrahim\n\nCriação: Marcus Montes\nOperacional: Márcio Oberdan\nControle: Janaina Janeiro\n\n\nDesenvolvimento do site: 2d+ Soluções - www.2dmais.com.br");
}