<!--
function trim (stringToTrim) { return stringToTrim.replace(/^\s+|\s+$/g,""); }
function ltrim(stringToTrim) { return stringToTrim.replace(/^\s+/,""); }
function rtrim(stringToTrim) { return stringToTrim.replace(/\s+$/,""); }
function ir(form) { form.submit(); }
function ir2(form) { if (vermarcados()) { form.submit(); } }
function WriteName() { document.write (NomeDia[dias]); }
function WriteDate() { document.write (NomeDia[dias] + ", " + dia + " de " + NomeMes[mes] + " de " + ano) }
function mostraano() { document.write (ano) }
function abrir(link) { window.open (link, "", "width=700,height=600,resizable,scrollbars,screenX=0,screenY=0,top=0,left=0"); }
function abrir2(link){ window.open (link, "", "width=420,height=300,resizable,scrollbars,screenX=40,screenY=40,top=40,left=40"); }
function abrirp(link){ window.open (link, "", "width=200,height=200,resizable,scrollbars,screenX=40,screenY=40,top=40,left=40"); }
function PrintPage() { if (window.print) window.print(); else alert("O script não conseguiu enviar o documento diretamente para impressão,Pressione Ctrl+P ou selecione Imprimir no menu Arquivo para imprimir esta página."); }
function perguntarsj(link){ if(confirm('Apagar Registro ?\n\nSe apagar este imóvel, você precisará pagar novamente para anunciá-lo !')){ window.location = link ; } }
function perguntar(link)  { if(confirm('Apagar Registro')){ abrirmenor(link); } }

function checkcampos(form) {
    var erro_string = "";  
    if (form.codtipo.options[form.codtipo.options.selectedIndex].value == 0) { erro_string += "Selecione uma Finalidade \n"; }
    if (erro_string == "") { return true; } else { alert(erro_string); return false; }
}

function checkcampos2(form) {
    var erro_string = "";
    var x = trim(form.numref.value);
    if (x.length == 0) { erro_string += "Referência não pode ser nula \n"; }    
    if (erro_string == "") { return true; } else { alert(erro_string); return false; }
}

function requer_cidade(form) {
    var erro_string = "";  
    if (form.codcidade.options[form.codcidade.options.selectedIndex].value == 0) { erro_string += "Selecione uma Cidade \n"; }
    if (erro_string == "") { return true; } else { alert(erro_string); return false; }    
}

function in_array(arr, ele) {
		var found = false, index = 0;
		while(!found && index < arr.length)
		{ if(arr[index] == ele) { found = true; } else { index++; }		  
		}
		return found;
}

//-->

