var PpsCallWindow = function() {	

	var host = window.location.hostname;

	this.loadMask = null;

	this.ppsCallPanel = new PpsCallPanel();
	
	this.url = "http://"+host+"/index.php?eID=profile_pages_system_free_call";
	
	PpsCallWindow.superclass.constructor.call(this, new Ext.Window({
        title    : 'Kostenlos anrufen ...',
        shadow   : true,
        modal	 : true,
        closable : true,
        width    : 615,
        height   : 200,
        border 	 : false,
        plain    : false,
        footer	 : true,
        maximizable: false,
        resizable: false,
        layout   : 'border',
        items : [
                 this.ppsCallPanel
        ]
    }));


	this.ppsCallPanel.on('render', this.getIframeUrl, this);
	
}

//Extend the mail window with additional functions
Ext.extend(PpsCallWindow, Ext.Window, {

	getIframeUrl: function() {

		Ext.Ajax.request({
			url: this.url,
			method: 'POST',
			success: function(result, request) {
				var iframeUrl = result.responseText;
				var templateHtml = "<div class='iframe'><iframe border='0' width='600' height='200' src='{src}' scrolling='no' frameborder='0'></iframe></div>";
				var template = new Ext.Template(templateHtml, {
					compile: true,
					disableFormats: true
					});
                                template.overwrite( this.ppsCallPanel.body, {src: iframeUrl} );
				},
			failure: this.closeWindow,
			scope: this
			
		});
	},

	closeWindow: function(result, request) {
		
		//this.close();
		
	}
});
