<!--
//Função que habilita preserva o valor do radio
function rdoPosiciona(obj,valor) {
	for (var i=0;i<obj.length;i++) {
		if (obj[i].value==valor) {
			obj[i].checked=true;
			break;
		}
	}
}

//Função que habilita preserva o valor do combobox
function cbxPosiciona(obj,id) {
	var retorno=false;
	for (i=0;i<obj.length;i++) if (obj(i).value==id){
			obj.selectedIndex=i;
			retorno=true;
			break;
	}
	return retorno;
}

//Função que só permite digitar números
function IsKeyNumeric(keypress){
	caracteres = '0123456789';
	if (caracteres.search(String.fromCharCode(keypress)) == -1) {
		event.returnValue = false;
	} 
}

function decimal(keypress, numero){
	
	if (String.fromCharCode(keypress)=='.'){
		if (numero.value.indexOf('.')!=-1){
			event.returnValue = false;
		}
	}else if (numero.value.indexOf('.')!=-1){			
			if ((numero.value.substring(numero.value.indexOf('.')).length) > 2){
				event.returnValue = false;
			}
	}
}

function marcaCatImovel(ambientes, adicionais, sala, banheiro, vagaGaragem, categoria)
{
	//Se a categoria não for referente a Comerciais e Industriais [1689], Sítios, Chácaras e Fazendas: [1692] e Terreno e Lotes [1692]
	//então atribua 0 a variável temp2			
	if ((categoria != 1689) && (categoria != 1692) && (categoria != 1692)){
		temp2 = 0;
	//Senão, se for referente a Comerciais e Industriais [1689] atribuir 18 a variável temp2
	//pois o value do checkbox na posição 0 começa no 18 e poder dinamicamente zerá-la	
	}else if (categoria == 1689){
		  	  temp2 = 18;
	//Senão atribua 24
		  }else{
		  	 temp2 = 24;
		  }	
	if (ambientes != '')
	{		
		temp = ambientes.split(', ');
		for (i = 0; i < temp.length; i++)
		{
			document.frmcadastro.ambientes[temp[i]].checked = true;
		}	
	}
	if (adicionais != '')
	{		
		temp = adicionais.split(', ');
		for (i = 0; i < temp.length; i++)
		{
			document.frmcadastro.adicionais[temp[i]-temp2].checked = true;
		}	
	}
	if (sala != '') {document.frmcadastro.sala[sala].selected = true;}
	if (banheiro != '') {document.frmcadastro.banheiro[banheiro].selected = true;}
	if (vagaGaragem != '') {document.frmcadastro.vagaGaragem[vagaGaragem].selected = true;}
}

function desabilitaVeicImov(anov)
{	
	document.getElementById('duracao').disabled = true;
	document.getElementById('duracao').selectedIndex = 9;
	document.getElementById('recadastros').disabled = true;
	document.getElementById('quantidade').disabled = true;
	setAnoVeiculo(anov);
}

function setAnoVeiculo(anov)
{
	data = new Date();
	if ((anov != 0) && (anov != ''))
	{	
		document.getElementById('anoveiculo').selectedIndex = (data.getYear() - anov + 1);
	}

}

//Redefine o tamanho do IFrame.
function tamIFrame(){
	parent.document.getElementById('iFMinhaConta').height = document.getElementById('tamanho').scrollHeight + 40; //40: Margem Superior e Inferior, somadas
}

//Devido a falta de padronização de páginas é impossível criar apenas uma função navegar mas quem sabe no futuro...
//Então já deixo essa função que dinamicamente pega o url da página atual.

/*function navegar(pagina){  
  document.frmnavegar.action=location.href.replace('http://www.mirabolante.com.br/', '');+'?pagina='+pagina;
  document.frmnavegar.submit();
}*/

function encerar(codigo){  
  document.frmencerar.codigo.value=codigo;
  document.frmencerar.submit();
}

function modificar(codigo){
  document.frmmodificar.codigo.value=codigo;
  document.frmmodificar.submit();
}

function recadastrar(codigo){
  document.frmrecadastrar.codigo.value=codigo;
  document.frmrecadastrar.submit();
}

var imgAbre;
var imgFecha;

function abreFechaBox(obj){
	if (document.getElementById(obj).style.display == 'block'){
		document.getElementById(obj).style.display = 'none';
		document.getElementById(obj+'Img').src = imgAbre;
	}else{
		document.getElementById(obj).style.display = 'block';
		document.getElementById(obj+'Img').src = imgFecha;
	}
}
// -->