
	function verificaNumero()
	{
		var varCaractere = String.fromCharCode(event.keyCode)
				
		if (!fctEhDigitoNumerico(varCaractere))
		{
			event.returnValue = false;
		}

    }

    function verificaNumeroBrowser(e) {
        var characterCode;
        var strCaratere;

        if (e && e.which) {
            e = e;
            characterCode = e.which;
        }
        else {
            e = event;
            characterCode = e.keyCode;
        }

        //backspace
        if (characterCode == 8) {
            return true;
        }
        else {
            strCaratere = String.fromCharCode(characterCode);
            if (!fctEhDigitoNumerico(strCaratere)) {
                return false;
            }
            return true;
        }
    }
	
	function verificaNumeroComVirgula()
	{
	    
	    //Permito a Vírgula
        if(event.keyCode == 44)
        {
            event.returnValue = true;
        }
        else
        {   
		    var varCaractere = String.fromCharCode(event.keyCode)
    				
		    if (!fctEhDigitoNumerico(varCaractere))
		    {
			    event.returnValue = false;
		    }
		}

	}

	function fctEhDigitoNumerico(istrDig)
	{
		if((istrDig == '0') || (istrDig == '1') || (istrDig == '2') || (istrDig == '3') || (istrDig == '4') || (istrDig =='5') || (istrDig == '6') || (istrDig == '7') || (istrDig == '8') || (istrDig == '9')) 
		{
			return true;
		}
		else
		{
			return false;
		}
	}
			
	function ftcEhNumero(numero)
	{
		try
		{
			x = parsefloat(numero);
			return true;
		}
		catch(e)
		{
			return false;
		}
	}
	
	 function Limpar(valor, validos) {
    // retira caracteres invalidos da string
    var result = "";
    var aux;
    for (var i=0; i < valor.length; i++) {
    aux = validos.indexOf(valor.substring(i, i+1));
        if (aux>=0) {
        result += aux;
        }
    }
    return result;
    }
    
    
    

   
	
	

    //Formata número tipo moeda usando o evento onKeyDown
    function Formata(campo, tammax, teclapres, decimal) {
        var tecla = teclapres.keyCode;
        vr = Limpar(campo.value, "0123456789");
        tam = vr.length;
        dec = decimal

        if (tam < tammax && tecla != 8) { tam = vr.length + 1; }

        if (tecla == 8)
        { tam = tam - 1; }

        if (tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105) {
            if (tam <= dec)
            { campo.value = vr; }

            if ((tam > dec) && (tam <= 5)) {
                campo.value = vr.substr(0, tam - 2) + "," + vr.substr(tam - dec, tam);
            }
            if ((tam >= 6) && (tam <= 8)) {
                campo.value = vr.substr(0, tam - 5) + "." + vr.substr(tam - 5, 3) + "," + vr.substr(tam - dec, tam);
            }
            if ((tam >= 9) && (tam <= 11)) {
                campo.value = vr.substr(0, tam - 8) + "." + vr.substr(tam - 8, 3) + "." + vr.substr(tam - 5, 3) + "," + vr.substr(tam - dec, tam);
            }
            if ((tam >= 12) && (tam <= 14)) {
                campo.value = vr.substr(0, tam - 11) + "." + vr.substr(tam - 11, 3) + "." + vr.substr(tam - 8, 3) + "." + vr.substr(tam - 5, 3) + "," + vr.substr(tam - dec, tam);
            }
            if ((tam >= 15) && (tam <= 17)) {
                campo.value = vr.substr(0, tam - 14) + "." + vr.substr(tam - 14, 3) + "." + vr.substr(tam - 11, 3) + "." + vr.substr(tam - 8, 3) + "." + vr.substr(tam - 5, 3) + "," + vr.substr(tam - 2, tam);
            }
        }
    }


    //Formata número tipo moeda usando o evento onKeyDown
    function FormataSemPonto(campo, tammax, teclapres, decimal) {
        var tecla = teclapres.keyCode;
        vr = Limpar(campo.value, "0123456789");
        tam = vr.length;
        dec = decimal

        if (tam < tammax && tecla != 8) { tam = vr.length + 1; }

        if (tecla == 8)
        { tam = tam - 1; }

        if (tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105) {
            if (tam <= dec)
            { campo.value = vr; }

            if ((tam > dec) && (tam <= 5)) {
                campo.value = vr.substr(0, tam - 2) + "," + vr.substr(tam - dec, tam);
            }
            if ((tam >= 6) && (tam <= 8)) {
                campo.value = vr.substr(0, tam - 5) + vr.substr(tam - 5, 3) + "," + vr.substr(tam - dec, tam);
            }
            if ((tam >= 9) && (tam <= 11)) {
                campo.value = vr.substr(0, tam - 8) + vr.substr(tam - 8, 3) + vr.substr(tam - 5, 3) + "," + vr.substr(tam - dec, tam);
            }
            if ((tam >= 12) && (tam <= 14)) {
                campo.value = vr.substr(0, tam - 11) + vr.substr(tam - 11, 3) + vr.substr(tam - 8, 3) + vr.substr(tam - 5, 3) + "," + vr.substr(tam - dec, tam);
            }
            if ((tam >= 15) && (tam <= 17)) {
                campo.value = vr.substr(0, tam - 14) + vr.substr(tam - 14, 3) + vr.substr(tam - 11, 3) + vr.substr(tam - 8, 3) + vr.substr(tam - 5, 3) + "," + vr.substr(tam - 2, tam);
            }
        }
    }

    
    //Busca o endereço de acordo com o CEP
    //Chamada: onclick="fncBuscaCEP('txtCEP1', 'txtCEP2', 'txtEndereco', 'txtBairro', 'txtCidade', 'cboEstado');"
    //Adicionar na página o iFrame: <iframe id="frmCEP" width="0" height="0"></iframe>
function fncBuscaCEP(strCEP1, strCEP2, strCampoEndereco, strCampoBairro, strCampoCidade, strCampoEstado)
{
    
    var cep1  = document.getElementById(strCEP1);
    var cep2  = document.getElementById(strCEP2);
     
    cep = cep1.value + cep2.value;
    
    window.frmCEP.location.reload('BuscaCEP.aspx?cep=' + cep + '&form=aspnetForm&CpLog=' + strCampoEndereco + '&CpBai=' + strCampoBairro + '&CpCid=' + strCampoCidade + '&CpEst=' + strCampoEstado);
    //document.forms[0].ctl00$ContentPlaceHolder1$txtNumero.focus();
}




function bloqueiaEnter()
{
 if (event.keyCode == 13)
 {
    event.keyCode = 0;
    return;
 }
}



// Formata RG para que receba apenas numeros e o caracter X
function FormataRG()
{
 if ((event.keyCode < 48 || event.keyCode > 57) && event.keyCode != 120 && event.keyCode != 88)
 {
    event.keyCode = 0;
    return;
 }

}

// Possibilitar apenas Numerico
function Numerico()
{
 if (event.keyCode < 48 || event.keyCode > 57)
 {
    event.keyCode = 0;
    return;
 }
}


//Formata o CPF ao digitar (Máscara)
//Chamada: onkeypress="FormataCPF(document.Form1,this.id,11,8,5,2,event);"
function FormataCPF(pForm,pCampo,pTamMax,pPos1,pPos2,pPosTraco,pTeclaPres)
{
 if (event.keyCode < 48 || event.keyCode > 57)
 {
    event.keyCode = 0;
    return;
 }
 
 
 var wTecla, wVr, wTam;
 wTecla = pTeclaPres.keyCode;
 wVr = pForm[pCampo].value;
 wVr = wVr.toString().replace( "-", "" );
 wVr = wVr.toString().replace( ".", "" );
 wVr = wVr.toString().replace( ".", "" );
 wVr = wVr.toString().replace( "/", "" );
 wTam = wVr.length ;

 if (wTam < pTamMax && wTecla != 8) { 
    wTam = wVr.length + 1 ; 
 }

 if (wTecla == 8 ) { 
    wTam = wTam - 1 ; 
 }
   
 if ( wTecla == 8 || wTecla == 88 || wTecla >= 48 && wTecla <= 57 || wTecla >= 96 && wTecla <= 105 ){
  if ( wTam <= 2 ){
    pForm[pCampo].value = wVr ;
  }
  if (wTam > pPosTraco && wTam <= pTamMax) {
        wVr = wVr.substr(0, wTam - pPosTraco) + '-' + wVr.substr(wTam - pPosTraco, wTam);
  }
  if ( wTam == pTamMax){
        wVr = wVr.substr( 0, wTam - pPos1 ) + '.' + wVr.substr(wTam - pPos1, 3) + '.' + wVr.substr(wTam - pPos2, wTam);
  }
  pForm[pCampo].value = wVr;
 
 }
}

//Valida o CPF
	function fctEhCPF(objCPF, args)
	{
		var CPF = args.Value.replace(/\D/gi,'');
    	        var a = CPF;
    
		if (CPF.length < 8){
		    return args.IsValid = false;
		}
		
		if ((CPF.length == 9) || (CPF.length == 8))
        {   
	        for (i = CPF.length; i < 10; i++)
	        {
		        a = '0' + a;
        	}
        	CPF = a;
        }

		var POSICAO, I, SOMA, DV, DV_INFORMADO;
		var DIGITO = new Array(10);
		DV_INFORMADO = CPF.substr(9, 2);

		for (I=0; I<=8; I++) {
			DIGITO[I] = CPF.substr( I, 1);
		}

		// Calcula o valor do 10º dígito da verificação
		POSICAO = 10;
		SOMA = 0;
		for (I=0; I<=8; I++) {
			SOMA = SOMA + DIGITO[I] * POSICAO;
			POSICAO = POSICAO - 1;
		} 
		DIGITO[9] = SOMA % 11;
		if (DIGITO[9] < 2) {
				DIGITO[9] = 0;
		}
		else{
			DIGITO[9] = 11 - DIGITO[9];
		}

		// Calcula o valor do 11º dígito da verificação
		POSICAO = 11;
		SOMA = 0;
		for (I=0; I<=9; I++) {
			SOMA = SOMA + DIGITO[I] * POSICAO;
			POSICAO = POSICAO - 1;
		}
		DIGITO[10] = SOMA % 11;
		if (DIGITO[10] < 2) {
				DIGITO[10] = 0;
		}
		else {
				DIGITO[10] = 11 - DIGITO[10];
		}
		
		// Verifica se os valores dos dígitos verificadores conferem
		DV = DIGITO[9] * 10 + DIGITO[10];
		if (DV != DV_INFORMADO || CPF == '11111111111' || CPF == '22222222222' || CPF == '33333333333' || CPF == '44444444444' || CPF == '55555555555' || CPF == '66666666666' || CPF == '77777777777' || CPF == '88888888888' || CPF == '99999999999' || CPF == '00000000000') {
			return args.IsValid = false;
		}
		
		return args.IsValid = true;
	}

// Valida CPF da página de cadastro
	function fctEhCPF2(objCPF, args)
	{
		var CPF = args.Value.replace(/\D/gi,'');
    	        var a = CPF;
    
		if (CPF.length < 11 || CPF.length > 11) {
		    alert('Caro usuário, preencha seu CPF com 11 dígitos. Caso não tenha preencha com zeros a esquerda.');
		    return args.IsValid = false;
		}
		
		if ((CPF.length == 9) || (CPF.length == 8))
        {   
	        for (i = CPF.length; i < 10; i++)
	        {
		        a = '0' + a;
        	}
        	CPF = a;
        }

		var POSICAO, I, SOMA, DV, DV_INFORMADO;
		var DIGITO = new Array(10);
		DV_INFORMADO = CPF.substr(9, 2);

		for (I=0; I<=8; I++) {
			DIGITO[I] = CPF.substr( I, 1);
		}

		// Calcula o valor do 10º dígito da verificação
		POSICAO = 10;
		SOMA = 0;
		for (I=0; I<=8; I++) {
			SOMA = SOMA + DIGITO[I] * POSICAO;
			POSICAO = POSICAO - 1;
		} 
		DIGITO[9] = SOMA % 11;
		if (DIGITO[9] < 2) {
				DIGITO[9] = 0;
		}
		else{
			DIGITO[9] = 11 - DIGITO[9];
		}

		// Calcula o valor do 11º dígito da verificação
		POSICAO = 11;
		SOMA = 0;
		for (I=0; I<=9; I++) {
			SOMA = SOMA + DIGITO[I] * POSICAO;
			POSICAO = POSICAO - 1;
		}
		DIGITO[10] = SOMA % 11;
		if (DIGITO[10] < 2) {
				DIGITO[10] = 0;
		}
		else {
				DIGITO[10] = 11 - DIGITO[10];
		}
		
		// Verifica se os valores dos dígitos verificadores conferem
		DV = DIGITO[9] * 10 + DIGITO[10];
		if (DV != DV_INFORMADO || CPF == '11111111111' || CPF == '22222222222' || CPF == '33333333333' || CPF == '44444444444' || CPF == '55555555555' || CPF == '66666666666' || CPF == '77777777777' || CPF == '88888888888' || CPF == '99999999999' || CPF == '00000000000') {
			return args.IsValid = false;
		}
		
		return args.IsValid = true;
	}
	
	//Valida o CPF
    function ValidaEhCPF(numCPF){ 
      
            var i; 
              
            s = numCPF;

            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 fncValorFrete(strCEP1, strCEP2, strCampoEndereco, strCampoBairro, strCampoCidade, strCampoEstado)
{
    var cep = document.Form1.elements[strCEP1].value + document.Form1.elements[strCEP2].value;
    window.frmCEP.location.reload('ifraCalcularFrete.aspx?cep=' + cep + '&form=Form1&CpLog=' + strCampoEndereco + '&CpBai=' + strCampoBairro + '&CpCid=' + strCampoCidade + '&CpEst=' + strCampoEstado);
    document.Form1.txtNumero.focus();
}


function fctComparaDatas(diaData1,mesData1,anoData1,diaData2,mesData2,anoData2)
{
    data1 = new Date(anoData1, mesData1-1, diaData1); 
    data2 = new Date(anoData2, mesData2-1, diaData2);  
    
    if(data1 >= data2)   
        return false;    
    else
        return true;    
}

function ValidaEmail(email){
	var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
	var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid

	if (!reg1.test(email) && reg2.test(email)) // if syntax is valid
		return true;
	else
		return false;
}

function ValidDate(objName) {
	var strDate;
	var strDateArray;
	var strDay;
	var strMonth;
	var strYear;
	var booFound = false;
	var intday;
	var intMonth;
	var intYear;
	var datefield = objName;
	
	//var strSeparatorArray = new Array("-"," ","/",".");
    var strSeparatorArray = new Array("/");
	
	var intElementNr;
	var strMonthArray = new Array(12);
	strMonthArray[0] = "Jan";
	strMonthArray[1] = "Feb";
	strMonthArray[2] = "Mar";
	strMonthArray[3] = "Apr";
	strMonthArray[4] = "May";
	strMonthArray[5] = "Jun";
	strMonthArray[6] = "Jul";
	strMonthArray[7] = "Aug";
	strMonthArray[8] = "Sep";
	strMonthArray[9] = "Oct";
	strMonthArray[10] = "Nov";
	strMonthArray[11] = "Dec";
	strDate = objName;

	if (strDate.length < 5) {
		if (strDate.length < 1) {
			return true;
		} else {
			return false;
		}	
	}

	//Separator - Day - Month - Year
	for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
		if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
			strDateArray = strDate.split(strSeparatorArray[intElementNr]);
			if (strDateArray.length != 3) {
				err = 1;
				return false;
			} else {
				strDay = strDateArray[0];
				strMonth = strDateArray[1];
				strYear = strDateArray[2];
			}
			booFound = true;
		}
			
	}
	
	if (! booFound) { return false;	}

	if (strYear.length == 2) {
		strYear = '20' + strYear;
	}

	intday = parseInt(strDay, 10);
	if (isNaN(intday)) {
		err = 2;
		return false;
	}

	intMonth = parseInt(strMonth, 10);
	if (isNaN(intMonth)) {
		for (i = 0;i<12;i++) {
			if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
				intMonth = i+1;
				strMonth = strMonthArray[i];
				i = 12;
			}
		}
		if (isNaN(intMonth)) {
			err = 3;
			return false;
	   }
	}
	intYear = parseInt(strYear, 10);
	if (isNaN(intYear)) {
		err = 4;
		return false;
	}
	if (intMonth>12 || intMonth<1) {
		err = 5;
		return false;
	}
	if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
		err = 6;
		return false;
	}
	if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
		err = 7;
		return false;
	}
	if (intMonth == 2) {
		if (intday < 1) {
			err = 8;
			return false;
		}
		if (LeapYear(intYear) == true) {
			if (intday > 29) {
				err = 9;
				return false;
   			}
		} else {
			if (intday > 28) {
				err = 10;
				return false;
      		}
   		}
	}
	return true;
}

function LeapYear(intYear) {
	if (intYear % 100 == 0) {
		if (intYear % 400 == 0) { return true; }
	} else {
		if ((intYear % 4) == 0) { return true; }
	}
	return false;
}

// Dreamweaver Function    
    function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    }
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    }

    function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
    }

    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }
    //Fim Dreamweaver Function



    
    function fctExibirOuEsconder(strIdSender, strIdObj, blRemoverDaLista)
    {        
    
        /*----------------------------------------------------------------
         Parametros:          
             > strIdSender = id do objeto que mandou exibir/ocultar         
             > strIdObj    = id do objeto que deverá ser ocultado
             > blRemoverDaLista = remover da lista de "elementos para fechar"
         Objetivo:
             - Minimizar ou Maximizar os Boxes (wuc)        
             - Armazenar ou não quais boxes devem permanecer fechados
         Desenvolvedor:
            ERS
         ------------------------------------------------------------------*/
        	        
        //Se existirem os Objs        
        if(document.getElementById(strIdObj) && document.getElementById(strIdSender))
        {    
            display = document.getElementById(strIdObj).style.display;
                
            //Exibindo                        
            if(display == "none")
            {
                document.getElementById(strIdObj).style.display = ""; 
                               
                document.getElementById(strIdSender).className = "bt_slider_min";               

                strIdTxtBoxFechado = fctIdentificarIdObj("txtBoxFechado");
                                                  
                //Tirando o Obj aberto da lista para fechar                
                if(document.getElementById(strIdTxtBoxFechado) && blRemoverDaLista)
                {
                    strToReplace = strIdSender + "-" + strIdObj +  ";";
                                              
                    document.getElementById(strIdTxtBoxFechado).value = document.getElementById(strIdTxtBoxFechado).value.replace(strToReplace, "")                    
                }
            }
            //Ocultando
            else
            {
                document.getElementById(strIdObj).style.display = "none";
                
                document.getElementById(strIdSender).className = "bt_slider_max";
                
                strIdTxtBoxFechado = fctIdentificarIdObj("txtBoxFechado");
                
                //Adicionando o Obj fechado na lista para fechar
                if(document.getElementById(strIdTxtBoxFechado) && blRemoverDaLista)
                {
                    document.getElementById(strIdTxtBoxFechado).value = document.getElementById(strIdTxtBoxFechado).value + strIdSender + "-" +  strIdObj  + ";";                    
                }
            }                      
        }              
    }
    
    
    function fctExibirOuEsconderGadgets(strIdSender, strIdObj, blRemoverDaLista)
    {        
    
        /*----------------------------------------------------------------
         Parametros:          
             > strIdSender = id do objeto que mandou exibir/ocultar         
             > strIdObj    = id do objeto que deverá ser ocultado             
         Objetivo:
             - Minimizar ou Maximizar os gadgets             
         Desenvolvedor:
            ERS
         ------------------------------------------------------------------*/
        
        
        //Se existirem os Objs        
        if(document.getElementById(strIdObj) && document.getElementById(strIdSender))
        {                
            display = document.getElementById(strIdObj).style.display;
                
            //Exibindo                        
            if(display == "none")
            {
                document.getElementById(strIdObj).style.display = ""; 
                               
                document.getElementById(strIdSender).className = "bt_gadget_ocultar";
                
                strIdTxtBoxFechado = fctIdentificarIdObj("txtBoxFechado");
                                                  
                //Tirando o Obj aberto da lista para fechar                
                if(document.getElementById(strIdTxtBoxFechado) && blRemoverDaLista)
                {
                    strToReplace = strIdSender + "-" + strIdObj +  ";";
                                              
                    document.getElementById(strIdTxtBoxFechado).value = document.getElementById(strIdTxtBoxFechado).value.replace(strToReplace, "")
                }
            }
            //Ocultando
            else
            {
                document.getElementById(strIdObj).style.display = "none";
                
                document.getElementById(strIdSender).className = "bt_gadget_exibir";
                
                strIdTxtBoxFechado = fctIdentificarIdObj("txtBoxFechado");
                
                //Adicionando o Obj fechado na lista para fechar
                if(document.getElementById(strIdTxtBoxFechado) && blRemoverDaLista)
                {
                    document.getElementById(strIdTxtBoxFechado).value = document.getElementById(strIdTxtBoxFechado).value + strIdSender + "-" +  strIdObj  + ";";
                }
            }                      
        }              
    }
    
    
    function fctMinMaxGadgetAreaAjustarParametros()
    {                    
        /*----------------------------------------------------------------                 
         Objetivo:
             - Ajustar os parametros para exibição             
         Desenvolvedor:
            ERS
         ------------------------------------------------------------------*/
         
        //Se existirem os Objs        
        if(document.getElementById("boxConteudoEsq") && document.getElementById("boxConteudoDir"))
        {                            
            //Txt que controla se o conteudo esquerdo estará ou não expandido
            strIdObjConteudoEsquerdoExpandido = fctIdentificarIdObj("txtConteudoEsquerdoExpandido");

            //Verificando a largura e ajustando os parametros
            if(document.getElementById("boxConteudoEsq").style.width == "" || document.getElementById("boxConteudoEsq").style.width == "510px" )
            {                                                                                                       
               document.getElementById(strIdObjConteudoEsquerdoExpandido).value = "1";
            }
            else if (document.getElementById("boxConteudoEsq").style.width == "730px")
            {                                                
                document.getElementById(strIdObjConteudoEsquerdoExpandido).value = "0";                        
            }
            
            //Mostrando o loading 
            document.getElementById("boxLoadingRedimensionamento").style.display = "";
            //Submetendo com os parametros setados
            //document.getElementById("aspnetForm").submit();                                                                                          
        }              
    }
    
    function fctMinMaxGadgetArea(show)
    {        
        /*----------------------------------------------------------------                 
         Objetivo:
             - Ler parametro e ajustar a exibição
         Desenvolvedor:
            ERS
         ------------------------------------------------------------------*/
       
       
            
        //Se existirem os Objs        
        if(document.getElementById("boxConteudoEsq") && document.getElementById("boxConteudoDir"))
        {                
            //Txt que controla se o conteudo esquerdo estará ou não expandido                   
            //strIdObjConteudoEsquerdoExpandido = fctIdentificarIdObj("txtConteudoEsquerdoExpandido");

            

            //Verificando o conteúdo
            //if(document.getElementById(strIdObjConteudoEsquerdoExpandido).value == "1" )
            if(show == 0)
            {                               
               //Expandir Esq
               document.getElementById("boxConteudoEsq").style.width = "730px";                                             
               document.getElementById("boxConteudoDir").style.display = "none";
               //document.getElementById("gadgetMinMax").className = "bt_gadget_exibir";
               
            }
            else
            {                
                //Normalizar Esq
                document.getElementById("boxConteudoEsq").style.width = "510px"; 
                document.getElementById("boxConteudoDir").style.display = ""; 
                //document.getElementById("gadgetMinMax").className = "bt_gadget_ocultar";                                                     
            }                        
                                                                  
        }              
    }
    
    function fctMinMaxGadgetAreaAjustarParametrosHome()
    {                    
        /*----------------------------------------------------------------                 
         Objetivo:
             - Ajustar os parametros para exibição             
         Desenvolvedor:
            ERS
         ------------------------------------------------------------------*/
         
        //Se existirem os Objs        
        if(document.getElementById("boxConteudoEsq") && document.getElementById("boxConteudoDir"))
        {                            
            //Txt que controla se o conteudo esquerdo estará ou não expandido
            strIdObjConteudoEsquerdoExpandido = fctIdentificarIdObj("txtConteudoEsquerdoExpandido");

            //Verificando a largura e ajustando os parametros
            if(document.getElementById("boxConteudoEsq").style.width == "" || document.getElementById("boxConteudoEsq").style.width == "510px" )
            {                                                                                                       
               document.getElementById(strIdObjConteudoEsquerdoExpandido).value = "1";
            }
            else if (document.getElementById("boxConteudoEsq").style.width == "730px")
            {                                                
                document.getElementById(strIdObjConteudoEsquerdoExpandido).value = "0";                        
            }
            
            //Mostrando o loading 
            document.getElementById("boxLoadingRedimensionamento").style.display = "";
            //Submetendo com os parametros setados
            document.getElementById("aspnetForm").submit();                                                                                          
        }              
    }
    
    function fctMinMaxGadgetAreaHome()
    {        
        /*----------------------------------------------------------------                 
         Objetivo:
             - Ler parametro e ajustar a exibição
         Desenvolvedor:
            ERS
         ------------------------------------------------------------------*/
            
        //Se existirem os Objs        
        if(document.getElementById("boxConteudoEsq") && document.getElementById("boxConteudoDir"))
        {                
            //Txt que controla se o conteudo esquerdo estará ou não expandido                   
            strIdObjConteudoEsquerdoExpandido = fctIdentificarIdObj("txtConteudoEsquerdoExpandido");

             //Detectando o nome do browser e sua versão
            var browserName    = navigator.appName; 
            var browserVersion = parseInt(navigator.appVersion); 

            //Verificando o conteudo
            if(document.getElementById(strIdObjConteudoEsquerdoExpandido).value == "1" )
            {                               
               //Expandir Esq
               document.getElementById("boxConteudoEsq").style.width = "730px";                                             
               document.getElementById("boxConteudoDir").style.display = "none";
               document.getElementById("gadgetMinMax").className = "bt_gadget_exibir";
               
               if(browserName == "Microsoft Internet Explorer" && (browserVersion >= 5 && browserVersion <= 6))
               {
                    document.getElementById("boxConteudoEsq").style.width = "700px";                                                             
               }
               
            }
            else
            {                
                //Normalizar Esq
                document.getElementById("boxConteudoEsq").style.width = "510px"; 
                document.getElementById("boxConteudoDir").style.display = ""; 
                document.getElementById("gadgetMinMax").className = "bt_gadget_ocultar";                                                     
                
               if(browserName == "Microsoft Internet Explorer" && (browserVersion >= 5 && browserVersion <= 6))
               {
                    document.getElementById("boxConteudoEsq").style.width = "510px";                                                             
               }
            }                        
                                                                  
        }              
    }

    function fctIdentificarIdObj(strIdObj)
    {        
        //procurando no Form
        for(i=0; i<= document.forms[0].elements.length -1 ; i++)
        {                       
            if(document.forms[0].elements[i].id.indexOf(strIdObj) > -1)
            {                            
                return document.forms[0].elements[i].id;    
            }                                                
        }   
                
        //procurando nas Divs        
        var divs = document.getElementsByTagName("div");                                         
                
        for(i = 0; i < divs.length - 1; i++)
        {                                                                       
            if(divs[i].getAttribute("id"))
            {                               
                  if(divs[i].getAttribute("id").indexOf(strIdObj) != -1 )                           
                      return divs[i].getAttribute("id");         
             }
        }          
        
    }
    
    
    function fctOnChangeDdlCategoria()
    {    
        strIdObj = fctIdentificarIdObj("ddlCategorias");
        
        if(document.getElementById(strIdObj))
        {
            obj = document.getElementById(strIdObj)
            index = obj.selectedIndex;
                    
            if(index > 0)
            {                    
                strUrl = "vitrineRedirecionar.aspx?idDepto=" + obj.options[index].value;
            
                window.open(strUrl, "Vitrine");  
                
                return true;          
            }   
            else
            {
                return false;
            }         
        }
    }   
    function validaCNPJ(objCNPJ, args) 
    {
        CNPJ = args.Value;
        erro = new String;

        if(CNPJ.length <14)
        {
            return args.IsValid = false;
        }

        var validaZeros = 0;

        for(var z = 0; z < CNPJ.length; z++)
        {
            if (CNPJ.charAt(z) != "0")
                validaZeros = "1";
        }

        if (validaZeros == "0")
        {
            return args.IsValid = false;
        }

        var nonNumbers = /\D/;
        if (nonNumbers.test(CNPJ)) 
            erro += "A verificacao de CNPJ suporta apenas numeros! \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]))
        {
	    return args.IsValid = false;
            //erro +="Digito verificador com problema!";
        }
        if (erro.length > 0)
        {
	    return args.IsValid = false;
            //alert(erro);
        } 
        else 
        {
	    return args.IsValid = true;
            //alert("CNPJ valido!");
        }
        return args.IsValid = true;
    }
    
    
    function fctDivBtFinalizarOcultar(objToProcess, strDivLoading)
    {
       if(document.getElementById(strDivLoading))
       {
            objToProcess.enabled = false;
            document.getElementById(strDivLoading).style.display = "";
       }          
    }    

    function fctEhCPFEhCNPJ(objStr, args)
    {
	
        var strDoc = args.Value;
             
        if(strDoc.length < 12)
        {
           if (!fctEhCPF2(objStr, args))
                return false;
        }

        if(strDoc.length > 11)
        {
            if (!validaCNPJ(objStr, args))
                return false;
        }
    }

    function CharEspecial(str) 
    {
	    if(
	        (str == '!') ||
	        (str == '@') ||
	        (str == '#') ||
	        (str == '$') ||
	        (str == '%') ||
	        (str == '^') ||
	        (str == '&') ||
	        (str == '*') ||
	        (str == '(') ||
	        (str == ')') ||
	        (str == '+') ||
	        (str == '=') ||
	        (str == '-') ||
	        (str == '[') ||
	        (str == ']') ||
	        (str == '\\') ||
	        (str == '\'') ||
	        (str == ';') ||
	        (str == ',') ||
	        (str == '.') ||
	        (str == '/') ||
	        (str == '{') ||
	        (str == '}') ||
	        (str == '|') ||
	        (str == '\"') ||
	        (str == ':') ||
	        (str == '<') ||
	        (str == '>') ||
	        (str == '?') ||
	        (str == '_')
	      ) 
	    {
		    return true;
	    }
	}

	function fctValidCharEspecial(e) {
	    var characterCode;
	    var strCaratere;

	    if (e && e.which) {
	        e = e;
	        characterCode = e.which;
	    }
	    else {
	        e = event;
	        characterCode = e.keyCode;
	    }

	        strCaratere = String.fromCharCode(characterCode);

	        if (CharEspecial(strCaratere)) {
	            return false;
	        }
	        return true;
	}


	function CharEspecialTag(str) {
	    if (
	        (str == '<') ||
	        (str == '>')
	      ) {
	        return true;
	    }
	}


	function fctValidCharEspecialTag(e) {
	    var characterCode;
	    var strCaratere;

	    if (e && e.which) {
	        e = e;
	        characterCode = e.which;
	    }
	    else {
	        e = event;
	        characterCode = e.keyCode;
	    }

	    strCaratere = String.fromCharCode(characterCode);

	    if (CharEspecialTag(strCaratere)) {
	        return false;
	    }
	    return true;
	}
  
    	//Verifica se um texto ultrapassa o limite, atribuindo
        //a qtde restante no texto de um span(contador)
        function maxLength(e, contador, limit) {
            counter = limit - e.value.length;

            if (counter <= 0) {
	        e.value = e.value.substring(0, limit);
	        counter = 0;
            }
        
            var cont = document.getElementById(contador);

            cont.innerHTML = counter;
 	}
  