Ext.namespace('mm.messagebox.tmpl.base');
mm.messagebox.tmpl.base = '<div class="mm-messagebox-base"> <div class="mask"></div> <div class="window"> <div class="title">{title}</div> <div class="line_bright"></div> <div class="line_dark"></div> <div class="text">{text}</div> <div class="buttonline"> <div class="button">{buttontext}</div> </div> </div> </div>';
Ext.namespace('mm.messagebox.base');
mm.messagebox.base.construct = function(autoconstruct){
	this.templates = {base:mm.messagebox.tmpl.base};
	this.el = null;
	this.overlay = null;
	this.constructor = function(config)
	{
		var parent = config.parent.el;
		this.callback = typeof config.callback != 'undefined' ? config.callback : function(){};
		var text = typeof config.text != 'undefined' ? config.text : {};
		var template = new Ext.XTemplate(this.templates.base);
		this.el = $(template.apply(text));
		$(parent).append(this.el);
		
		
		this.el.find('.button').bind('click', function(){
			this.hide();
			this.callback();
		}.createDelegate(this));
		
		var css = {
			width: $(parent).width(),
			height: $(parent).height()
		};
		var anim = this.el.find('.window');

		var windowcss = {
			top: ($(parent).height() - anim.height()) / 2,
			left: ($(parent).width() - anim.width()) / 2
		};

		this.el.find('.window').css(windowcss);
		this.el.find('.mask').css(css);
		this.el.disableSelection();
		
	};
	this.hide = function()
	{
		if (this.el != null)
		{
			this.el.hide();
			this.el.remove();
		}
		if (this.overlay != null)
		{
			this.overlay.hide();
			this.overlay.remove();
		}
	};
	this.constructor(autoconstruct);
};
mm.messagebox.base.construct.prototype.domname = 'mm-messagebox-base';
mm.messagebox.base.construct.prototype.namespace = mm.messagebox.base;


