/*
 * Ext JS Library 2.2
 * Copyright(c) 2006-2008, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */


Ext.onReady(function(){

    var mapwin;
    var button = Ext.get('googleReggio');
//    alert($("#show-btn"));
//    var coordX=$("#show-btn").css({'left'}+30);
//    var coordY=$("#show-btn").css({'top'})+30;
//    alert(coordX+'--'+coordY);
    button.on('click', function(){
        // create the window on the first click and reuse on subsequent clicks
        if(!mapwin){

            mapwin = new Ext.Window({
                layout: 'fit',
                title: 'mappa su Google',
                closeAction: 'hide',
                width:300,
                height:300,
                x: 800,
                y: 150,
                items: {
                    xtype: 'gmappanel',
                    region: 'center',
                    zoomLevel: 16,
                    gmapType: 'map',
                    mapConfOpts: ['enableScrollWheelZoom','enableDoubleClickZoom','enableDragging'],
                    mapControls: ['GSmallMapControl','GMapTypeControl','NonExistantControl'],
                    setCenter: {
                      geoCodeAddr: 'Via Barlaam, 3, 89127 Reggio di Calabria Reggio di Calabria, Italia',
                      marker: {title: 'Sede legale Associazione "Oltre I Mari"\n via Barlaam, 3 - 89127 Reggio di Calabria'}
                    }
                }
            });
            
        }
        
        mapwin.show();
        
    });
   
       var mapwin2;
 
     var button2 = Ext.get('googleBrandizzo');
//    alert($("#show-btn"));
//    var coordX=$("#show-btn").css({'left'}+30);
//    var coordY=$("#show-btn").css({'top'})+30;
//    alert(coordX+'--'+coordY);
    button2.on('click', function(){
        // create the window on the first click and reuse on subsequent clicks
        if(!mapwin2){

            mapwin2 = new Ext.Window({
                layout: 'fit',
                title: 'mappa su Google',
                closeAction: 'hide',
                width:300,
                height:300,
                x: 800,
                y: 150,
                items: {
                    xtype: 'gmappanel',
                    region: 'center',
                    zoomLevel: 16,
                    gmapType: 'map',
                    mapConfOpts: ['enableScrollWheelZoom','enableDoubleClickZoom','enableDragging'],
                    mapControls: ['GSmallMapControl','GMapTypeControl','NonExistantControl'],
                    setCenter: {
                      geoCodeAddr: 'via Torino, 190, 10032 Brandizzo, Italia',
                      marker: {title: 'Sede Operativa Nord Italia\n10032 - Brandizzo(TO)'}
                    }
                }
            });
            
        }
        
        mapwin2.show();
        
    });   
 });