var StatusNG = 0;
var StatusUP = 1;
var StatusOK = 2;
function showEachClientCheckResult() {
	//document.getElementById("browser_check").innerHTML = getBrowserStatus();    
	getCookieStatus();
    //document.getElementById("cookie_check").innerHTML  = cookie;	
	getPopupStatus("common/util/carregando.xhtml");
    //document.getElementById("popup_check").innerHTML   = popup;	
	getFlashStatus();
    //document.getElementById("flash_check").innerHTML   = flash ;   
}

function getFlashStatus() {
    var MinVer = 7;
    var status = StatusNG;
    if (navigator.plugins && navigator.plugins.length && navigator.plugins.length > 0) {
        var flashObj = navigator.plugins["Shockwave Flash"];
        if (flashObj && flashObj.length && flashObj.length > 0) {
            var flashMimeObj = flashObj["application/x-shockwave-flash"];
            if (flashMimeObj) {
                var tempStr = flashObj.description.split(" Flash ");
                var verNo = parseFloat(tempStr[1]);
                if (verNo >= MinVer) {
                    status = StatusOK;
                } else {
                    status = StatusUP;
                }
            }
        }
    }
    if (status == StatusNG) {
        for (var i = MinVer; i > 0; i--) {
            try {
                var flashObj = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
                if (i == MinVer) {
                    status = StatusOK;
                } else {
                    status = StatusUP;
                }
                break;
            } catch(e) {
                status = StatusNG;
            }
        }
    }   
    if(!status){
    	alert("Instale o adobeFlash")
    }
    return status;
}

function getPopupStatus(winUrl) {
    var status = StatusNG;
    var str_feature = 'toolbar=no'
    + ',menubar=no'
    + ',scrollbars=no'
    + ',resizable=no'
    + ',status=no'
    + ',width=1'
    + ',height=1'
    + ',top=0'
    + ',left=0'
    + ',screenX=0'
    + ',screenY=0';
    var popup_win = window.open(winUrl, "wb_check", str_feature);
    if (popup_win) {
        status = StatusOK;
    }    
    if(!status){
    	alert("Habilite o popup.");
    }
    return status;
}

function getCookieStatus() {
    var status = StatusNG;
    var cookieStr = "wb_check=kcehc_bw";
    document.cookie = cookieStr;    
    if (document.cookie.indexOf(cookieStr) > -1) {
        status = StatusOK;
        var date = new Date();
        date.setTime(date.getTime() - 1000);
        document.cookie = cookieStr + "; expires=" + date.toGMTString();        
    }
    if(!status){
    	alert("Habilite o cookie do browser");
    }
    return status;
}

function trim(s) {
    return s.replace( /^\s*/, "" ).replace( /\s*$/, "" );
}


function VerificaCPF (Objcpf) {	
	var cpf = Objcpf.value;
    exp = /\.|\-/g
    cpf = cpf.toString().replace( exp, "" );
	if (!vercpf(cpf)){		
	 alert('CPF Invalido!');
	 cpf.value = "";
	}
}
function vercpf (cpf){
if (cpf.length != 11 || cpf == "00000000000" || cpf == "11111111111" || cpf == "22222222222" || cpf == "33333333333" || cpf == "44444444444" || cpf == "55555555555" || cpf == "66666666666" || cpf == "77777777777" || cpf == "88888888888" || cpf == "99999999999")
return false;
add = 0;
for (i=0; i < 9; i ++)
add += parseInt(cpf.charAt(i)) * (10 - i);
rev = 11 - (add % 11);
if (rev == 10 || rev == 11)
rev = 0;
if (rev != parseInt(cpf.charAt(9)))
return false;
add = 0;
for (i = 0; i < 10; i ++)
add += parseInt(cpf.charAt(i)) * (11 - i);
rev = 11 - (add % 11);
if (rev == 10 || rev == 11)
rev = 0;
if (rev != parseInt(cpf.charAt(10)))
return false;
return true;
}

function trans(arg) {
   ret='';
   for (i=0;i<arg.length;i++) {
      if (arg.substr(i,2)=='&#') {
         ret=ret+String.fromCharCode(arg.substr(i+2,3));
         i=i+5;
         continue;
      }
      ret=ret+arg.substr(i,1);
   }
   return ret;
}

function marcarTodos(formId, id){
	var form = document.forms[formId];
	for(i = 0; i < form.elements.length; i++){
		if( form.elements[i].type == 'checkbox' && form.elements[i].id.indexOf(id) != -1){
			form.elements[i].checked = true;
		}
	}
}

function desmarcarTodos(formId, id){
	var form = document.forms[formId];
	for(i = 0; i < form.elements.length; i++){
		if( form.elements[i].type == 'checkbox' && form.elements[i].id.indexOf(id) != -1){
			form.elements[i].checked = false;
		}
	}
}

function validaNumericoInteiro(evnt){
	var code = evnt.keyCode ? evnt.keyCode : evnt.which ? evnt.which : evnt.charCode;
	var retorno = false;
	// verifica se é backspace, tab e delete. Se não for, verifica se é número
	if (code == 8 || code == 9 || code == 44 || code == 46) {
		retorno = true;
	} else {
	    valor = parseInt(String.fromCharCode(code));
	     if (!isNaN(valor)) {
	         retorno = true;
	     }
	}
	return retorno;
}


function inverterTodos(formId, id){
	var form = document.forms[formId];
	for(i = 0; i < form.elements.length; i++){
		if( form.elements[i].type == 'checkbox' && form.elements[i].id.indexOf(id) != -1){
			if(form.elements[i].checked){
			   form.elements[i].checked = false;			
			}else{
			   form.elements[i].checked = true;			
			}			
		}
	}
}


function getWindowWidth(){
	var myWidth = 0;
    if( typeof( window.innerWidth ) == 'number' ) {
      //Non-IE
      myWidth = window.innerWidth;
    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      //IE 6+ in 'standards compliant mode'
      myWidth = document.documentElement.clientWidth;
    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
      //IE 4 compatible
      myWidth = document.body.clientWidth;
    }
    return myWidth - 30;
}

function getWindowHeight(){
	var myHeight = 0;
    if( typeof( window.innerWidth ) == 'number' ) {
      //Non-IE
      myHeight = window.innerHeight - 50;
    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      //IE 6+ in 'standards compliant mode'
      myHeight = document.documentElement.clientHeight;
    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
      //IE 4 compatible
      myHeight = document.body.clientHeight;
    }
    return myHeight;
}

function getWindowTotalHeight(){
	var myHeight = 0;
    if( typeof( window.innerWidth ) == 'number' ) {
      //Non-IE
      myHeight = window.innerHeight + window.scrollMaxY;
    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      //IE 6+ in 'standards compliant mode'
      myHeight = document.documentElement.clientHeight + document.body.scrollHeight;
    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
      //IE 4 compatible
      myHeight = document.body.clientHeight + document.body.scrollHeight;
    }
    return myHeight - 50;
}

function getScrollY(){
	var myHeight = 0;
    if( typeof( window.innerWidth ) == 'number' ) {
      //Non-IE
      myHeight = window.scrollY;
    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      //IE 6+ in 'standards compliant mode'
      myHeight = document.documentElement.scrollTop;
    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
      //IE 4 compatible
      myHeight = document.body.scrollTop;
    }
    return myHeight;
}


//adiciona mascara de cnpj
function MascaraCNPJ(cnpj, event){
    if(validaNumericoInteiro(event)==false){
        event.returnValue = false;
        return false;
    }    
    return formataCampo(cnpj, '00.000.000/0000-00', event);
}

//adiciona mascara de cep
function MascaraCep(cep, event){
   if(validaNumericoInteiro(event)==false){
        event.returnValue = false;
        return false;
    }    
    return formataCampo(cep, '00000-000', event);
}

//adiciona mascara de data
function MascaraData(data, event){
    if(validaNumericoInteiro(event)==false){
        event.returnValue = false;
        return false;
    }    
    return formataCampo(data, '00/00/0000', event);
}

//adiciona mascara ao telefone
function MascaraTelefone(tel, event){   
    if(validaNumericoInteiro(event)==false){
    	event.returnValue = false;
    	return false;
    }    
    return formataCampo(tel, '(00) 0000-0000', event);
}
function MascaraCPFCNPJ(cpfcnpj, event){
    var vl = cpfcnpj.value;
    vl = vl.replace('.','');
    vl = vl.replace('-','');
    vl = vl.replace('/','');
    cpfcnpj.value = "";
    cpfcnpj.value = vl;
	if(vl.length < 12){
		return this.MascaraCPF(cpfcnpj,event);
	}else{
		return this.MascaraCNPJ(cpfcnpj,event);
	}
}

function MascaraPeriodo(element, event){
	if(validaNumericoInteiro(event)==false){
		event.returnValue = false;
		return false;
	}    
	return formataCampo(element, '00/0000', event);
}
//adiciona mascara ao CPF
function MascaraCPF(cpf, event){
    if(validaNumericoInteiro(event)==false){
        event.returnValue = false;
        return false;
    }    
    return formataCampo(cpf, '000.000.000-00', event);
}

//valida telefone
function ValidaTelefone(tel){
    exp = /\(\d{2}\)\ \d{4}\-\d{4}/
    if(!exp.test(tel.value))
        alert('Numero de Telefone Invalido!');
}

//valida CEP
function ValidaCep(cep){
    exp = /\d{2}\.\d{3}\-\d{3}/
    if(!exp.test(cep.value))
        alert('Numero de Cep Invalido!');        
}

//valida data
function ValidaData(data){
    exp = /\d{2}\/\d{2}\/\d{4}/
    if(!exp.test(data.value))
        alert('Data Invalida!');            
}

//valida o CPF digitado
function ValidarCPF(Objcpf){
    var cpf = Objcpf.value;
    exp = /\.|\-/g
    cpf = cpf.toString().replace( exp, "" );
    var digitoDigitado = eval(cpf.charAt(9)+cpf.charAt(10));
    var soma1=0, soma2=0;
    var vlr =11;
    
    for(i=0;i<9;i++){
        soma1+=eval(cpf.charAt(i)*(vlr-1));
        soma2+=eval(cpf.charAt(i)*vlr);
        vlr--;
    }    
    soma1 = (((soma1*10)%11)==10 ? 0:((soma1*10)%11));
    soma2=(((soma2+(2*soma1))*10)%11);
    
    var digitoGerado=(soma1*10)+soma2;
    if(digitoGerado!=digitoDigitado && digitoGerado != 0) {    
        alert('CPF Invalido!');
        Objcpf.focus();
    }
}

//valida numero inteiro com mascara
function mascaraInteiro(){
    if (event.keyCode < 48 || event.keyCode > 57){
        event.returnValue = false;
        return false;
    }
    return true;
}

//valida numero inteiro com mascara
function mascaraInteiro(event){
    if (event.keyCode < 48 || event.keyCode > 57){
        event.returnValue = false;
        return false;
    }
    return true;
}

//valida o CNPJ digitado
function ValidarCNPJ(ObjCnpj){
    var cnpj = ObjCnpj.value;
    var valida = new Array(6,5,4,3,2,9,8,7,6,5,4,3,2);
    var dig1= new Number;
    var dig2= new Number;
    
    exp = /\.|\-|\//g
    cnpj = cnpj.toString().replace( exp, "" );
    var digito = new Number(eval(cnpj.charAt(12)+cnpj.charAt(13)));
        
    for(i = 0; i<valida.length; i++){
        dig1 += (i>0? (cnpj.charAt(i-1)*valida[i]):0);    
        dig2 += cnpj.charAt(i)*valida[i];    
    }
    dig1 = (((dig1%11)<2)? 0:(11-(dig1%11)));
    dig2 = (((dig2%11)<2)? 0:(11-(dig2%11)));
    
    if(((dig1*10)+dig2) != digito)    
        alert('CNPJ Invalido!');
        
}

//formata de forma generica os campos
function formataCampo(campo, Mascara, evento) {
	var boleanoMascara;
    var Digitato = (evento.keyCode ? evento.keyCode : evento.which ? evento.which : evento.charCode);
    exp = /\-|\.|\:|\/|\(|\)| /g
    campoSoNumeros = campo.value.toString().replace(exp, "");
    var posicaoCampo = 0;
    var NovoValorCampo = "";
    var TamanhoMascara = campoSoNumeros.length;
    ;

    if (Digitato != 9 && Digitato != 8 && Digitato != 32) { // backspace
        for (i = 0; i <= TamanhoMascara; i++) {
            boleanoMascara = ((Mascara.charAt(i) == "-") || (Mascara.charAt(i) == ".")
                    || (Mascara.charAt(i) == "/") || (Mascara.charAt(i) == ":"))
            boleanoMascara = boleanoMascara || ((Mascara.charAt(i) == "(")
                    || (Mascara.charAt(i) == ")") || (Mascara.charAt(i) == " "))
            if (boleanoMascara) {
                NovoValorCampo += Mascara.charAt(i);
                TamanhoMascara++;
            } else {
                NovoValorCampo += campoSoNumeros.charAt(posicaoCampo);
                posicaoCampo++;
            }
        }
        campo.value = NovoValorCampo;
        return true;
    } else {
        return true;
    }
}
function mascaraCep(objeto){
       if (objeto.value.indexOf("-") == -1 && objeto.value.length > 5){ objeto.value = ""; }
       if (objeto.value.length == 5){
           objeto.value += "-";
       }
    }

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 ) ;}
} 
}    


function MascaraMoeda(objTextBox, SeparadorMilesimo, SeparadorDecimal, e){
    var sep = 0;
    var key = '';
    var i = j = 0;
    var len = len2 = 0;
    var strCheck = '0123456789';
    var aux = aux2 = '';
    var whichCode = (window.Event) ? e.which : e.keyCode;
    if (whichCode == 13) return true;
    key = String.fromCharCode(whichCode); // Valor para o cÃ³digo da Chave
    if (strCheck.indexOf(key) == -1) return false; // Chave invÃ¡lida
    len = objTextBox.value.length;
    for(i = 0; i < len; i++)
        if ((objTextBox.value.charAt(i) != '0') && (objTextBox.value.charAt(i) != SeparadorDecimal)) break;
    aux = '';
    for(; i < len; i++)
        if (strCheck.indexOf(objTextBox.value.charAt(i))!=-1) aux += objTextBox.value.charAt(i);
    aux += key;
    len = aux.length;
    if (len == 0) objTextBox.value = '';
    if (len == 1) objTextBox.value = '0'+ SeparadorDecimal + '0' + aux;
    if (len == 2) objTextBox.value = '0'+ SeparadorDecimal + aux;
    if (len > 2) {
        aux2 = '';
        for (j = 0, i = len - 3; i >= 0; i--) {
            if (j == 3) {
                aux2 += SeparadorMilesimo;
                j = 0;
            }
            aux2 += aux.charAt(i);
            j++;
        }
        objTextBox.value = '';
        len2 = aux2.length;
        for (i = len2 - 1; i >= 0; i--)
        objTextBox.value += aux2.charAt(i);
        objTextBox.value += SeparadorDecimal + aux.substr(len - 2, len);
    }
    return false;
}

///////////


<!-- onKeyPress="return(FormataReais(this,'.',',',event))"  -->
function FormataReais(fld, milSep, decSep, e) {
var sep = 0;
var key = '';
var i = j = 0;
var len = len2 = 0;
var strCheck = '0123456789';
var aux = aux2 = '';
var whichCode = (window.Event) ? e.which : e.keyCode;
if (whichCode == 13) return true;
key = String.fromCharCode(whichCode);  // Valor para o cï¿½digo da Chave
if (strCheck.indexOf(key) == -1) return false;  // Chave invï¿½lida
len = fld.value.length;
for(i = 0; i < len; i++)
if ((fld.value.charAt(i) != '0') && (fld.value.charAt(i) != decSep)) break;
aux = '';
for(; i < len; i++)
if (strCheck.indexOf(fld.value.charAt(i))!=-1) aux += fld.value.charAt(i);
aux += key;
len = aux.length;
if (len == 0) fld.value = '';
if (len == 1) fld.value = '0'+ decSep + '0' + aux;
if (len == 2) fld.value = '0'+ decSep + aux;
if (len > 2) {
aux2 = '';
for (j = 0, i = len - 3; i >= 0; i--) {
if (j == 3) {
aux2 += milSep;
j = 0;
}
aux2 += aux.charAt(i);
j++;
}
fld.value = '';
len2 = aux2.length;
for (i = len2 - 1; i >= 0; i--)
fld.value += aux2.charAt(i);
fld.value += decSep + aux.substr(len - 2, len);
}
return false;
}



//Formata valor
//ex.: onKeyDown='FormataValor("valor", 13, event)
//Obs.: "valor" ï¿½ o nome do campo, 13 o tamanho mï¿½ximo permitido de carac. do campo e event ï¿½ a tecla pressionada'
function FormataValor(obj,tammax,teclapres) {
 var tecla = teclapres.keyCode;
 vr = obj.value;
 vr = vr.replace( "/", "" );
 vr = vr.replace( "/", "" );
 vr = vr.replace( ",", "" );
 vr = vr.replace( ",", "" );
 vr = vr.replace( ".", "" );
 vr = vr.replace( ".", "" );
 vr = vr.replace( ".", "" );
 vr = vr.replace( ".", "" );
 //Replaces adicionais
 //vr = vr.replace( "-", "" );
 //vr = vr.replace( "+", "" );
 //vr = vr.replace( "*", "" );
 tam = vr.length;
 
 alert('Teste formataValor');
 
 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 <= 2 ){ 
   obj.value = vr ; }
  if ( (tam > 2) && (tam <= 5) ){
   obj.value = vr.substr( 0, tam - 2 ) + ',' + vr.substr( tam - 2, tam ) ; }
  if ( (tam >= 6) && (tam <= 8) ){
   obj.value = vr.substr( 0, tam - 5 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
  if ( (tam >= 9) && (tam <= 11) ){
   obj.value = vr.substr( 0, tam - 8 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
  if ( (tam >= 12) && (tam <= 14) ){
   obj.value = vr.substr( 0, tam - 11 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
  if ( (tam >= 15) && (tam <= 17) ){
   obj.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 ) ;}
 }
}

//Java Script do Louco
//onchange="javascript:numberTextBoxOnChange(this);" 
//onblur="javascript:numberTextBoxOnChange(this);" 
//onkeyup="return numberTextBoxOnKeyUp(this,event)" 
//onkeydown="return numberTextBoxOnKeyDown(this,event)"
// Validacao Numeros
function numberTextBoxOnChange(elem) { 
num = elem.value;
num = num.toString().replace(/\$|\,/g,'');
num = num.toString().replace(/\$|\./g,'.');
//alert('numberTextBoxOnChange');
if(isNaN(num))
{
    num = "0";
    elem.value = "";
}
else
{
    if (num.indexOf('.') == -1) num = num / 100; 
    sign = (num == (num = Math.abs(num)));
    num = Math.floor(num*100+0.50000000001);
    cents = num%100;
    num = Math.floor(num/100).toString();
    if(cents<10)
    cents = "0" + cents;
    for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
    num = num.substring(0,num.length-(4*i+3))+''+
    num.substring(num.length-(4*i+3));
    elem.value = (((sign)?'':'-') + num + '.' + cents);
}
 } 
 
 function numberTextBoxOnKeyDown(input, e)
 {
	var KeyID = (window.event) ? event.keyCode : e.keyCode; 
	//alert('numberTextBoxOnKeyDown');
	if( (KeyID == 8) || (KeyID == 46) ){
		//var input = this;
		var num = input.value; 
		num = num.toString().replace(/\$|\./g,'');
		num = num.toString().replace(/\$|\,/g,'');
       num = num.toString().replace(/^0+|0\,0+/,"");
			if(!isNaN(num)){ 
				num = num.toString().substring(0,num.length - 1);
               num = num / 100.0;
				
				if (num == 0)
					input.value = "";
				else
				{
					sign = (num == (num = Math.abs(num)));
					num = Math.floor(num*100+0.50000000001);
					cents = num%100;
					num = Math.floor(num/100).toString();
					if(cents<10)
					cents = "0" + cents;
					for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
					num = num.substring(0,num.length-(4*i+3))+''+
					num.substring(num.length-(4*i+3));
					input.value = (((sign)?'':'-') + num + '.' + cents);
				}
				return false;
			}
			else
				return Bloqueia_Caracteres((window.event) ? event : e);
	}
	else
		return Bloqueia_Caracteres((window.event) ? event : e);
 }
 
function numberTextBoxOnKeyUp(input, e){ 
var KeyID = (window.event) ? event.keyCode : e.keyCode;
//alert('numberTextBoxOnKeyUp'); 
if ( (KeyID >= '0'.charCodeAt(0) && KeyID <= '9'.charCodeAt(0))  || (KeyID >= 96 && KeyID <= 105) ) { 
//var input = this;
var num = input.value; 
num = num.toString().replace(/\$|\./g,'.');
num = num.toString().replace(/\$|\,/g,'.');
if(!isNaN(num)){ 
	if (num.toString().indexOf('.') == -1)
		num = num / 100.0;
	else
		num = num * 10.0;
num = Math.round(num * 100.0)/100.0;
temp = num.toString().split('.'); //Backspace == 8
if (temp.length < 2)
	num = num + ".00";
else if (temp[1].length == 1)
	num = num + "0";
num = num.toString();
if(num.indexOf('.') > -1){  
num = num.split('.'); 
num[0] = num[0].toString().split('').reverse().join('').replace(/(?=\d*\.?)(\d{3})/g,'$1,').split('').reverse().join('').replace(/^[\,]/,''); 
if(num[1].length > 2){  
num[1] = num[1].substring(0,num[1].length-1); 
}  input.value = num[0]+'.'+num[1];         
} else{ input.value = num.toString().split('').reverse().join('').replace(/(?=\d*\.?)(\d{3})/g,'$1,').split('').reverse().join('').replace(/^[\,]/,'') }; 
input.value = input.value.replace('.','x').replace(',','').replace('x','.'); 
} 
else{ 
input.value = input.value.substring(0,input.value.length-1); 
} 
} 
} 

if (navigator.appName.indexOf('Microsoft') != -1){
	clientNavigator = "IE";
}else{
	clientNavigator = "Other";
}
function Bloqueia_Caracteres(evnt){
 //Funï¿½ï¿½o permite digitaï¿½ï¿½o de nï¿½meros
 	if (clientNavigator == "IE"){
 		if( ( (evnt.keyCode > 32 && evnt.keyCode < 48) || (evnt.keyCode > 57 && evnt.keyCode < 248) ) && !(evnt.keyCode >= 96 && evnt.keyCode <= 105) ){
 			return false;
 		}
 	}else{
 		if( ( (evnt.charCode > 32 && evnt.charCode < 48) || (evnt.charCode > 57 && evnt.charCode < 248) ) && !(evnt.charCode >= 96 && evnt.charCode <= 105) ){
 			return false;
 		}
 	}
	return true;
}
//////////////////

/**
 * functions para esconder COMBOS para IE6 ao usar os menus.
 */
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
}
function changeCombosDisplay(display){
	var selects=document.getElementsByTagName('select');
	for(var i=0;i<selects.length;i++){
		selects[i].style.display = display;
	}
}
function hideCombos(){
	if(navigator.userAgent.toLowerCase().indexOf('msie 6') != -1) {
		changeCombosDisplay('none');
	}
}
function showCombos(){
	if(navigator.userAgent.toLowerCase().indexOf('msie 6') != -1) {
		changeCombosDisplay('');
	}
}
//addLoadEvent(hideCombos); 
