function init() {
if(document.getElementsByTagName) {
var f=document.getElementsByTagName("FONT");
for (var i=0; i<f.length; i++) {
f[i].removeAttribute('face');
f[i].removeAttribute('color');
f[i].removeAttribute('size');}
var f=document.getElementsByTagName("span");
for (var i=0; i<f.length; i++) {
f[i].removeAttribute('style');}
var f=document.getElementsByTagName("div");
for (var i=0; i<f.length; i++) {
x=f[i].style.cssText.toLowerCase();
if (x && x.indexOf("background-image") == -1) {
f[i].removeAttribute('style');}}
var f=document.getElementsByTagName("p");
for (var i=0; i<f.length; i++) {
f[i].removeAttribute('align');
f[i].removeAttribute('style');
if (f[i].innerHTML=="&nbsp;") {
f[i].parentNode.removeChild(f[i]);}}}
}

function hEnter (field, event) {
var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
if (keyCode == 13) {
var i;
for (i = 0; i < field.form.elements.length; i++)
if (field == field.form.elements[i])
break;
i = (i + 1) % field.form.elements.length;
field.form.elements[i].focus();
return false;
} 
else
return true;
}

function over1() {
document.getElementById('foto1').style.zIndex=1;
document.getElementById('foto2').style.zIndex=0;
document.getElementById('foto3').style.zIndex=0;
}
function over2() {
document.getElementById('foto1').style.zIndex=0;
document.getElementById('foto2').style.zIndex=1;
document.getElementById('foto3').style.zIndex=0;
document.getElementById('foto2').style.display='block';
}
function over3() {
document.getElementById('foto1').style.zIndex=0;
document.getElementById('foto2').style.zIndex=0;
document.getElementById('foto3').style.zIndex=1;
document.getElementById('foto3').style.display='block';
}

function enviar() {
frm=document.getElementById('fbus');
x=frm.text.value;
if (x==("Busca no site") || x==("")) {
return false;
} else {
document.fbus.submit();
}
}

function print(prt) {
document.getElementById("pop").style.display="block";
w=window.open('','printwin','width=200,height=80,top=0,left=0')
w.document.write('<html>\n<head>\n')
w.document.write('<title>Imprimindo</title>\n')
w.document.write('<script>\n')
w.document.write('function chkstate(){\n')
w.document.write('if(document.readyState=="complete"){\n')
w.document.write('window.close()\n')
w.document.write('}\n')
w.document.write('else{\n')
w.document.write('setTimeout("chkstate()",2000)\n')
w.document.write('}\n')
w.document.write('}\n')
w.document.write('function print_win(){\n')
w.document.write('window.print();\n')
w.document.write('chkstate();\n')
w.document.write('}\n')
w.document.write('<\/script>\n')
w.document.write('<style media="screen">img {visibility:hidden}</style><style media="print">p {visibility:hidden}\n')
w.document.write('</style>\n')
w.document.write('</head>\n')
w.document.write('<body onload="print_win()">\n')
w.document.write('<p style="font-family:sans-serif"><br><b>Imprimindo</b><br>Por favor aguarde...</p>\n')
w.document.write('<img src="http://www.adjuve.com.br/publique/media/mapa' + prt + '.jpg">\n')
w.document.write('</body>\n')
w.document.write('</html>\n')
w.document.close()
}

function popUpWindow() {}

function abre(arg1) {
var prt=arg1;
msie = navigator.appVersion.indexOf("MSIE") + 5;
if (parseFloat(navigator.appVersion.substr(msie,1))!=5) {
popW = 750;
popH = 440;
lpos = (popW/2);
tpos = (popH/2);
var h = 0;
if (typeof(window.innerWidth) == 'number' ) {
h=window.innerHeight;
} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
h=document.documentElement.clientHeight;
}
if (h < 460) {
tpos=(h/2)-24;
}
if (parseFloat(navigator.appVersion.substr(msie,1))==6) {
tpos=(h/2) + 220 - ((h < 470)*24);
}
x=document.getElementById("pframe");
x.style.top='50%';
x.style.left='50%';
x.style.marginTop='-'+tpos+'px';
x.style.marginLeft='-'+lpos+'px';
x=document.getElementById("pop");
x.style.display="block";
x.onclick=function() {fecha()};
x=document.getElementById("pimage");
x.style.backgroundImage='url(img/pmapa'+arg1+'.jpg)';
}
else {
p=window.open('','','width=750,height=414,top=0,left=0,resizable=0')
p.document.write('<title>'+'Como chegar'+'</title>\n')
p.document.write('<style>'+'body {margin:0; padding:0}'+'</style>\n')
p.document.write('<img src="img/pmapa'+arg1+'.jpg">\n')
p.document.close();
}
}

function fecha() {
document.getElementById("pop").style.display="none";
}

function clst() {
window.status=' ';
return true;
}

overFrm = function(bt) {
n = document.getElementById(bt);
n.onmouseover = function() {
this.className = "over";
}
n.onmouseout=function() { 
this.className=this.className.replace("over", "");
}
}

function initPane() {
x=document.getElementById('lk1');
x.onmouseover = function() {over1()};
x.title="Saiba mais sobre a oferta em destaque";
x=document.getElementById('lk2');
x.onmouseover = function() {over2()};
x.title="Veja as ofertas de imóveis";
x=document.getElementById('lk3');
x.onmouseover = function() {over3()};
x.title="Ofertas de imóveis de alto padrão";
document.getElementById('bt_foto1').style.backgroundPosition='0px -20px';
x=document.getElementById('fg1');
x.title="Imóvel em destaque";
x=document.getElementById('fg2');
x.title="Ofertas de imóveis";
x=document.getElementById('fg3');
x.title="Imóveis de alto padrão";
}

function setIfr() {
document.write ('<iframe id="ifrm"  name="ifrm" width="0" height="0" frameborder="0" src="http://www.adjuve.com.br/Adjuve/adjuve-2003/imoveis.php"></iframe>');
}

function setImv() {
document.domain="adjuve.com.br";
var a=window.frames['imov'].document.body.innerHTML;
document.getElementById('cframe').innerHTML=a;
}

function setLnk() {
document.domain="adjuve.com.br";
document.write ('<iframe id="ifrm"  name="ifrm" width="0" height="0" frameborder="0" src="http://www.adjuve.com.br/Adjuve/adjuve-2003/links.php"></iframe>');
document.write ('<iframe name="ifrc" id="ifrc" width="0" height="0" frameborder="0" src="_blank" onload="readf()"></iframe>');
}

function setBusca() {
document.domain="adjuve.com.br";
document.write ('<iframe id="imov" name="imov" src="http://www.adjuve.com.br/Adjuve/adjuve-2003/buscaav.php" height="0" width="0" frameborder="0" onload="setImv()"></iframe>');
}

/*function readIfr() {
document.domain="adjuve.com.br";
if (document.images) {
x=window.frames["ifrm"].document.images[0].src;
document.getElementById('fg1').src=x;
x=window.frames["ifrm"].document.images[1].src;
document.getElementById('fg2').src=x;
x=window.frames["ifrm"].document.images[2].src;
document.getElementById('fg3').src=x;
}
}*/

function readf() {
document.domain="adjuve.com.br";
var a=window.frames['ifrc'].document.body.innerHTML;
document.getElementById('dframe').innerHTML=a;
}

function loadf(a) {
document.domain="adjuve.com.br";
x=window.frames[0].document.forms[0].elements[a].value;
url='http://www.adjuve.com.br/Adjuve/adjuve-2003/'+x;
window.frames['ifrc'].location.replace(url);
}

function setLb() {
b=document.form2.chkLembrar;
if (b.checked) {
b.checked=false;
document.getElementById('cbox').style.backgroundPosition='0px 0px';
} else {
b.checked=true;
document.getElementById('cbox').style.backgroundPosition='0px -20px';
}
}

function lnkLb() {
cb=document.getElementById('cbox');
lb=document.form2.chkLembrar;
cb.onclick=function() {setLb()};
if (lb.checked) {
cb.style.backgroundPosition='0px -20px';
} else {
cb.style.backgroundPosition='0px 0px';
}
}

function showfg(){
a=8;
n=Math.round(Math.random()*a);
x=document.getElementById('fig');
x.style.backgroundImage='url(img/fig'+n+'.jpg)';
}

function popUpWindow(x) {
p1=x.indexOf("=")+1;
p2=x.indexOf("&");
var pg=x.substring(p1,p2)+'.jpg';
p3=x.indexOf("wsize=")+6;
p4=x.lastIndexOf("&")
w=x.substring(p3,p4);
p5=x.indexOf("hsize=")+6;
p6=p5+3;
h=x.substring(p5,p6);

p=window.open(pg,'','width='+w+',height='+h+',resizable=no,status=no');

//p.document.body.style.backgroundColor='#A0A0A0';
}
