// Fix for Prototype Adapter
function openWindowForm(title, content){
  var win = new Ext.Window({
    id          : 'popup-form-win',
    title       : title,
    modal       : true,
    resizeable  : false,
    border      : false,
    bodyStyle   : 'background-color:#f1f1f1;font-size:1.2em',
    width       : 564,
    plain       : false,
    html        : content,
    buttons: [{
      text    : 'Chiudi',
      handler : function(){
        win.close();
      }
    },{
      text     : 'Invia',
      handler  : function(){
        var form = $('popup-form');
        new Ajax.Request(form.action, {asynchronous:true, evalScripts:true, parameters:Form.serialize(form)});
      }
    }]
  });
  win.show();
}

function openGmapWindow(name, address, info){
  new Ext.Window({
    title: 'Raggiungi ' + name,
    layout: 'fit',
    width:700,
    height:400,
    resizable:true,
    modal: true,
    items: {
      xtype: 'gmappanel',
      region: 'center',
      zoomLevel: 14,
      gmapType: 'map',
      mapConfOpts: ['enableScrollWheelZoom','enableDoubleClickZoom','enableDragging'],
      mapControls: ['GSmallMapControl','GMapTypeControl','NonExistantControl'],
      setCenter: {
        geoCodeAddr: address,
        marker: { title: name },
        listeners: {
          click: function(e){
            this.gmap.openInfoWindowHtml(e, '<h1>'+name+'</h1>'+info);
          }
        }
      }
    }
  }).show();
}