var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""
function ajaxpage(url, containerid){
	var page_request = false
	if (window.XMLHttpRequest) // if Mozilla, Safari etc
		page_request = new XMLHttpRequest()
	else if (window.ActiveXObject){ // if IE
		try {
			page_request = new ActiveXObject("Msxml2.XMLHTTP")
		} 
		catch (e){
			try{
				page_request = new ActiveXObject("Microsoft.XMLHTTP")
			}
			catch (e){}
		}
	}
	else
		return false
		page_request.onreadystatechange=function(){
		loadpage(page_request, containerid)
	}
	if (bustcachevar)
		bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
		page_request.open('GET', url+bustcacheparameter, true)
		page_request.send(null)
	}
function loadpage(page_request, containerid){
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
	document.getElementById(containerid).innerHTML=page_request.responseText
}
function loadobjs(){
	if (!document.getElementById)
		return
		for (i=0; i<arguments.length; i++){
			var file=arguments[i]
			var fileref=""
		if (loadedobjects.indexOf(file)==-1){
			if (file.indexOf(".js")!=-1){
				fileref=document.createElement('script')
				fileref.setAttribute("type","text/javascript");
				fileref.setAttribute("src", file);
			}
			else if (file.indexOf(".css")!=-1){
				fileref=document.createElement("link")
				fileref.setAttribute("rel", "stylesheet");
				fileref.setAttribute("type", "text/css");
				fileref.setAttribute("href", file);
			}
		}
		if (fileref!=""){
			document.getElementsByTagName("head").item(0).appendChild(fileref)
			loadedobjects+=file+" "
		}
	}
}
var bustcachevar=1
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""
function formataCEP(campo) { 
	qtdcaracteres = (campo.value).length; 
	if(qtdcaracteres == 5) 
		campo.value = campo.value + "-"; 
}
// FUNÇÃO QUE GERA O PREVIEW NO RESU
var w=1
var h=1
if (document.getElementById || document.all)
document.write('<div id="trailimageid" style="position:absolute;visibility:hidden;left:0px;top:-1000px;z-index:1000000;width:1px;height:1px;border:1px solid #888888;background:#DDDDDD;"><img id="ttimg" src="" style="opacity:0.90;-moz-opacity:0.90;filter:alpha(opacity=85);border:2px ridge #999;"; width="300px"/></div>')
function gettrailobj(){
    if (document.getElementById) return document.getElementById("trailimageid").style
    else if (document.all) return document.all.trailimagid.style
}
function truebody() {
    return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function hidetrail(){
    document.onmousemove=""
    gettrailobj().visibility="hidden"
    gettrailobj().left=-1000
    gettrailobj().top=0
}
function showtrail(width,height,file){
    if(navigator.userAgent.toLowerCase().indexOf('opera') == -1 && navigator.userAgent.toLowerCase().indexOf('safari') == -1){
        w=width
        h=height       
        gettrailobj().visibility="visible"
        gettrailobj().width=w+"px"
        gettrailobj().w=w;
        gettrailobj().height=h+"px"
        document.getElementById('ttimg').src=file
        document.onmousemove=followmouse
    }
}
function followmouse(e){
    if(navigator.userAgent.toLowerCase().indexOf('opera') == -1 && navigator.userAgent.toLowerCase().indexOf('safari') == -1){
        var xcoord=0
        var ycoord=20
        if (typeof e != "undefined"){
            xcoord+=e.pageX
            ycoord+=e.pageY
        }
        else if (typeof window.event !="undefined"){
            xcoord+=truebody().scrollLeft+event.clientX
            ycoord+=truebody().scrollTop+event.clientY
        }
        var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
        var docheight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight)
        if (xcoord+w+3>docwidth)
        xcoord=xcoord-w-(20*2)
        if (ycoord-truebody().scrollTop+h>truebody().clientHeight)
        ycoord=ycoord-h-20;
        gettrailobj().left = xcoord + "px"
        gettrailobj().top  = ycoord + "px"
    }
}
var linktext=new Array()
linktext[0]="Caso o campo PONTO DE REFERÊNCIA for preenchido os outros critérios de pesquisa serão ignorados."
linktext[1]="Caso o campo REFERÊNCIA DO IMÓVEL for preenchido os outros critérios de pesquisa serão ignorados."
var ns6=document.getElementById&&!document.all
var ie=document.all
function show_text(thetext, whichdiv){
if (ie) eval("document.all."+whichdiv).innerHTML=linktext[thetext]
else if (ns6) document.getElementById(whichdiv).innerHTML=linktext[thetext]
}
function resetit(whichdiv){
if (ie) eval("document.all."+whichdiv).innerHTML=' '
else if (ns6) document.getElementById(whichdiv).innerHTML=' '
}