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')
//ACERTAR IMPRESSÃO//w.document.write('<maps:GMap ID="GoogleMaps" runat="server" CommercialKey="ABQIAAAA3aCVkTvj0nx392KREtTsMRTPvQ55WBcN9_kNP7Sj4cf-eN20uRRvkx3r2D2KDb5ILFoes_mK4PEOfA" serverEventsType="AspNetPostBack" ajaxUpdateProgressMessage="atualizando" enableContinuousZoom="True" enableGetGMapElementById="True" enableRotation="False" Height="414" Width="750" mapType="Hybrid" Language="pt-BR" Version="3.00" />\n')
w.document.write('</body>\n')
w.document.write('</html>\n')
w.document.close()
}

function popUpWindow() {}
function mapsw(cidade)
{
var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
     var contentString;
    var address;
    var zoom;
    switch (cidade)
    {
        case '1':
            contentString = '<div id="content">'+
                '<div id="bodyContent">'+
                '<strong style="font-size:14; font-family:Arial">Adjuve Imóveis & Condomínios</strong><br />' +
                'Endereço: Rua Dezesseis de Março, 38 - Centro<br />' +
                'Petrópolis - RJ, 25620-040<br />' +
                '(0xx)24 2249-9009'+
                '</div>'+
                '</div>';

            address = 'R. Dezesseis de Março, 38, Petrópolis - RJ';
            zoom=13;
            break;
        case '2':
            contentString = '<div id="content">'+
                '<div id="bodyContent">'+
                '<strong style="font-size:14; font-family:Arial">Adjuve Imóveis & Condomínios</strong><br />' +
                'Endereço: Estr. União Indústria, 9300 - Itaipava<br />' +
                'Petrópolis - RJ, 25730-735<br />' +
                '(0xx)24 2222-4556'+
                '</div>'+
                '</div>';

            address = 'Estr. União Indústria, 9300 - Itaipava, Petrópolis - RJ';
            zoom=14;
            break;
        case '3':
            contentString = '<div id="content">'+
                '<div id="bodyContent">'+
                '<strong style="font-size:14; font-family:Arial">Adjuve Imóveis & Condomínios</strong><br />' +
                'Endereço: Av. Assunção, 698 - Centro<br />' +
                'Cabo Frio - RJ, 28906-200<br />' +
                '(0xx)22 2649-9000'+
                '</div>'+
                '</div>';

            address = 'Av. Assunção, 698 - Cabo Frio - RJ';
            zoom = 15;
            break;
        case '4':
            contentString = '<div id="content">'+
                '<div id="bodyContent">'+
                '<strong style="font-size:14; font-family:Arial">Adjuve Imóveis & Condomínios</strong><br />' +
                'Endereço: Av. Jane Maria Martins Figueira, 1145 Loja 2<br />' +
                'Jardim Mariléia - Rio das Ostras - RJ, 28890-000<br />' +
                '(0xx)22 2760-9999'+
                '</div>'+
                '</div>';

            address = 'Av. Jane Maria Martins Figueira, 1145, Rio das Ostras - RJ';
            zoom = 16;
            break;
    }
    var myOptions = {
      zoom: zoom,
      center: myLatlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }

    var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
   
    
    var geocoder = new google.maps.Geocoder();
    var image = 'img/logoteste.png';
    geocoder.geocode( { 'address': address}, function(results, status) {
      if (status == google.maps.GeocoderStatus.OK) {
        map.setCenter(results[0].geometry.location);
        var marker = new google.maps.Marker({
            map: map, 
            position: results[0].geometry.location,
            icon: image
        });
        var infowindow = new google.maps.InfoWindow({
        content: contentString
        
        });
        infowindow.open(map,marker);
        google.maps.event.addListener(marker, 'click', function() {
            infowindow.open(map,marker);
        });

      } else {
        alert("Geocode was not successful for the following reason: " + status);
      }
    });

      
}

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");
mapsw(arg1);
//x.style.backgroundImage='url(img/pmapa'+arg1+'.jpg)';
//x.appendChild(maps);
//x.innerHTML += "<maps:GMap ID='GoogleMaps' CommercialKey='ABQIAAAA3aCVkTvj0nx392KREtTsMRTPvQ55WBcN9_kNP7Sj4cf-eN20uRRvkx3r2D2KDb5ILFoes_mK4PEOfA' />";
}
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.write('<maps:GMap ID="GoogleMaps" runat="server" CommercialKey="ABQIAAAA3aCVkTvj0nx392KREtTsMRTPvQ55WBcN9_kNP7Sj4cf-eN20uRRvkx3r2D2KDb5ILFoes_mK4PEOfA" serverEventsType="AspNetPostBack" ajaxUpdateProgressMessage="atualizando" enableContinuousZoom="True" enableGetGMapElementById="True" enableRotation="False" Height="414" Width="750" mapType="Hybrid" Language="pt-BR" Version="3.00" />\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';
}

