var map;
var lat;
var lng;
var zom;
function init(cLatitude,cLongitude,zoom,desc_id)                     
{	
   

   if(!cLatitude)cLatitude = 25;
   if(!cLongitude)cLongitude = 55;
   if(!zoom)zoom = 11;
   
   lat = cLatitude;
   lng = cLongitude;
   zom = parseInt(zoom);
   
   if(!desc_id)desc_id = "gmap_info_desc";

    if(GBrowserIsCompatible())
    {	

        //var map_size = GSize(300,300);
		map = new GMap2( document.getElementById( "view_map" ) );
		
        var location = new GLatLng(cLatitude,cLongitude);
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        
        //if(apptype == "user")
        //{
            //map.addControl(new GOverviewMapControl()); 
        //}
        map.setCenter(location,parseInt(zoom));          
		map.checkResize(); 
        
        var html = "Property Locatiton"; 	

		AddMapMarker(cLatitude,cLongitude,"","",false);   
        	
	}                                                                           
}


function AddMapMarker(lat,lng,Description,icon_path,showPopupFirstTime)
{
    var icon = new GIcon(); 
	
	
	//alert(this_domain + "/images/common/empty.png");
	if(!icon_path)
	{
		icon_path 		= "/images/common/empty.png";
		icon.iconSize 	= new GSize(41, 34);
		icon.iconAnchor = new GPoint(10, 34);
	}
	else
	{
		icon.iconSize = new GSize(35, 31);
		icon.iconAnchor = new GPoint(5, 25);
	}
	 
    icon.image = this_domain + icon_path;    
	icon.infoWindowAnchor = new GPoint(14, 14);  
    
    
    
    var marker = new GMarker(new GLatLng(lat,lng),icon); 
    map.addOverlay(marker);
    
	if(Description != "")
	{
	    GEvent.addListener(marker,'click',function(overlay, latlng)
	    {
	      marker.openInfoWindowHtml(Description); 
	    });
		
		if(showPopupFirstTime == true)
		{	
			marker.openInfoWindowHtml(Description); 
			
		}
	}
   // marker.geohtml = Description;
   return false;
    

}

