var sfsDialog = new Class({
	options: {
		title:'',
		func:'',
		params: new Array()
	},

	init: function() {
		var self = this;
		
		this.container = new Element('div',{'class':'popup','id':'pop_dialog','style':'display:none'})
		
		this.close = new Element('a',
			{
				'class':'popup-close',
				'html':'close',
				'href':'#',
				'events': {
					'click': function(){
						self.hide();
					}
				}
			})
		this.close.inject(this.container);
		
		this.caption = new Element('h3',{'class':'title','html':this.options.title})
		this.caption.inject(this.container);
		
		this.content = new Element('div',{'class':'content clear-block','id':'popup_content'})
		this.content.inject(this.container);
		this.container.inject(document.body);
		this.initialized = true;
	},
	show: function (title,func,pars)
	{
		if(!this.initialized) this.init();
		
		this.container.fade('hide');
		this.container.setStyle('display','block');
		
		this.content.empty();
		
		this.content.addClass('loading');
		
		this.caption.set('text',title);
	
		this.container.fade('in');
		func(pars);
	},
	hide: function()
	{
		this.container.fade('hide');
	},
	set_content: function(html)
	{
		this.content.set('text',html);
	}
					   
})
sfsDialog.implement(new Events); // Implements addEvent(type, fn), fireEvent(type, [args], delay) and removeEvent(type, fn)
sfsDialog.implement(new Options);// Implements setOptions(defaults, options)

var sfsDialogRequest = new Class({
	Extends: sfsDialog,
	show:function(title,url,pars)
	{
		if(!this.initialized) this.init();
		
		this.container.fade('hide');
		this.container.setStyle('display','block');
		
		this.content.empty();
		this.content.addClass('loading');
		
		this.caption.set('text',title);
	
		this.container.fade('in');
		var self = this;
		
		var myHTMLRequest = new Request.HTML(
			{
				url:url,
				update:this.content,
				onComplete: function(){
					self.content.removeClass('loading');
				}
			}
		).post(pars);
	}
						 
})

//var pop2 = ''
//window.addEvent('domready', function() {	
//	pop2 = new sfsDialogRequest();		
//});
