/**************************************************************************/
// BEGIN map functionality

	function map_refresh(e){
		pixel = new VEPixel(0,0);
		corner = map.PixelToLatLong(pixel);
		
		pixel2 = new VEPixel(400,350);
		corner2 = map.PixelToLatLong(pixel2);
		
		center = map.GetCenter();
		zoom = map.GetZoomLevel();
		alert(corner.Longitude);
		$("#new_pins").load('/content/properties/ajax/map_refresh.php');	
		
	}
	/* bing map 
	****************************************************************************************************/
	function GetMap(clat,clon,zoomLevel){
		map = new VEMap('myMap');
		map.SetDashboardSize(VEDashboardSize.Normal);
		map.LoadMap(new VELatLong(clat,clon));
		map.SetZoomLevel(zoomLevel);
		map.ShowDashboard();
		map.AttachEvent("onmouseup", map_refresh);
	}     
	function AddPushpin(p){
		var shape = new VEShape(VEShapeType.Pushpin, new VELatLong(p['lat'],p['lon']));
		shape.SetCustomIcon(icon);
		shape.SetTitle('<p>'+p['num']+' '+p['str']+'</p>');
		//shape.SetDescription('<p><a href="http://www.google.com" target="_blank" style="color:#111;">'+p['price']+'</a></p>');
		shape.SetDescription('<div class="bubble_side"><img src="http://www.kemteck3.com/photos/'+p['listing_num']+'.jpg" border=0 width="100" /></div><div class="bubble_side">'+p['price']+'<br><a href="javascript:void(0)" onclick = "show_detail('+p['listing_num']+',\'details\');" style="color:#111;">View Details</a></div>');
		//shape.SetDescription('<p><img src=\'http://www.kemteck3.com/images/'+p['thumb']+'\' /></p>');
		map.AddShape(shape);
	}

	/* google map 
	**************************************************************************************************/
    function gmap(center_lat,center_lon) {
		
		properties_gmap = new GMap2(document.getElementById("my_google_map"));
		var mapTypeControl = new GMapTypeControl();
		var topRight = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(5,5));		
		properties_gmap.addControl(mapTypeControl, topRight);
		GEvent.addListener(properties_gmap, "dblclick", function() {
			  //map.removeControl(mapTypeControl);
		});
		properties_gmap.addControl(new GSmallMapControl());
		properties_gmap.setCenter(new GLatLng(center_lat,center_lon), 10);
    	properties_gmap.setZoom(16);
	}
	function properties_add_pin(lat,lon,bubble){
		//bubble = "<h3>test</h3>";
		var baseIcon = new GIcon();
		baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
		baseIcon.iconSize = new GSize(20, 34);
		baseIcon.shadowSize = new GSize(37, 34);
		baseIcon.iconAnchor = new GPoint(9, 34);
		baseIcon.infoWindowAnchor = new GPoint(9, 2);
		baseIcon.infoShadowAnchor = new GPoint(18, 25);
		
		var letteredIcon = new GIcon(baseIcon);
		letteredIcon.image = "http://www.google.com/mapfiles/marker.png";
		
		var point = new GLatLng(lat,lon);
		marker = new GMarker(point);
		
		GEvent.addListener(marker, "click", function() {
			marker.openInfoWindowHtml(bubble);
		});		
		properties_gmap.addOverlay(marker);		
	}
	function call(i){
             marker.openInfoWindowHtml(i);
	}

// END map functionality
/**************************************************************************/



