﻿/*
Created by      : Ira Noviani   
Created date    : August 18, 2008  
Purpose         : to search for particular address and display the map accordingly
------------------------------------------------------------------  
Modified by | Date      | Purpose  
------------------------------------------------------------------  
            |           |      
------------------------------------------------------------------     
*/
function DisplayMap()
{            
    try
    { 
        var map = new GMap2(document.getElementById('divMap'));
        var geocoder = new GClientGeocoder();
        var strAddress = document.getElementById('divMap_txtAddress').value;        
        
        if (GBrowserIsCompatible()) 
        {
            if (geocoder) 
            {
                geocoder.getLatLng
                (
                    strAddress, 
                    function(point) 
                        {
                            if (point) 
                            {
                                map.setCenter(point, 13);                                
                                var marker = new GMarker(point);                                
                                map.addOverlay(marker);     
                                map.addControl(new GLargeMapControl());
                                marker.openInfoWindow(strAddress);                                            
                            }
                        }
                  );
            }                      
        }             
    }
    
    catch(err)
    {
        alert(err.description);
    }
} 

/*
Created by      : Ira Noviani   
Created date    : October 8, 2008  
Purpose         : to search for particular latitude and longitude and display the map accordingly
------------------------------------------------------------------  
Modified by | Date      | Purpose  
------------------------------------------------------------------  
            |           |      
------------------------------------------------------------------     
*/

function DisplayMap2()
{       
    try
    {  
        var map = new GMap2(document.getElementById('divMap'));
        var geocoder = new GClientGeocoder();
        var strLatitude = document.getElementById('divMap_txtLatitude').value;       
        var strLongitude = document.getElementById('divMap_txtLongitude').value;
        var point = new GLatLng(strLatitude, strLongitude);
        
        if (GBrowserIsCompatible()) 
        {
            if (geocoder) 
            {
                map.setCenter(point, 13);
                map.addOverlay(new GMarker(point));
                map.addControl(new GLargeMapControl());                
            }                           
        }             
    }
    
    catch(err)
    {
        alert(err.description);
    }
} 

function DisplayMap2b(strLatitude, strLongitude)
{
    try
    {  
        var map = new GMap2(document.getElementById('divMap'));
        var geocoder = new GClientGeocoder();
        var point = new GLatLng(strLatitude, strLongitude);
    
        if (GBrowserIsCompatible()) 
        {
            if (geocoder) 
            {
                map.setCenter(point, 13);
                map.addOverlay(new GMarker(point));
                map.addControl(new GLargeMapControl());                
            }                           
        }             
    }
    
    catch(err)
    {
        alert(err.description);
    }
}