window.addEvent('domready', function(){
	//var _Popup = new Popup(popup);
});

var Popup = new Class({
	Implements: [Events, Options],
	options : {
	},
	
	initialize:function(need, options){
		if(need == false)
			return;
		if (!$chk($$('pre.preview')[0]))
			return;
		
		this.constructPreview.delay(500, this, [$$('pre.preview')[0].get('html')]);
	},
	
	constructPreview : function(embed){
		
		this.wrapper = new Element('div', {
			'class' : 'wrapper'
		});
		
		this.top = new Element('div', {
			'class' : 'top'
		}).inject(this.wrapper);
		
		var close = new Element('a', {
			'id' : 'close_popup',
			'class' : 'close_ahref',
			'title' : 'Fermer cette fenetre'
		}).inject(this.top);
		
		this.content = new Element('div', {
			'class' : 'eeb_content'
		}).inject(this.wrapper);
		
		this.embedWrapper = new Element('div', {
			'html' : embed
		}).inject(this.content);
		
		
		this.foot = new Element('div', {
			'class' : 'foot'
		}).inject(this.wrapper);
		
		this.overflow = new OverflowWrapper(this.wrapper, {
			'bgColor' : 'none',
			'closeObjectId' : 'close_popup'
		});
	}
});

