/*!
 * Ext JS Library 3.2.0
 * Copyright(c) 2006-2010 Ext JS, Inc.
 * licensing@extjs.com
 * http://www.extjs.com/license
 */

Ext.onReady(function(){

    var mapwin;
    var button = Ext.get('show-btn');

    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: 'GMap - Colégio Anglo • Ubá-MG',
                closeAction: 'hide',
                width:500,
                height:400,
                x: 400,
                y: 850,
                items: {
                    xtype: 'gmappanel',
                    zoomLevel: 17,
                    gmapType: 'map',
                    mapConfOpts: ['enableScrollWheelZoom','enableDoubleClickZoom','enableDragging'],
                    mapControls: ['GSmallMapControl','GMapTypeControl','NonExistantControl'],
                    setCenter: {
                        lat: -21.12022,
                        lng: -42.94697,
                        marker: {title: 'Colégio Anglo • Ubá-MG'}
                    },
                    markers: [{
                        lat: -21.12022,
                        lng: -42.94697,
                        marker: {title: 'Colégio Anglo • Ubá-MG'},
                        listeners: {
                            click: function(e){
                                Ext.Msg.alert('Its fine', 'and its art.');
                            }
                        }
                    },{
                        lat: -21.12022,
                        lng: -42.94697,
                        marker: {title: 'Colégio Anglo • Ubá-MG'}
                    }]
                }
            });
            
        }
        
        mapwin.show();
        
    });
    
 });
