// google maps
// <iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com.br/maps?f=q&amp;source=s_q&amp;hl=pt-BR&amp;q=R.+Guararapes,+1825+-+Itaim+Bibi,+S%C3%A3o+Paulo+-+SP,+04561-004&amp;sll=-14.179186,-50.449219&amp;sspn=75.66811,113.203125&amp;ie=UTF8&amp;cd=2&amp;geocode=FXrYl_4dIIc3_Q&amp;split=0&amp;t=h&amp;s=AARTsJrP8xn4y2S4McXYJMqIxU1Y8Tzvag&amp;ll=-23.593486,-46.688375&amp;spn=0.02753,0.036478&amp;z=14&amp;iwloc=addr&amp;output=embed"></iframe><br /><small><a href="http://maps.google.com.br/maps?f=q&amp;source=embed&amp;hl=pt-BR&amp;q=R.+Guararapes,+1825+-+Itaim+Bibi,+S%C3%A3o+Paulo+-+SP,+04561-004&amp;sll=-14.179186,-50.449219&amp;sspn=75.66811,113.203125&amp;ie=UTF8&amp;cd=2&amp;geocode=FXrYl_4dIIc3_Q&amp;split=0&amp;t=h&amp;ll=-23.593486,-46.688375&amp;spn=0.02753,0.036478&amp;z=14&amp;iwloc=addr" target="_blank" style="color:#0000FF;text-align:left">Exibir mapa ampliado</a></small>

// main function
Ext.onReady(function() {
    Ext.QuickTips.init();

    function openWindow(content){
        var w = window.open('','wintext','width=1,height=1');

        w.blur();

        w.document.write('<link rel="stylesheet" type="text/css" href="../public/styles/agencia/stylesheet.css" /><center><img src="../public/images/img/logo-integrity.jpg" /></center><br />' + content + '');
        w.document.close();

        w.print();
        w.close();
    }

    function showPrint(){
        var content = Ext.getDom("content-agency-text").innerHTML;

        if(Ext.getCmp('print') == null) {
            var windowPrint = new Ext.Window ({
                id: 'print',
                title: 'Visualização de Impressão',
                layout: 'fit',
                width: 600,
                height: 380,
                closeAction: 'hide',
                plain: true,
                modal: true,
                autoScroll: true,
                buttonAlign: 'center',
                resizable: true,
                                        html: '<div class="content-agency-print"><center><br /><img src="../public/images/img/logo-integrity.jpg" /></center><br />' + content + '</div>',

                //items: item,
                buttons: [
                    {
                        id: 'windowButtonFormClose',
                        text: 'Fechar',
                        icon: 'http://' + HOSTNAME + '/integrity.com.br/site/public/images/icons/icon-close.png',
                        iconCls: 'icon-close',
                        handler: function() {
                            Ext.getCmp('print').hide();
                        }
                    },
                    {
                        id: 'windowButtonFormPrint',
                        text: 'Imprimir',
                        icon: 'http://' + HOSTNAME + '/integrity.com.br/site/public/images/icons/icon-print.png',
                        iconCls: 'icon-print',
                        handler: function() {
                            openWindow('<div class="content-agency-text">' + content + '</div>');
                        }
                    }
                ]
            });
        }

        Ext.getCmp('print').show();
    }

    Ext.getDom('show-btn').onclick = showPrint;


    //
    var mapwin;
    var button = Ext.get('map');

    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: 'Localiza&ccedil;&atilde;o',
                closeAction: 'hide',
                width: 440,
                height: 400,
                items: {
                    html: '<html><head><title>Integrity</title></head><body><iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=pt-BR&amp;geocode=&amp;q=Av.+Nova+Independ%C3%AAncia,+525+-+Brooklin,+S%C3%A3o+Paulo&amp;sll=37.0625,-95.677068&amp;sspn=30.185946,56.601563&amp;ie=UTF8&amp;ll=-23.607138,-46.692289&amp;spn=0.008514,0.013819&amp;z=16&amp;output=embed&amp;s=AARTsJoIYRHy5qrJ-t2v_RBUoPNWyVNWPg"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=pt-BR&amp;geocode=&amp;q=Av.+Nova+Independ%C3%AAncia,+525+-+Brooklin,+S%C3%A3o+Paulo&amp;sll=37.0625,-95.677068&amp;sspn=30.185946,56.601563&amp;ie=UTF8&amp;ll=-23.607138,-46.692289&amp;spn=0.008514,0.013819&amp;z=16&amp;output=embed&amp;s=AARTsJoIYRHy5qrJ-t2v_RBUoPNWyVNWPg" target="_blank" style="color:#0000FF;text-align:left">Exibir mapa ampliado</a></small></body></html>'
                }
            });
        }

        mapwin.show();
    });

}, this, true);



