jQuery.noConflict();


    	 (function($){
		        // call setMask function on the document.ready event
		          $(function(){
		            $('input:text').setMask();
		            
		          }
		        );
		      })(jQuery);

    	 (function($){
		        // call setMask function on the document.ready event
		          $(function(){
		        	//  $('#barra_login *').tooltip();
		        	  $('div a').tooltip({ 
		        		    //track: true, 
		        		    delay: 0, 
		        		    showURL: false, 
		        		    showBody: " - ", 
		        		    fade: 250 
		        		});
		        	  //$('#menu_site_topo *').tooltip();
		          }
		        );
		      })(jQuery);
	      
    	 
    	 
		 function validadata(campo) {
		        
		    	var date=campo.value;
				if(!date) return;
		    	var ardt=new Array;
		    	var ExpReg=new RegExp("(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[012])/[12][0-9]{3}");

		    	ardt=date.split("/");
		    	erro=false;
		    	if ( date.search(ExpReg)==-1){
		    		erro = true;
		    		}
		    	else if (((ardt[1]==4)||(ardt[1]==6)||(ardt[1]==9)||(ardt[1]==11)) && (ardt[0]>30))
		    		erro = true;
		    	else if ( ardt[1]==2) {
		    		if ((ardt[0]>28) && ((ardt[2]%4)!=0))
		    			erro = true;
		    		if ((ardt[0]>29) && ((ardt[2]%4)==0))
		    			erro = true;
		    	}
		    	if (erro) {
		    		alert("Data inválida");
		    		campo.value = "";
		    	
		    		return false;
		    	}
		    	return true;
		}


		 function verifica_senha_forte(obj) {

			 var texto = obj.value;

			 if(texto=="") {
			 document.getElementById("senha").style.width="0";
			 document.getElementById("senha").style.background="white";
			 document.getElementById("texto").innerHTML="Informe a senha";
			 return false;
			 }

			 var valor_num = 0;
			 var valor_let = 0;

			 for(var i = 0; i < texto.length; i++) {

				 if(isNaN(texto.substring(i, i+1))) {
					valor_let=valor_let+1;
	
				 } else {
				 	valor_num=valor_num+1;
				 }

			 }

			 if(valor_num==texto.length || valor_let==texto.length) {
				 document.getElementById("senha").style.width="40";
				 document.getElementById("senha").style.backgroundColor="blue";
				 document.getElementById("texto").innerHTML="SENHA FRACA";
				 return false;
			 }

			 else if(valor_num!=texto.length || valor_let!=texto.length) {

			 if(texto.length < 5) {
				 document.getElementById("senha").style.width="40";
				 document.getElementById("senha").style.backgroundColor="blue";
				 document.getElementById("texto").innerHTML="SENHA FRACA";
				 return false;
			 }
			 else if(texto.length >=5  && texto.length <= 8) {
				 document.getElementById("senha").style.width="80";
				 document.getElementById("senha").style.background="yellow";
				 document.getElementById("texto").innerHTML="SENHA REGULAR";
				 return false;
			 }
			 else if(texto.length > 8) {
				 document.getElementById("senha").style.width="140";
				 document.getElementById("senha").style.background="green";
				 document.getElementById("texto").innerHTML="SENHA FORTE";
				 return false;
			 }

			 }

			 } 

		 function __valida_cpf(cpf){
			 	
			    var numeros, digitos, soma, i, resultado, digitos_iguais;
			    digitos_iguais = 1;
			    if (cpf.length < 11)
			          return false;
			    for (i = 0; i < cpf.length - 1; i++)
			          if (cpf.charAt(i) != cpf.charAt(i + 1))
			                {
			                digitos_iguais = 0;
			                break;
			                }
			    if (!digitos_iguais)
			          {
			          numeros = cpf.substring(0,9);
			          digitos = cpf.substring(9);
			          soma = 0;
			          for (i = 10; i > 1; i--)
			                soma += numeros.charAt(10 - i) * i;
			          resultado = soma % 11 < 2 ? 0 : 11 - soma % 11;
			          if (resultado != digitos.charAt(0))
			                return false;
			          numeros = cpf.substring(0,10);
			          soma = 0;
			          for (i = 11; i > 1; i--)
			                soma += numeros.charAt(11 - i) * i;
			          resultado = soma % 11 < 2 ? 0 : 11 - soma % 11;
			          if (resultado != digitos.charAt(1))
			                return false;
			          return true;
			          }
			    else
			          return false;
			    }

			function __valida_cnpj(cnpj)
			{
			
			var numeros, digitos, soma, i, resultado, pos, tamanho, digitos_iguais;
			digitos_iguais = 1;
			if (cnpj.length < 14 && cnpj.length < 15)
			      return false;
			for (i = 0; i < cnpj.length - 1; i++)
			      if (cnpj.charAt(i) != cnpj.charAt(i + 1))
			            {
			            digitos_iguais = 0;
			            break;
			            }
			if (!digitos_iguais)
			      {
			      tamanho = cnpj.length - 2
			      numeros = cnpj.substring(0,tamanho);
			      digitos = cnpj.substring(tamanho);
			      soma = 0;
			      pos = tamanho - 7;
			      for (i = tamanho; i >= 1; i--)
			            {
			            soma += numeros.charAt(tamanho - i) * pos--;
			            if (pos < 2)
			                  pos = 9;
			            }
			      resultado = soma % 11 < 2 ? 0 : 11 - soma % 11;
			      if (resultado != digitos.charAt(0))
			            return false;
			      tamanho = tamanho + 1;
			      numeros = cnpj.substring(0,tamanho);
			      soma = 0;
			      pos = tamanho - 7;
			      for (i = tamanho; i >= 1; i--)
			            {
			            soma += numeros.charAt(tamanho - i) * pos--;
			            if (pos < 2)
			                  pos = 9;
			            }
			      resultado = soma % 11 < 2 ? 0 : 11 - soma % 11;
			      if (resultado != digitos.charAt(1))
			            return false;
			      return true;
			      }
			else
			      return false;
			} 

			function __valida_cep(cep) {
				if(cep.length!=8)
					return false;
				return true;
			}
			
			function valida_cep(obj){
				 campo = obj.value.replace("-","");
				 
				 if(!campo)
					 return true;
				 
				 if(!__valida_cep(campo)){
						alert("CEP inválido.");
						obj.value="";
						return false;
					 }
			}
			
			function __valida_hora(campo){
				if(campo.length!=4){
					return false;
				}
				if(campo.substring(0,2)>23) return false;
				if(campo.substring(2,5)>60) return false;
				
				return true;
			}
			
			function valida_hora(obj){
				 campo = obj.value.replace(":","");
				 if(!campo)
					 	return true;
				
				 if(!__valida_hora(campo)){
					 alert("Hora inválida. Digite no formato HH:mm.");
						obj.value="";
						return false;
				 }
			}

			/*
			 * Esconde as mensagem do flashMessage
			 */
			function esconder_flashMessage(){
				document.getElementById('flashMessage').style.display = 'none';
			}

			 function valida_cpf(obj){

				 if(obj.value=="")
					 return;

				 campo = obj.value.replace(".","");
				 campo = campo.replace("-","");
				 campo = campo.replace(".","");
				 campo = campo.replace(".","");
				 campo = campo.replace("/","");
				 //alert(campo);
				 if(!__valida_cpf(campo)){
					alert("CPF inválido.");
					obj.value="";
					return;
				 }
			 }
			 function valida_cnpj(obj){
				 if(obj.value=="")
					 return;

				 campo = obj.value.replace(".","");
				 campo = campo.replace("-","");
				 campo = campo.replace("/","");
				 campo = campo.replace(".","");
				 campo = campo.replace(".","");
				// alert(campo);
				 if(!__valida_cnpj(campo)){
						alert("CNPJ inválido.");
						obj.value="";
						return;
					 }
			 }
