			var Dialog = new Class({
				Implements: Options,
				options: {
					speed: 500,
					maskColor: '',
					backgroundColor: '#ffffff',
					width: 400,
					height: 'auto',
					onComplete: Class.empty,
					onStart: Class.empty
				},
				initialize: function(options){
					this.setOptions(options);
				},
				show: function(obj,title) {
				var el;
				var tempNode = obj.cloneNode(true);
				tempNode.style.display = 'block';
				this.el = new Element('div',{'styles':{'padding':10,'width':this.options.width,'height':this.options.height}}).appendChild(tempNode);
				obj.parentNode.removeChild(obj);
					// create elements: mask, pop, message and close
					this.mask = new Element('div',{'styles':{
						'position':'absolute',
						'top':0,
						'left':0,
						'opacity':0,
						'height': (window.getHeight() > window.getScrollHeight())?window.getHeight():window.getScrollHeight(),
						'width':'100%',
						'background':this.options.maskColor,
						'z-index':9999
					}});
					this.pop = new Element('div',{'styles':{
						'position':'absolute',
						'visibility':'hidden',
						'width':'100%',
						'margin':0,
						'z-index':10000
					}});
					this.pop.id = 'divpat';
					this.message = new Element('div',{'styles':{
						'background':this.options.backgroundColor,
						'margin':'0 auto'
					}});
					this.close = new Element('span',{'styles':{
						'display':'block',
						'background':'#dddddd',
						'text-align':'right',
						'color':'#000',
						'padding':3,
						'padding-top':5,
						'padding-right':5,
						'height':18,
						'border-bottom':'solid 1px #CCC',
						'cursor':'pointer'
					}});
					this.Fermer = new Element('a',{'styles':{
						'text-decoration':'underline'
					}}).setText('Fermer');
					this.Fermer.inject(this.close,'inside');
					this.titre = new Element('span',{'styles':{
						'margin-top':-13,
						'padding-left':5,
						'font-weight':'bold',
						'float':'left',
						'display':'inline',
						'color':'#000'
					}}).setText(title);					
					
					this.contenu = new Element('div',{'styles':{
						'border-top':'solid 1px #f9f9f9',
						'margin-top':'-1px'
					}});	
					// add events to close the dialog box
					this.close.addEvent('click',this.hide.bind(this));

					// in case there are objects in our message,

					// we hide objects BEFORE we add the message to the dom
					
					//$$('object').setStyle('visibility','visible');
					

					// add elements to the DOM
					document.body.appendChild(this.mask);
					document.body.appendChild(this.pop);
					this.close.inject(this.message,'inside')
					this.contenu.inject(this.message,'inside');
					this.titre.inject(this.close,'inside');
					this.el.inject(this.message,'inside');
					this.message.inject(this.pop,'inside');
					this.message.setStyle('width',this.el.getCoordinates().width);
					// position the dialog outside (above) the visible window
					this.pop.setStyles({
						'top': window.getScrollTop() - this.pop.getCoordinates().height,
						'visibility':'visible'
					});

					// start the animation
					this.fade = new Fx.Tween(this.mask, 'opacity', {duration:this.options.speed});
					this.slide = new Fx.Tween(this.pop, 'top', {duration:this.options.speed});
					this.fade.start(.8);
					this.slide.start(window.getScrollTop()+30);
					this.periodical = this.update.periodical(100,this);

				},
				update: function() {
					this.slide.start(window.getScrollTop()+30);
					var h = (window.getHeight() > window.getScrollHeight())?window.getHeight():window.getScrollHeight();
					this.mask.setStyle('height',h);
				},

				hide: function() {
				
				var tempNode = this.el.cloneNode(true);
				$('bottom').appendChild(tempNode);
				tempNode.style.display = 'none';
					
					
					//$$('object','select').setStyle('visibility','visible');
					$clear(this.periodical);
					this.fade.start(0);
					this.slide.start(window.getScrollTop()-this.pop.getCoordinates().height).chain(function(){
						this.pop.remove();
						this.mask.remove;
						$$('body').setStyle('overflow','auto');

					}.bind(this));
				}
			});
