//in the end of this file is js, must to be used in case when user will ask for more detailes location


function init_gmap(){

        if (GBrowserIsCompatible()) {
	        w = window;
			//$("loc-map").style.height = "300px";
			var map_place = document.getElementById("loc-map");
	        w.map = new GMap2(map_place);
	        loc = curlocation;
	        //console.debug(loc)
	        w.map.setCenter(new GLatLng(loc.latitude, loc.longitude ), 10);
	        var point = new GLatLng(loc.latitude,  loc.longitude);
	        var marker = new GMarker(point);
	        w.map.addOverlay(marker);
	        w.map.addControl(new GSmallMapControl());
        	w.map.addControl(new GMapTypeControl());
	        marker.openInfoWindowHtml(loc.postcode);
		}
}


//YAHOO.util.Event.onDOMReady(init_gmap);
var SMap = {
	show_map: function(ad_id){
		init_gmap();
	}
};

function report_scam(ad_id){
	Main.request("index.php", {
				parameters: {'side':'index', 'cl':'adview', 'act':'scam-report', 'ad_id':ad_id} ,
				onSuccess: function(json, response){
				    console.debug(json);
                },
				scope: this
	});
}

//following is a search - how it should be, with getting location from the Adress
/**

 var map = null;
 var geocoder = null;

    function initialize() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
        geocoder = new GClientGeocoder();
      }
    }
    function showAddress(address) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            } else {
              map.setCenter(point, 13);
              var marker = new GMarker(point);
              map.addOverlay(marker);
              marker.openInfoWindowHtml(address);
            }
          }
        );
      }
    }
    */
