// (C) 2007 Carlo Altieri per Brianza 2000

function carica(num) {
    var url;
    var trg = "_self";

    switch (num) {
        case 1:
            url = "chi.aspx";
            break;

        case 2:
            url = "dove.aspx";
            break;

        case 3:
            url = "servizi.aspx";
            break;

        case 4:
            url = "vendo.aspx";
            break;

        case 5:
            url = "cantieri.aspx";
            break;

        case 6:
            url = "cosa.aspx";
            break;


        case 8:
            url = "contattaci.aspx";
            break;

        case 10:
            url = "cerca.aspx";
            break;

        case 11:
            url = "admin/Default.aspx";
            break;

        case 12:
            url = "privacy.aspx";
            break;

        case 13:
            url = "http://www.fimaamilano.it";
            trg = "_blank";
            break;

        default:
            url = "Default.aspx";
    }

    window.open(url, trg);

    return false;
}

function qualepag(num) 
{
    var el = document.getElementById("lmenu" + num);
    if(el) el.style.backgroundColor = "#FF0000";
    return false;
}

//<![CDATA[
var marker;
var infoTabs
function initmap() {
    if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("b2kmap"));
        map.addControl(new GSmallMapControl());
        map.setCenter(new GLatLng(45.734673, 9.274843), 16);

        var icon = new GIcon();
        icon.image = "http://www.immobiliarebrianza2000.it/images/imap.gif";
        icon.iconSize = new GSize(51, 53);
        icon.shadowSize = new GSize(71, 67);
        icon.iconAnchor = new GPoint(78, -8);
        icon.infoWindowAnchor = new GPoint(52, -2);

        infoTabs = [
		new GInfoWindowTab("Indirizzo", "<br><b>Immobiliare Brianza 2000</b><br><small>VEDUGGIO CON COLZANO (MB) VIA MAGENTA 39<br><br><a href='javascript:void(0)' onclick='marker.openInfoWindowTabsHtml(infoTabs,{ selectedTab:2 });'>Calcola il percorso</a></small>"),
		new GInfoWindowTab("Contatti", "<center><br><small>TELEFONO: 0362-92811&nbsp;&nbsp; FAX: 0362-928035<br><br><table border=0 cellspacing=4 cellpadding=0><tr><td><a href=mailto:info@immobiliarebrianza2000.it><img border=0 src=images/email.gif width=58 height=25 border=0></a></td><td><small><a href=mailto:info@immobiliarebrianza2000.it>info@immobiliarebrianza2000.it</a></small></td></tr></table></center></small><br>"),
		new GInfoWindowTab("Percorso", "<small><b>Calcola il percorso</b><br>Inserisci l'indirizzo partenza oppure il CAP<br>(es. 'via dante 11, Milano' oppure '20100')<FORM id=getDir name=getDir onsubmit=getDirections(); action=''><LABEL><INPUT id=postCode size=40 name=homeAddr> </LABEL><LABEL><INPUT title='Apre Google Maps in una nuova finestra' type=submit value=Vai name=Submit> </LABEL></FORM></small>")];

        marker = new GMarker(map.getCenter(), icon);
        GEvent.addListener(marker, "click", function () { marker.openInfoWindowTabsHtml(infoTabs); });

        map.addOverlay(marker);
        marker.openInfoWindowTabsHtml(infoTabs);
    }
}

function loadcantiere(lat, lon, zoo, txt) {
    if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("b2kmap"));
        map.addControl(new GSmallMapControl());
        map.setCenter(new GLatLng(lat, lon), zoo);

        marker = new GMarker(map.getCenter());
        map.addOverlay(marker);
        marker.openInfoWindowHtml(txt);
    }
}

//]]>}

//Get directions
function getDirections() {
    var from = document.getDir.homeAddr.value;
    newWindow = window.open('http://maps.google.it/maps?saddr=' + from + '&daddr=Via+Magenta,+20837+Veduggio+con+Colzano+MB,+Italy', '_blank', 'height=600,width=800,resizable=yes,scrollbars=yes,menubar=no,addressbar=no');
}

function b2kunload() {
    if (document.getElementById("b2kmap")) {
        GUnload();
    }
}

function cambia(n) {
    var td = document.getElementById("divList" + n);
    var img = document.getElementById("imgList" + n);
    if (td && img)
        if (td.style.display == "block") {
            img.src = "images/giu.gif";
            td.style.display = "none";
        }
        else {
            img.src = "images/su.gif";
            td.style.display = "block";
        }
}

function mostrarisultati(b) {
    var div = document.getElementById("divRicerca");
    if (div)
        if (b) {
            div.style.display = "block";
        }
        else {
            div.style.display = "none";
        }

}

function SettaInnerHtml(ctrl, txt) {
    document.getElementById(ctrl).innerHTML = txt;
}

