//Inicio Funcao janela POPUP
	function MM_openBrWindow(theURL,winName,features) { //v2.0
		window.open(theURL,winName,features);
	}
//#Fim da Funcao janela POPUP

//Inicio Funcao muda cor tabela - MENU
	function mOvr(src,clrOver) {
	if (!src.contains(event.fromElement)) {
		  src.style.cursor = 'DEFAULT';
		  src.bgColor = clrOver;
		}
	}
	function mOut(src,clrIn) {
		if (!src.contains(event.toElement)) {
		  src.style.cursor = 'default';
		  src.bgColor = clrIn;
		}
	}
//#Fim da Funcao muda cor tabela - MENU

//Inicio Funcao que atualiza pag. qdo carregado pelo Netscape versão 4
	function MM_reloadPage(init) {  //reloads the window if Nav4 resized
	  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
		document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
	  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
	}
	MM_reloadPage(true);
//#Fim da Funcao que atualiza pag. qdo carregado pelo Netscape versão 4

//Inicio Funcao que verifica CPF e retorna na variavel errocpfcnpj o resultado
	function verificaCPF(numero) { 
  	  if (numero == "00000000000" || numero == "11111111111" || numero == "22222222222" || numero == "33333333333" || numero == "44444444444" || numero == "55555555555"
		  ||numero == "66666666666" || numero == "77777777777" || numero == "88888888888" || numero == "99999999999" ||  numero.length < 11 || numero.length > 11 ) {
    	  errocpfcnpj = true
		  return false; 
	  } 
	  
 	  var checkOK = "0123456789";
	  var checkStr = numero;
	  var validade = true;
	  var decPoints = 0;
	  var allNum = "";
	  for (i = 0;  i < checkStr.length;  i++) {
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		  if (ch == checkOK.charAt(j))
			break;
		if (j == checkOK.length){
		  validade = false;
		  break;
		}
		allNum += ch;
	  }
	  if (!validade) {
    	errocpfcnpj = true
		return false;    
	  }

	 var primeiro = numero.charAt(0); 
	 var n = false;
	 for (i=0; i<=10; i++)  {  
	   c = numero.charAt(i); 
	   if(! (c >= "0")&&(c <= "9"))    { 
		errocpfcnpj = true
		return false;
	   } 
	   if( c!=primeiro )n = true;
	 }  
	 if( ! n ){
		errocpfcnpj = true
		return false;
	 }
	 soma=0; 
	 for ( i=0; i<9; i++ ) { 
		soma += (10-i) * ( eval(numero.charAt(i)) ); 
	 }
	 vdigito = 11-(soma % 11); 
	 if ( (soma % 11) < 2 ) vdigito = 0; 
	 if ( eval(numero.charAt(9)) != vdigito ){
		errocpfcnpj = true
		return false;
	 }
	 soma=0; 
	 for ( i=0; i<9; i++ ) { 
		soma += (11-i) * ( eval(numero.charAt(i)) ); 
	 } 
	 soma += 2 * ( eval(numero.charAt(9)) ); 
	 vdigito = 11-(soma % 11); 
	 if ( (soma % 11) < 2 ) vdigito = 0; 
	 if ( eval(numero.charAt(10)) != vdigito){
		errocpfcnpj = true			
		return false;
	 }
	 errocpfcnpj = false
	 //se chegou aki o cpf esta ok
	} 
//# Fim da Funcao que verifica CPF e retorna na variavel errocpfcnpj o resultado	

//Inicio da Funcao que verifica CNPJ e retorna na variavel errocpfcnpj o resultado	
	function verificaCNPJ(numero)  
	{  
  	  if (numero == "00000000000000" || numero == "11111111111111" || numero == "22222222222222" || numero == "33333333333333" || numero == "44444444444444" || numero == "55555555555555"
		  ||numero == "66666666666666" || numero == "77777777777777" || numero == "88888888888888" || numero == "99999999999999" ||  numero.length < 14 || numero.length > 14 ) {
    	  errocpfcnpj = true
		  return false; 
	  } 
	  var checkOK = "0123456789";
	  var checkStr = numero;
	  var validade = true;
	  var decPoints = 0;
	  var allNum = "";
	  for (i = 0;  i < checkStr.length;  i++) {
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		  if (ch == checkOK.charAt(j))
			break;
		if (j == checkOK.length){
		  validade = false;
		  break;
		}
		allNum += ch;
	  }
	  if (!validade) {
    	errocpfcnpj = true
		return false;    
	  }
		  
	 var primerio = numero.charAt(0);  
	 var multiplo,verificador,a, b = ""; 
	 var i,j,d,resu = 0; 
	 for ( var i=0; i<=13; i++ )  
	 {   
	   var c = numero.charAt(i);  
	   if( ! (c>="0")&&(c<="9") ) {
    	  errocpfcnpj = true
		  return false; 
	   } 
	   if( c!=primerio ) { vcpf = true; } 
	 }   
	 if( ! vcpf ){
		errocpfcnpj = true
		return false; 
	 }  
	 a = numero.substring(0,12);  
	 b = numero.substring(12,15); 
	 multiplo = "543298765432"; 
	 verificador = ""; 
	 for ( j=1; j<3; j++ ) {  
	  resu = 0; 
	  for ( i=0; i<12; i++ ) { 
		resu += eval( a.charAt(i) )* eval( multiplo.charAt(i) );} 
		if( j == 2 ){ resu += (2 * d); }  
		d = ((resu*10) % 11); 
		if( d == 10 ){ d = 0; } 
		verificador = verificador + d; 
		multiplo = "654329876543"; 
	 }   
	 if( verificador != b ) { 
		errocpfcnpj = true
		return false 
	 } else {
		errocpfcnpj = false
		//se chegou aki o cnpj esta ok - return true 
	 }  
	}  
//# Fim da Funcao que verifica CNPJ e retorna na variavel errocpfcnpj o resultado.

//Inicio Funcao testa e-mail e retorna na variavel erroemail o resultado
	function VerificaEmail(email) {
		erroemail = false;
		email = email.toLowerCase();
		var CaracteresErro = "*|,\":<>[]{}`\';()&$#%çáéíóúãõâêîôûàèìòù^~!? ";
		var CaracteresObrig = "@."; 
		var CaracteresErroFinal = "@_-."; 
		var CaracteresErroInicio = "@."; 
		var ContaArroba = 0;
		//---------------------------------------------------------------------//
		if(email.length < 4){
			erroemail = true;
			return false; };
		for (var i = 0; i < email.length; i++) {
			if (CaracteresErro.indexOf(email.charAt(i)) != -1){
				erroemail = true;
				return false; };
			if (email.charAt(i)=="@"){
				ContaArroba++
				if (ContaArroba>1){
					erroemail = true;
					return false; };
			}
		}
		for (var i = 0; i < CaracteresObrig.length; i++) {
			if (email.indexOf(CaracteresObrig.charAt(i)) == -1){
				erroemail = true; 
				return false;	};
		}
		if (email.indexOf ('@.',0) != -1||email.indexOf ('..',0) != -1){
			//---testa sequencia de carateres inválidas
			erroemail = true;
			return false;	};

		for (var i = 0; i < CaracteresErroInicio.length; i++) {
			if (email.charAt(0)==CaracteresErroInicio.charAt(i)){
				erroemail = true; 
				return false;	};
		}
		temp = email.length -1
		for (var i = 0; i < CaracteresErroFinal.length; i++) {
			if (email.charAt(temp)==CaracteresErroFinal.charAt(i)){
				erroemail = true; 
				return false;	};
		}
/*USANDO A FUNÇÃO - SINTAXE
		VerificaEmail(form.campo.value);
		if(erroemail==true)	{
			alert("Esse e-mail não é válido!");
			form.campo.focus();
			return false;	};
*/
	} 
//#Fim da Funcao testa e-mail e retorna na variavel erroemail o resultado	
