var DrCustomAlert = new Class({
	initialize: function(alert,outclick) {
		
			
			this.outclick = outclick;
		
			this.fond = new Element('div');
			
			this.fond.setStyles({'background-color':'#000000',
							'z-index': '10001',
							'height': '100%',
							'width': '100%',
							'position': 'fixed',							
							'top':0,
							'left':0,
							'display':'block'});
			
			this.conteneur = alert.clone();
			
			
			
			this.conteneur.setStyles({"display":'block',
										'position': 'fixed',
										'top':0,
										'left':0,
										'z-index':10002});
			
			
			
			this.timeeffect = 300;
			

			
			
			this.fond.setOpacity(0);
			this.conteneur.setOpacity(0);
			
			this.fond.injectTop($(document.body));
			this.conteneur.injectTop($(document.body));
			
			
			
			
			
			this.conteneur.setStyle('top',(getWindowHeight()-parseInt(this.conteneur.getStyle('height')))/2);
			this.conteneur.setStyle('left',(getWindowWidth()-parseInt(this.conteneur.getStyle('width')))/2);
			
			
			
		
			
			
			var annim = this.fond.effect('opacity', {duration: this.timeeffect, transition: Fx.Transitions.linear});
			annim.start(0, 0.7);
			
			this.annim2 = this.conteneur.effects({duration: this.timeeffect, transition: Fx.Transitions.Cubic.easeOut}).start({'opacity':[0,1]});
	
			
			window.addEvent('resize',function(){
				
				this.annim2.start({
					'top':((getWindowHeight()-parseInt(this.conteneur.getStyle('height')))/2),
					'left':((getWindowWidth()-parseInt(this.conteneur.getStyle('width')))/2)					
				});
			}.bind(this));
			
			if(this.outclick)
			annim.addEvent('onComplete',function(){
				
				this.fond.addEvent('click',function(){this.close();}.bind(this));			
				
			}.bind(this));
		
				
		
		
		
	},
	close: function(){
		
		var tout= $$(this.fond,this.conteneur);
		
		var fx =new Fx.Elements(tout,{duration:200});
		fx.start({'0':{'opacity': [0]},'1':{'opacity': [1,0]}});
		
		fx.addEvent('onComplete',function(){this.removeAll();}.bind(this));
		
	},
	removeAll:function(){
		
		this.fond.remove();
		this.conteneur.remove();
		
		
	}
	

});



function getWindowHeight()
{
	 myHeight = 0;
	  if( document.documentElement && ( document.documentElement.clientHeight  ) ) {
		  //IE 6+ in 'standards compliant mode'
		    
		    myHeight = document.documentElement.clientHeight;
	  } else if( typeof( window.innerHeight ) == 'number' ) {
		  //Non-IE	  
		    myHeight = window.innerHeight;
		  
		 
	  } else if( document.body && ( document.body.clientHeight ) ) {
	    //IE 4 compatible	   
	    myHeight = document.body.clientHeight;
	  }
	  	  
	  return myHeight;
	  
	 
}

function getWindowWidth()
{
	
	 var myWidth = 0;
	 
	  if( document.documentElement && ( document.documentElement.clientWidth  ) ) {
		    //IE 6+ in 'standards compliant mode'
		    myWidth = document.documentElement.clientWidth;
		   
	  } else if( typeof( window.innerWidth ) == 'number' ) {
	    //Non-IE
	    myWidth = window.innerWidth;
	    
	  }  else if( document.body && ( document.body.clientWidth  ) ) {
	    //IE 4 compatible
	    myWidth = document.body.clientWidth;
	   
	  }
	
	  return myWidth ;
	 
}



