<?php
 
	$ajax = "_ajax/ajax.maps.php";
	$data = $_POST['data'];		//sampling ID
    
	
?>



if( Ext.getCmp('mapWindow') )
{
	Ext.getCmp('mapWindow').close();
}

 
//if( !Ext.getCmp('mapWindow') ){
    new Ext.Window(
    {
    modal:true,
    //var mapWindow = new Ext.Window({
	id: 'mapWindow',
	layout: 'fit',
    title: 'GMap Window',
	width: 650,
	height: 500,
          items: [
                {
                    xtype: 'gmappanel',
                    id:'gmappan',
                    gmapType: 'map',
                    zoomLevel: 14,
                     listeners: {

                        afterrender: function(){
                            var json = Ext.decode('<?php echo $data;?>');
                            //var json = Ext.decode(res.responseText);
                            var bounds = new google.maps.LatLngBounds();
                            Ext.each(json, function(row){

                            var mpoint = new GLatLng(parseFloat(row.latitude),parseFloat(row.longitude));
                            bounds.extend(mpoint);
                            Ext.getCmp('gmappan').addMarker(mpoint , {title:row.id});
                            });
                            Ext.getCmp('gmappan').getMap().c.fitBounds(bounds);
                        	//this.addMarker({  lat: 46.049018333333, lng: 14.52268333333,  title: 'Marker'});
                        }
                    },
                    setCenter: {
                        lat: 46.149018333333,
                        lng: 15.01268333333

                    }
                }
            ]
}).show();

//mapWindow.show();


//}