﻿

//GLOBAL VARS
var map;


//MAP INITS

function InitMapDiv(pstrMapDiv){
    //INITIALIZES MAP IN DIV LATER THAT IS PASSED AS ARGUMENT
    //SETS DEFAULT LOCATION
    
    //get element
    var dvMapDiv = document.getElementById(pstrMapDiv);
    
    //show map or message that browser doesn't support
    if (InitGoogleMap(dvMapDiv)) { 
        
        //add controls 
        map.addControl(new GSmallZoomControl(), new GControlPosition(G_ANCHOR_TOP_RIGHT,0));
       
         SetMapCenter(15);
        AddBuilding(40.71467, -74.009898);
        
               
    }   
    else{
       dvMapDiv.innerHTML = "<br/><br/>We're sorry, but our map tool is experiencing problems or is not compatible with your web browser.";
    }
}

function InitGoogleMap(dvMap) {
    //CREATES NEW MAP INSTANCE
    
    if (GBrowserIsCompatible()) {
        map = new GMap2(dvMap);
        return true
    }
}



//MAP METHODS

function SetMapCenter(bytZoom) {
    
//    map.setCenter(new GLatLng(40.71680, -74.01390),bytZoom);
    map.setCenter(new GLatLng(40.71467, -74.009898),bytZoom);

}


function AddBuilding(Lat, Long){
    if(map != null){
    
        var point = new GLatLng(Lat, Long);
        var marker = new GMarker(point); 
        map.addOverlay(marker);
      //  GEvent.addListener(marker, "click", function() {map.savePosition();map.setCenter(new GLatLng(43.077922098645736,-87.887781858444210), 15);var myHtml = "<b>Oakland Manor</b><br/>3317 N. Oakland Ave<br/>Milwaukee, WI 53211<br/>414-364-3554<br/><br/><a href='http://localhost:2130/ShorelineWebsite/buildings.aspx?b=1'>Read More</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href='javascript:GotoPrevMapLocation();'>Previous View</a>";map.openInfoWindowHtml(map.getCenter(), myHtml);});
    }
}


//function ChangeMapArea(AreaID) {

//    if(map != null){
//        if (AreaID ==0) {    
//            SetDefaultLocation() 
//        }

//        if (AreaID ==1) {
//            map.setCenter(new GLatLng(43.052926035483600, -87.892325520515440),13);
//        
//        }
//        
//        if (AreaID ==2) {
//            map.setCenter(new GLatLng(43.040171295899200, -87.91444838047028),13);
//        
//        }    

//        if (AreaID ==3) {
//            map.setCenter(new GLatLng(43.087364492731740, -87.8874921798706),13);
//        
//        }    

//        if (AreaID ==4) {
//            map.setCenter(new GLatLng(43.111249992367680, -87.906954288482670),13);
//        
//        }   
//        
//        if (AreaID ==5) {
//            map.setCenter(new GLatLng(43.068027572780245, -88.007381558418270),13);
//        
//        }  

//    }
//     
//}

//function GotoPrevMapLocation() {
//    map.closeInfoWindow();
//    map.returnToSavedPosition();
//}    




// 
