
function FullScreen(destination) {
	window.open(destination,"","fullscreen=yes");
}

/*
 * Config Iframe 
 */
    Ext.ux.IFrameComponent = Ext.extend(Ext.BoxComponent, {
         onRender : function(ct, position){
            this.el = ct.createChild({
                tag         : 'iframe',
                id          : 'framepanel'+this.id,
                height      : this.height,
                width       : this.width,
                frameBorder : 0,
                src         : this.url
            });
         }
    });

Ext.onReady(function(){
		
	/*
	 * Inhalt des Menuepunktes 'Home'
	 */
	var conHome = {
		id      	: 'conHome',
		bodyStyle	: 'background:transparent;',
		border		: false,
		height  	: 590,
		layout  	: 'fit',
		autoLoad: {
			url: './content/mvContent.php?MyContent=Start'
		}
	};
	
	/*
	 * Inhalt des Menuepunktes 'Vorstand'
	 */
    var conVorstand = {
        id: 'conVorstand',
        bodyStyle: 'background:transparent;',
        border: false,
        autoLoad: {
            url: './content/mvVorstand.php'
        }
    };    
    
    /*
     * Inhalt des Menuepunktes 'Dirigenten'
     */
    var conDirigenten = {
        id			: 'conDirigenten',
        bodyStyle	: 'background:transparent;',
        border		: false,
        autoScroll	: true,
        autoLoad: {
            url: './content/mvDirigenten.php'
        }
    };    
    
    /*
     * Inhalt des Menuepunktes 'Musiker'
     */
    var conMusiker = {
        id: 'conMusiker',
        bodyStyle: 'background:transparent;',
        border: false,
        autoLoad: {
            url: './content/mvMusiker.php'
        }
    }; 
    
    /*
     *  Historie-Daten laden 
     */
    dsMvHistory = new Ext.data.JsonStore({
		url: './includes/HandleData.php',
		baseParams: {DataHandle: 'GetHistoryData'},
		storeId: 'dsMvHistory',
		method:'POST',
		root: 'mvTopics',
		id:'hisID',
		fields: ['hisID','hisYear','hisText']
	});
	
    /*
     * Template für die Anzeige der Historie-Daten 
     */
	var HistoryTpl = new Ext.XTemplate(
        '<tpl for=".">',
        '<div class="history-item">',
        	'<table class="mv-div-wer-template">',
        		'<tr height="25"><td class="mv-div-wer-template-year" colspan="2"><p align="left">{hisYear}</p></td></tr>',
        		'<tr height="25"><td width="5">&nbsp;</td><td class="mv-div-wer-template-text"><p align="justify">{hisText}</p></td></tr>',
			'</table>',
        '</div></tpl>'
    );
    
	/*
     * Inhalt des Menuepunktes 'Historie'
     */
    var conHistorie = {
        id			: 'conHistorie',
        bodyStyle	: 'background:transparent;',
        border		: false,
        height		: 500,
        width		: 600,
        autoScroll	: true,
        items: new Ext.DataView({
            tpl: HistoryTpl,
            store: dsMvHistory,
            itemSelector: 'div.history-item'
        })
    };    
    
    /*
     * Inahlt des Menuepunktes 'Taktlose'
     */
    var conTaktlose = {
        id: 'conTaktlose',
        bodyStyle: 'background:transparent;',
        border: false,
        autoLoad: {
            url: './content/mvTaktlose.php'
        }
    };    
    
    /*
     * Detail-Panel 'wer sind wir?
     */
    var panWerSindWirContent = new Ext.Panel({
        id          : 'panWerSindWirContent',
        border      : false,
        bodyStyle   : 'background:transparent;',
        height      : 520,
        width		: 620,
        autoScroll  : true,
        items       :[{
        	id			: 'content-panel-wer',
    		region		: 'center',
    		layout		: 'card',
    		margins		: '2 5 5 0',
    		activeItem	: 0,
    		baseCls		: 'mv-content-panel',
    		border		: false,
    		items: [conVorstand, conDirigenten, conMusiker, conHistorie, conTaktlose]
        }]
    });
	
    /*
     * Inhalt des Menuepunktes 'Wer sind wir?' 
     */
	var conWer = {
		id      	: 'conWer',
		bodyStyle	: 'background:transparent;',
		border		: false,
		height  	: 590,
		width		: 600,
		layout  	: 'fit',
		autoLoad: {
			url: './content/mvContentWerSindWir.php',
            callback: function(){
  				
				/*
				 * Detail-Panel laden und anzeigen
				 */
	        	panWerSindWirContent.render('mv-div-wer-content');
	        	panWerSindWirContent.doLayout();
			
	        	/*
	        	 * Klick auf 'Vorstand'
	        	 */
	        	Ext.get('mv-div-btnVorstand').on('click', function() {
	        		Ext.getCmp('content-panel-wer').layout.setActiveItem('conVorstand');
	        	});
			          		
	        	/*
	        	 * Klck aus 'Dirigenten'
	        	 */
	        	Ext.get('mv-div-btnDirigenten').on('click', function() {
	        		Ext.getCmp('content-panel-wer').layout.setActiveItem('conDirigenten');
	        	});	
			          		
	        	/*
	        	 * Klick auf 'Musiker'
	        	 */
	        	Ext.get('mv-div-btnMusiker').on('click', function() {
	        		Ext.getCmp('content-panel-wer').layout.setActiveItem('conMusiker');
	        	});	
			          		
	        	/*
	        	 * Klick auf 'Historie'
	        	 */
	        	Ext.get('mv-div-btnHistorie').on('click', function() {
	        		Ext.getCmp('content-panel-wer').layout.setActiveItem('conHistorie');
	        		dsMvHistory.load();
	        	});	
			          		
	        	/*
	        	 * Klick auf 'Taktlose'
	        	 */
	        	Ext.get('mv-div-btnTaktlose').on('click', function() {
	        		Ext.getCmp('content-panel-wer').layout.setActiveItem('conTaktlose');
	        	});	
    		}
		}
	};
	
	/*
	 * Inhalt des Menuepunktes 'Aktuelles'
	 */
	var conNews = {
		id          : 'conNews',
		bodyStyle   : 'background:transparent;',
		border      : false,
		height      : 500,
		width       : 600,
		autoShow	: true,
		items: [
		        new Ext.ux.IFrameComponent({
		        	height  : 500,
		        	width   : 600,
		        	id      : 'slider',
		        	url     : './content/mvNews.php'
		        })
		]
	};
	
	/*
	 * Inhalt des Menuepunktes 'Bilder & Musik'
	 */
	var conGalerie = {
		id      	: 'conGalerie',
		bodyStyle	: 'background:transparent;',
		border		: false,
		height  	: 590,
		layout  	: 'fit',
		autoLoad: {
			url: './content/mvMedia.php'
		}
	};
	
	/*
	 * Inhalt des Menuepunktes 'Ihre Meinung'
	 */
	
	
	
	
	
	/*
	 * Inhalt des Menuepunktes 'Impressum
	 */
	var conImpressum = {
		id      	: 'conImpressum',
		bodyStyle	: 'background:transparent;',
		border		: false,
		height  	: 590,
		layout  	: 'fit',
		autoLoad: {
			url: './content/mvImpressum.php'
		}
	};
	
	/*
	 * Sammel-Panel für die Detail-Panels
	 */
	var contentPanel = {
		id			: 'content-panel',
		region		: 'center',
		layout		: 'card',
		margins		: '2 5 5 0',
		activeItem	: 0,
		baseCls		: 'mv-content-panel',
		border		: false,
		items: [conHome, conWer, conNews, conGalerie, conImpressum]
	};
	
	/*
	 * Main-Panel
	 */
    var panContentMain = new Ext.Panel({
        renderTo	: 'mv-div-content',
        id			: 'panContentMain',
        baseCls		: 'mv-content-panel',
        height		: '95%',
        layout		: 'fit',
        items		: [contentPanel]
    });    
	
    /*
     * Klick auf 'Home'
     */
    Ext.get('mv-div-menu-home').on('click', function(){
    	Ext.getCmp('content-panel').layout.setActiveItem('conHome');
    });
    
    /*
     * Klick auf 'Wer sind wir?'
     */
    Ext.get('mv-div-menu-wer').on('click', function(){
    	Ext.getCmp('content-panel').layout.setActiveItem('conWer');
    });
    
    /*
     * Klick auf 'Aktuelles'
     */
    Ext.get('mv-div-menu-aktuelles').on('click', function() {
    	Ext.getCmp('content-panel').layout.setActiveItem('conNews');
    });	
    
    /*
     * Klick auf 'Bilder & Musik'
     */
    Ext.get('mv-div-menu-galerie').on('click', function() {
    	Ext.getCmp('content-panel').layout.setActiveItem('conGalerie');
    });	    
    
    /*
     * Klick auf 'Ihre Meinung'
     */
    Ext.get('mv-div-menu-gaestebuch').on('click', function() {
    	Ext.getCmp('content-panel').layout.setActiveItem('conGaestebuch');
    });	
    
    /*
     * Klick auf 'Impressum'
     */
    Ext.get('mv-div-menu-impressum').on('click', function() {
    	Ext.getCmp('content-panel').layout.setActiveItem('conImpressum');
    });	
    
    /*
     * Klick auf 'Kontakt' 
     */
    Ext.get('mv-div-menu-kontakt').on('click', function() {
    	MV_Kontakt();
    });	
    
    /*
     * Klick auf 'Login' 
     */
     Ext.get('mv-div-menu-login').on('click', function() {
        mvLogin();
    });
});