//***********************************************************************************//
//                             Função que p/ requisições ajax                        //
//***********************************************************************************//
function ajaxInit() {
 var req;
 
 try {
  req = new ActiveXObject("Microsoft.XMLHTTP");
 } catch(e) {
  try {
   req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch(ex) {
   try {
    req = new XMLHttpRequest();
   } catch(exc) {
    alert("Esse browser não tem recursos para uso do Ajax");
    req = null;
   }
  }
 }
 
 return req;
}

//***********************************************************************************//
//                   Função  GET / document.getElementById(elemento)                 //
//***********************************************************************************//
function get(elemento){
	return document.getElementById(elemento);
}

//***********************************************************************************//
//                                  Função busca_cep                                 //
//***********************************************************************************//
function buscar_cep() {
 if (get('campoCEPajax').value == ""){
	window.alert('Por favor forneça um CEP válido');
 }
else{ 
 var ajax = ajaxInit();
  if(ajax) 
  {
	ajax.open("GET", "Scripts/cep.asp?cep="+ get('campoCEPajax').value, true);
	get("resultado").innerHTML = "<label>CEP</label><br /><input type='text' name='campoCEP' id='iendereco' onkeypress='mascara(this,cep)' value='"+get('campoCEPajax').value+"' onblur='buscar_cep()' /><img src='loadingMini.gif' alt='carregando...' /><br />"+
	"<label>Endere&ccedil;o</label><br /><input type='text' name='iendereco' id='iendereco' value=''/><img src='loadingMini.gif' alt='carregando...' /><br />"+
	"<label>Complemento/Numero</label><br /><input type='text' name='icomplemento' id='icomplemento' value=''/><img src='loadingMini.gif' alt='carregando...' /><br />"+
	"<label>Bairro</label><br /><input type='text' name='ibairro' id='ibairro' value=''/><img src='loadingMini.gif' alt='carregando...' /><br />"+
	"<label>Cidade</label><br /><input type='text' name='icidade' id='icidade' value=''/><img src='loadingMini.gif' alt='carregando...' /><br />"+
	"<label>Estado</label><br /><input type='text' name='iuf' id='iuf' value=''/><img src='loadingMini.gif' alt='carregando...' /><br />";

	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=iso-8859-1");
	ajax.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
	ajax.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
	ajax.setRequestHeader("Pragma", "no-cache");
    ajax.onreadystatechange = function() {
      if(ajax.readyState == 4) 
	  {
        if(ajax.status == 200) 
		{
          get("resultado").innerHTML = ajax.responseText;
        } 
		else 
		{
          alert(ajax.statusText);
        }
      } //if(ajax.readyState == 4)
    } //ajax.onreadystatechange = function()
    ajax.send(null);
  }//if(ajax) 
 }//if (get('campoCEPajax').value == "")
}//function buscar_cep() {






//***********************************************************************************//
//                   máscara em campos de formulário simples e crossbrowser          //
//***********************************************************************************//

function mascara(o,f){
    v_obj=o
    v_fun=f
    setTimeout("execmascara()",1)
}

function execmascara(){
    v_obj.value=v_fun(v_obj.value)
}

function leech(v){
    v=v.replace(/o/gi,"0")
    v=v.replace(/i/gi,"1")
    v=v.replace(/z/gi,"2")
    v=v.replace(/e/gi,"3")
    v=v.replace(/a/gi,"4")
    v=v.replace(/s/gi,"5")
    v=v.replace(/t/gi,"7")
    return v
}

function soNumeros(v){
    return v.replace(/\D/g,"")
}
// <input id="itelefone" onkeypress="mascara(this,telefone)" maxlength="14" /></label>
function telefone(v){
    v=v.replace(/\D/g,"")                 //Remove tudo o que não é dígito
    v=v.replace(/^(\d\d)(\d)/g,"($1) $2") //Coloca parênteses em volta dos dois primeiros dígitos
    v=v.replace(/(\d{4})(\d)/,"$1-$2")    //Coloca hífen entre o quarto e o quinto dígitos
    return v
}


function telep(v){
    v=v.replace(/\D/g,"")                 //Remove tudo o que não é dígito
    v=v.replace(/^(\d\d)(\d)/g,"($1) $2") //Coloca parênteses em volta dos dois primeiros dígitos
    v=v.replace(/(\d{4})(\d)/,"$1-$2")    //Coloca hífen entre o quarto e o quinto dígitos
    return v
}


function ddata(v){
    v=v.replace(/\D/g,"")                 //Remove tudo o que não é dígito
    v=v.replace(/(\d{2})(\d)/,"$1/$2")    //Coloca hífen entre o quarto e o quinto dígitos
	v=v.replace(/(\d{2})(\d)/,"$1/$2")    //Coloca hífen entre o quarto e o quinto dígitos
    return v
}


function cpf(v){
    v=v.replace(/\D/g,"")                    //Remove tudo o que não é dígito
    v=v.replace(/(\d{3})(\d)/,"$1.$2")       //Coloca um ponto entre o terceiro e o quarto dígitos
    v=v.replace(/(\d{3})(\d)/,"$1.$2")       //Coloca um ponto entre o terceiro e o quarto dígitos
                                             //de novo (para o segundo bloco de números)
    v=v.replace(/(\d{3})(\d{1,2})$/,"$1-$2") //Coloca um hífen entre o terceiro e o quarto dígitos
    return v
}

function cccpf(v){
    v=v.replace(/\D/g,"")                    //Remove tudo o que não é dígito
    v=v.replace(/(\d{3})(\d)/,"$1.$2")       //Coloca um ponto entre o terceiro e o quarto dígitos
    v=v.replace(/(\d{3})(\d)/,"$1.$2")       //Coloca um ponto entre o terceiro e o quarto dígitos
                                             //de novo (para o segundo bloco de números)
    v=v.replace(/(\d{3})(\d{1,2})$/,"$1-$2") //Coloca um hífen entre o terceiro e o quarto dígitos
    return v
}

function cep(v){
    v=v.replace(/\D/g,"")               //Remove tudo o que não é dígito
    v=v.replace(/^(\d{5})(\d)/,"$1-$2") //Esse é tão fácil que não merece explicações
    return v
}

function cccep(v){
    v=v.replace(/\D/g,"")               //Remove tudo o que não é dígito
    v=v.replace(/^(\d{5})(\d)/,"$1-$2") //Esse é tão fácil que não merece explicações
    return v
}

function cnpj(v){
    v=v.replace(/\D/g,"")                           //Remove tudo o que não é dígito
    v=v.replace(/^(\d{2})(\d)/,"$1.$2")             //Coloca ponto entre o segundo e o terceiro dígitos
    v=v.replace(/^(\d{2})\.(\d{3})(\d)/,"$1.$2.$3") //Coloca ponto entre o quinto e o sexto dígitos
    v=v.replace(/\.(\d{3})(\d)/,".$1/$2")           //Coloca uma barra entre o oitavo e o nono dígitos
    v=v.replace(/(\d{4})(\d)/,"$1-$2")              //Coloca um hífen depois do bloco de quatro dígitos
    return v
}

function cccnpj(v){
    v=v.replace(/\D/g,"")                           //Remove tudo o que não é dígito
    v=v.replace(/^(\d{2})(\d)/,"$1.$2")             //Coloca ponto entre o segundo e o terceiro dígitos
    v=v.replace(/^(\d{2})\.(\d{3})(\d)/,"$1.$2.$3") //Coloca ponto entre o quinto e o sexto dígitos
    v=v.replace(/\.(\d{3})(\d)/,".$1/$2")           //Coloca uma barra entre o oitavo e o nono dígitos
    v=v.replace(/(\d{4})(\d)/,"$1-$2")              //Coloca um hífen depois do bloco de quatro dígitos
    return v
}


function romanos(v){
    v=v.toUpperCase()             //Maiúsculas
    v=v.replace(/[^IVXLCDM]/g,"") //Remove tudo o que não for I, V, X, L, C, D ou M
    //Essa é complicada! Copiei daqui: http://www.diveintopython.org/refactoring/refactoring.html
    while(v.replace(/^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/,"")!="")
        v=v.replace(/.$/,"")
    return v
}

function site(v){
    //Esse sem comentarios para que você entenda sozinho ;-)
    v=v.replace(/^http:\/\/?/,"")
    dominio=v
    caminho=""
    if(v.indexOf("/")>-1)
        dominio=v.split("/")[0]
        caminho=v.replace(/[^\/]*/,"")
    dominio=dominio.replace(/[^\w\.\+-:@]/g,"")
    caminho=caminho.replace(/[^\w\d\+-@:\?&=%\(\)\.]/g,"")
    caminho=caminho.replace(/([\?&])=/,"$1")
    if(caminho!="")dominio=dominio.replace(/\.+$/,"")
    v="http://"+dominio+caminho
    return v
}

//***********************************************************************************//
//                             Funçoes mostra/esconde item                            //
//***********************************************************************************//
 
function mostraitem(id){
	var idatual = document.getElementById(id);
	if(typeof(idatual)!="undefined"){
		if(idatual.style.display=='none')
			idatual.style.display='';
		else
			idatual.style.display='none';
	} 
}

function mostraCep(){
	elemento = get('cepOk');
	if(elemento.style.display == 'none'){
		elemento.style.display = '';
	} else {
		elemento.style.display = 'none';
	}
}

function digitarEnd() {
	get('digitarEnd').style.display ='block';
	get('usarAjax').style.display ='none';
}

function usarAjax() {
	get('digitarEnd').style.display ='none';
	get('usarAjax').style.display ='block';
}


// *******************************************
// Inicios Scripts Frango
//******************************************

//Submete o form apost confirmação
function getDelete(frm){
	if(confirm('Confirmar exclusão de registro?')){
			document.getElementById(frm).submit();
	}else{
		return false
	}
}

function hora(obj){
	obj.onkeyup=function(){obj.value=numberOnly(obj.value);}
	obj.onkeypress=function(){
		if(obj.value.length == 2)obj.value+=':';
	}
	obj.maxLength=5;
}


function numberOnly(va){
	if(isNaN(va.charAt(va.length-1)))va=va.substr(0,va.length-1);
	return va;
}

function setMaskDate(obj){
	obj.onkeyup=function(){obj.value=numberOnly(obj.value);}
	obj.onkeypress=function(){
		if(obj.value.length==5 || obj.value.length == 2)obj.value+='/';
	}
	obj.maxLength=10;
}

//Utilizado para exibir ou ocultar um Iframe, definindo dimençao e url
function showHideDiv(act,url){
	if (act!='hide'){obj = document.getElementById("fWin");}else{obj = parent.document.getElementById("fWin");}
	
	if(obj.style.display!="none" && act=="hide"){
		obj.style.display="none";
		parent.location = url;
	}else{
		obj.style.display="block";
		if(document.all){
			obj.style.top = event.y-18+"px";
			obj.style.left = event.x+10+"px";
		}
	}
}

//Redimenciona o frame de acordo com o conteudo exibido
function moveFrame(){
	if(!document.all){
		opusu=document.getElementsByName('opusu');
		fWin=document.getElementById('fWin');
		for(i=0;i<opusu.length;i++){
			opusu[i].onmouseup=function(ev){
				fWin.style.top = (ev.pageY-18)+"px";
				fWin.style.left = (ev.pageX+10)+"px";
			}
		}
	}
	if(!document.getElementById('fWin')){
		tab=document.getElementsByTagName('table')[0];
		h=tab.clientHeight+5;
		w=tab.clientWidth;
		if(!document.all){
			parent.document.getElementById('fWin').style.width=w+'px';
			parent.document.getElementById('fWin').style.height=h+'px';
		}else
			parent.fWin.resizeTo(w,h);
	}
}

//Utilizado para marcar todas as chekbox agrupadas em um objeto
function CA(grp,chkAll){
	for(var i=0;i<document.getElementById(grp).getElementsByTagName("input").length;i++){
		var e=document.getElementById(grp).getElementsByTagName("input")[i];
		if ((e.name != chkAll) && (e.type=="checkbox")){
			e.checked=document.getElementById(chkAll).checked;
		}
	}
}

//Usado para ocultar ou mostrar campos de senha no modo de edição do form
function showHideSenha(grp,txt1,txt2,bt){
	grp  = document.getElementById(grp);
	txt1 = document.getElementById(txt1);
	txt2 = document.getElementById(txt2);
	if(grp.style.display=='none'){
		grp.style.display='block';
		bt.value='Cancelar troca de senha.';
	}else{
		grp.style.display='none';
		txt1.value = "";
		txt2.value = "";
		bt.value='Trocar senha.';
	}
}

//Motra linhas da tabela
function showHideRows(obj,args){
	args=args.split(',');
	if(obj.form.altS.value==1){
		for(i=0;i<args.length;i++){
			if(window.opera || !document.all)
				document.getElementById(args[i]).style.display='none';
			else
				eval(args[i]).style.display='none';
		}
		obj.form.altS.value=0;
		obj.value='Trocar Senha';
	}else{
		for(i=0;i<args.length;i++){
			if(window.opera || !document.all)
				document.getElementById(args[i]).style.display='table-row';
			else
				eval(args[i]).style.display='block';
		}
		obj.form.altS.value=1;
		obj.value='cancelar';
	}
	moveFrame()
}

//window.onload=function(){
//	moveFrame();	
//}

<!--
//--------------------------------------------------------------------------------------//
//							Livraria JavaScript -                   					//
//							 Programador Eduardo Perotta de Almeida						//
//									 perottas1@hotmail.com								//
//--------------------------------------------------------------------------------------//
//
function validanews(){
	if (document.newsletter.nome.value == "" || document.newsletter.nome.value == "cadastre seu nome"){
		window.alert('Favor informar seu nome.');
		document.newsletter.nome.focus();
		return (false);
	}
	else if (document.newsletter.email.value == "" || document.newsletter.email.value == "cadastre seu e-mail") {
		window.alert('Favor informar seu e-mail.');
		document.newsletter.email.focus();
		return (false);
	}
	else
		document.newsletter.submit;
}

// ---------------------------------VERIFICA FORMATO EMAIL-------------------------------
function verifica_email_news()
{
	if ((document.newsletter.email.value).length > 0)
	{
		if (!/^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/.test(document.newsletter.email.value))
		{
			alert('E-mail incorreto.');
			document.newsletter.email.focus();
			return false;
		}

	}
}
function verifica_email()
{
	if ((document.form.email.value).length > 0)
	{
		if (!/^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/.test(document.form.email.value))
		{
			alert('E-mail incorreto.');
			document.form.email.focus();
			return false;
		}

	}
}




function checa_cpf(CPF) {
var mensagem = "informe corretamente o número do CPF"
var msg = "";
if (CPF.length != 11 || CPF == "00000000000" || CPF == "11111111111" ||
  CPF == "22222222222" ||	CPF == "33333333333" || CPF == "44444444444" ||
  CPF == "55555555555" || CPF == "666.666.666-66" || CPF == "77777777777" ||
  CPF == "88888888888" || CPF == "99999999999")
msg = mensagem;
soma = 0;
for (y=0; y < 9; y ++)
soma += parseInt(CPF.charAt(y)) * (10 - y);
resto = 11 - (soma % 11);
if (resto == 10 || resto == 11)resto = 0;
if (resto != parseInt(CPF.charAt(9)))
  msg = mensagem; soma = 0;
for (y = 0; y < 10; y ++)
  soma += parseInt(CPF.charAt(y)) * (11 - y);
resto = 11 - (soma % 11);
if (resto == 10 || resto == 11) resto = 0;
if (resto != parseInt(CPF.charAt(10)))
  msg = mensagem;
return msg;
}
function checa_cnpj(s) {
var mensagem = "informe corretamente o número do CNPJ"
var msg = "";
var y;
var c = s.substr(0,12);
var dv = s.substr(12,2);
var d1 = 0;
for (y = 0; y < 12; y++)
{
d1 += c.charAt(11-y)*(2+(y % 8));
}
if (d1 == 0) msg = mensagem;
d1 = 11 - (d1 % 11);
if (d1 > 9) d1 = 0;
if (dv.charAt(0) != d1)msg = mensagem;
d1 *= 2;
for (y = 0; y < 12; y++)
{
d1 += c.charAt(11-y)*(2+((y+1) % 8));
}
d1 = 11 - (d1 % 11);
if (d1 > 9) d1 = 0;
if (dv.charAt(1) != d1) msg = mensagem;
return msg;
}

function FormataReal(nvalor){
nvalor = nvalor.replace(".","");
nvalor = nvalor.replace(",",".");
return nvalor;
}
function FormataRealn(nvalor){
nvalor = nvalor.replace(".",",");
nvalor = nvalor.replace(",",".");
return nvalor;
}
function FormataValor(objeto,teclapres,tammax,decimais) 
{
	var tecla			= teclapres.keyCode;
	var tamanhoObjeto	= objeto.value.length;
	if ((tecla == 8) && (tamanhoObjeto == tammax))
	{
		tamanhoObjeto = tamanhoObjeto - 1 ;
	}
    if (( tecla == 8 || tecla == 88 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ) && ((tamanhoObjeto+1) <= tammax))
	{
		vr	= objeto.value;
		vr	= vr.replace( "/", "" );
		vr	= vr.replace( "/", "" );
		vr	= vr.replace( ",", "" );
		vr	= vr.replace( ".", "" );
		vr	= vr.replace( ".", "" );
		vr	= vr.replace( ".", "" );
		vr	= vr.replace( ".", "" );
		tam	= vr.length;
		if (tam < tammax && tecla != 8)
		{
			tam = vr.length + 1 ;
		}
		if ((tecla == 8) && (tam > 1))
		{
			tam = tam - 1 ;
			vr = objeto.value;
			vr = vr.replace( "/", "" );
			vr = vr.replace( "/", "" );
			vr = vr.replace( ",", "" );
			vr = vr.replace( ".", "" );
			vr = vr.replace( ".", "" );
			vr = vr.replace( ".", "" );
			vr = vr.replace( ".", "" );
		}
		if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 )
		{
			if (decimais > 0)
			{
				if ( (tam <= decimais) )
				{ 
					objeto.value = ("0," + vr) ;
				}
				if( (tam == (decimais + 1)) && (tecla == 8))
				{
					objeto.value = vr.substr( 0, (tam - decimais)) + ',' + vr.substr( tam - (decimais), tam ) ;	
				}
				if ( (tam > (decimais + 1)) && (tam <= (decimais + 3)) &&  ((vr.substr(0,1)) == "0"))
				{
					objeto.value = vr.substr( 1, (tam - (decimais+1))) + ',' + vr.substr( tam - (decimais), tam ) ;
				}
				if ( (tam > (decimais + 1)) && (tam <= (decimais + 3)) &&  ((vr.substr(0,1)) != "0"))
				{
				    objeto.value = vr.substr( 0, tam - decimais ) + ',' + vr.substr( tam - decimais, tam ) ; 
				}
				if ( (tam >= (decimais + 4)) && (tam <= (decimais + 6)) )
				{
			 		objeto.value = vr.substr( 0, tam - (decimais + 3) ) + '.' + vr.substr( tam - (decimais + 3), 3 ) + ',' + vr.substr( tam - decimais, tam ) ;
				}
			 	if ( (tam >= (decimais + 7)) && (tam <= (decimais + 9)) )
				{
			 		objeto.value = vr.substr( 0, tam - (decimais + 6) ) + '.' + vr.substr( tam - (decimais + 6), 3 ) + '.' + vr.substr( tam - (decimais + 3), 3 ) + ',' + vr.substr( tam - decimais, tam ) ;
				}
				if ( (tam >= (decimais + 10)) && (tam <= (decimais + 12)) )
				{
			 		objeto.value = vr.substr( 0, tam - (decimais + 9) ) + '.' + vr.substr( tam - (decimais + 9), 3 ) + '.' + vr.substr( tam - (decimais + 6), 3 ) + '.' + vr.substr( tam - (decimais + 3), 3 ) + ',' + vr.substr( tam - decimais, tam ) ;
				}
				if ( (tam >= (decimais + 13)) && (tam <= (decimais + 15)) )
				{
			 		objeto.value = vr.substr( 0, tam - (decimais + 12) ) + '.' + vr.substr( tam - (decimais + 12), 3 ) + '.' + vr.substr( tam - (decimais + 9), 3 ) + '.' + vr.substr( tam - (decimais + 6), 3 ) + '.' + vr.substr( tam - (decimais + 3), 3 ) + ',' + vr.substr( tam - decimais, tam ) ;
				}
			}
			else if(decimais == 0)
			{
				if ( tam <= 3 )
				{ 
			 		objeto.value = vr ;
				}
				if ( (tam >= 4) && (tam <= 6) )
				{
					if(tecla == 8)
					{
						objeto.value = vr.substr(0, tam);
						window.event.cancelBubble = true;
						window.event.returnValue = false;
					}
					objeto.value = vr.substr(0, tam - 3) + '.' + vr.substr( tam - 3, 3 ); 
				}
				if ( (tam >= 7) && (tam <= 9) )
				{
					if(tecla == 8)
					{
						objeto.value = vr.substr(0, tam);
						window.event.cancelBubble = true;
						window.event.returnValue = false;
					}
					objeto.value = vr.substr( 0, tam - 6 ) + '.' + vr.substr( tam - 6, 3 ) + '.' + vr.substr( tam - 3, 3 ); 
				}
				if ( (tam >= 10) && (tam <= 12) )
				{
			 		if(tecla == 8)
					{
						objeto.value = vr.substr(0, tam);
						window.event.cancelBubble = true;
						window.event.returnValue = false;
					}
					objeto.value = vr.substr( 0, tam - 9 ) + '.' + vr.substr( tam - 9, 3 ) + '.' + vr.substr( tam - 6, 3 ) + '.' + vr.substr( tam - 3, 3 ); 
				}

				if ( (tam >= 13) && (tam <= 15) )
				{
					if(tecla == 8)
					{
						objeto.value = vr.substr(0, tam);
						window.event.cancelBubble = true;
						window.event.returnValue = false;
					}
					objeto.value = vr.substr( 0, tam - 12 ) + '.' + vr.substr( tam - 12, 3 ) + '.' + vr.substr( tam - 9, 3 ) + '.' + vr.substr( tam - 6, 3 ) + '.' + vr.substr( tam - 3, 3 ) ;
				}			
			}
		}
	}
	else if((window.event.keyCode != 8) && (window.event.keyCode != 9) && (window.event.keyCode != 13) && (window.event.keyCode != 35) && (window.event.keyCode != 36) && (window.event.keyCode != 46))
		{
			window.event.cancelBubble = true;
			window.event.returnValue = false;
		}
}
function manipulaelemento(objetotela, acao) {
	var objetotela = get(objetotela);
	if (acao == "o"){objetotela.style.display = "none";} // oculta
	if (acao == "e"){objetotela.style.display = "block";} // exibe
	if (acao == "l"){objetotela.value = "";} // limpa value
}

function somarinput(input){
		document.getElementById(input).value=Number(document.getElementById(input).value)+1;
}
function subtrairinput(input){
if (Number(document.getElementById(input).value)>0){
		document.getElementById(input).value=Number(document.getElementById(input).value)-1;
	}
}

function time()
    {
        var hoje = new Date();
        var hrs = hoje.getHours();
        var min = hoje.getMinutes();
        var secs = hoje.getSeconds();
        
        var alsohrs = hoje.getHours();
        var NumeroDia = hoje.getDate();
        var ano = hoje.getFullYear();
        
        var ampm="";
        var zero="0";
        var mes = hoje.getMonth();
        var diasemana = hoje.getDay();
        
        var dsn = new Array(7)
        dsn[0] = "DOM";
        dsn[1] = "SEG";
        dsn[2] = "TER";
        dsn[3] = "QUA";
        dsn[4] = "QUI";
        dsn[5] = "SEX";
        dsn[6] = "SÁB";
        
        var mn = new Array(12)
        mn[0] = "JAN";
        mn[1] = "FEV";
        mn[2] = "MAR";
        mn[3] = "ABR";
        mn[4] = "MAI";
        mn[5] = "JUN";
        mn[6] = "JUL";
        mn[7] = "AGO";
        mn[8] = "SET";
        mn[9] = "OUT";
        mn[10] = "NOV";
        mn[11] = "DEZ";
        
        if (min<10)
            {
                min=zero+min;
            }
        if (secs<10)
            {
                secs=zero+secs;
            }
        
        if (hrs>12)
            {
                hrs=eval(hrs - 12);
            }
        if (hrs>=0 && hrs<1)
            {
                hrs=12;
            }
        
        if (alsohrs>=12 && alsohrs<24)
            {
                ampm="P.M.";
            }
        else
            {
                ampm="A.M.";
            }
        
        
        tmp='<div style="float:left;" class="clock">';
        tmp+=hrs+'<span id="blinker" style=" font-size:11px;">:</span>'+min;
        tmp+='<font size="11"> '+secs+'</font><font size="11"> '+ampm+'</font>';
        tmp+='<div>';
        document.getElementById("relogiodigital").innerHTML=tmp;
        horariodorelogio=setTimeout("time()","1000");
}


function blink()
    {
        var obj = document.getElementById("blinker");
        if (obj.style.visibility == "visible") 
            {
                obj.style.visibility="hidden";
            }
        else
            {
                obj.style.visibility="visible";
            }
        cadasegundo=setTimeout("blink()","500");
    }

function venderimovel(valor)
	{
		var valorvenda=Number(FormataReal(valor)).toFixed(2);
		var txco=document.getElementById('txc').value;
		var txcocorret=document.getElementById('taxacorretores').value;
		var txcosuper=document.getElementById('taxasupervisores').value;
		var txcoger=document.getElementById('taxagerentes').value;
		var txcocap=document.getElementById('taxacaptadores').value;
		
		txco=Number(txco).toFixed(5);
		txcocorret=Number(txcocorret).toFixed(5);
		txcosuper=Number(txcosuper).toFixed(5);
		txcoger=Number(txcoger).toFixed(5);
		txcocap=Number(txcocap).toFixed(5);
		
		var comissao=Number((valorvenda*txco)/100).toFixed(2);
		var comissaocorret=Number((comissao*txcocorret)/100).toFixed(2);
		var comissaosuper=Number((comissao*txcosuper)/100).toFixed(2);
		var comissaoger=Number((comissao*txcoger)/100).toFixed(2);
		var comissaocap=Number((comissao*txcocap)/100).toFixed(2);
		
		comissao=comissao.replace( ".", "," );
		comissaocorret=comissaocorret.replace( ".", "," );
		comissaosuper=comissaosuper.replace( ".", "," );
		comissaoger=comissaoger.replace( ".", "," );
		comissaocap=comissaocap.replace( ".", "," );
		
		
		document.getElementById('valorcomissao').value = comissao;
		
		document.getElementById('vtotcorret').value = comissaocorret;
		document.getElementById('vtotsuper').value = comissaosuper;
		document.getElementById('vtotger').value = comissaoger;
		document.getElementById('vtotcap').value = comissaocap;
	}
function alteratxcomissao(valor)
{
var valor=document.getElementById('valorcomissao').value;
var	valorvenda=Number(FormataReal(valor)).toFixed(2);
//var txcomissao=5x=23390*valor=/100;
}
//
-->

