		var popup = new Class({
			//implements
			Implements: [Options],
			
			//options
			options:{
				width			: 300,
				height          : 200,
				top				: 0,
				left			: 0,
				effect			: 0,
				blocco			: true
			},
			
			initialize: function(el,options){
		        var iPTop, iPLeft
				var compatibleOverlay;
				var ie6 = Browser.Engine.trident4;
				
				this.setOptions(options);
				this.el = $(el);
				
				//Calcolo la posizione
				iPTop = ((window.getSize().y - this.options.height)/2).toInt();
		        if(iPTop<0) iPTop = 50;
		        iPLeft = ((window.getSize().x-this.options.width)/2).toInt();
		        
		        this.options.top = iPTop;
		        this.options.left = iPLeft;

	    		this.setBody();
				//Gestione Livello sfondo bloccato
				if(this.options.blocco) this.setOverlay();
			    

				if(this.options.blocco){
					$(document.body).adopt($$(this.lPOverlay,this.lPCorpo ));
				    this.lPOverlay.inject(document.body);
			    }else{
				    $(document.body).adopt($$(this.lPCorpo));
			    }
			    
			    this.lPCorpo.inject(document.body);								
			    this.setEffects('open');
			},
			
			setBody: function(){
			    this.lPCorpo = new Element("div", {
				    'id': "lbPromoCorpo", 
				    'styles':{
	                    'position': 'absolute',
	                    'z-index': '9999',
	                    'overflow': 'hidden',
	                    'background-color': '#ffffff',
					    'opacity':  '0',
					    'border':   '5px solid #ffffff',
					    'width': '0',
					    'height': '0',
					    'top' : '0'
				    }
			    });
			    
			    this.lPCorpo.set("html",  this.el.get("html"));
				this.lPCorpo.adopt(
					$$(
						this.lPCloseit = new Element("div", {
						    'id': "lbPCloseit",
						    'styles':{
	                            'width': '100%',
	                            'height': '25px',
	                            'background-color': 'rgb(255, 255, 255)',
	                            'padding-top': '7px',
	                            'text-align': 'right',
	                            'cursor': 'pointer'
	                        }
					    })
					)
				);
				this.lPCloseit.set('html',' <span id="lbPCloseit" style="font-size: 12px; font-family: verdana; font-weight: bold; margin-right: 10px;">X chiudi mesaggio</span>');

				this.lPCloseit.removeEvents("click").addEvent('click', function(){
					this.setEffects();
				}.bind(this));
			},
			
			setOverlay: function(){
				this.lPOverlay = new Element("div", {
				    'id': "lbPromoOverlay", 
				    'styles':{
					    'opacity': '0.8',
		                'position': 'fixed',
		                'z-index': '9999',
		                'left': 0,
		                'top': 0,
		                'width': '100%',
		                'height': '100%',
		                'background-color': '#1265A0',
		                'cursor': 'pointer'
				    },
				    events: {click: close}
			    });			    	

				//testo le compatibilità e in caso provvedo
				compatibleOverlay = Browser.Engine.trident4 || (this.lPOverlay.currentStyle && (this.lPOverlay.currentStyle.position != "fixed"));
				if (compatibleOverlay) this.lPOverlay.style.position = "absolute";

				this.lPOverlay.removeEvents("click").addEvent('click', function(){
					this.setEffects();
				}.bind(this));
				
			},
			
			setEffects: function(action){
				if(action=='open'){
					if(this.options.effect==0){
						this.lPCorpo.setStyles({
			                width: this.options.width + "px",
			                height: this.options.height + "px",
			                top: this.options.top + "px",
			                left:  this.options.left + "px"
			            });
			    	        
					    this.lPCorpo.set('tween', {duration: 2000});
					    this.lPCorpo.tween('opacity', 1);
					}else if(this.options.effect==1){
						this.lPCorpo.setStyles({
			                width: this.options.width + "px",
			                height: this.options.height + "px",
			                top: -(this.options.height + this.options.top) + "px",
			                left:  this.options.left + "px",
			                opacity : 1
			            });
			            
					    this.lPCorpo.set('tween', {duration: 2000, transition: Fx.Transitions.Bounce.easeOut});
					    this.lPCorpo.tween('top', this.options.top + "px");
					}else{
						this.lPCorpo.setStyles({
			                width: "0px",
			                height: "6px",
			                top: (this.options.top + (this.options.height/2).toInt())-6 + "px",
			                left:  this.options.left + (this.options.width/2).toInt() + "px",
			                opacity : 1
			            });
					
					    this.lPCorpo.set('morph', {duration: 800, transition: Fx.Transitions.Expo.easeOut,
							onComplete: function(){
								this.lPCorpo.set('morph', {duration: 1200, transition: Fx.Transitions.Expo.easeOut});
					    		this.lPCorpo.morph({height: this.options.height + "px", top: this.options.top + "px"});						
							}.bind(this)
						});
					    this.lPCorpo.morph({width: this.options.width + "px", left: this.options.left + "px"});						
					}					
				}else{
					if(this.options.effect==0){
						this.lPCorpo.set('tween', {
							duration: 1000,
							onComplete: function(){
								this.lPCorpo.destroy();
							    if(this.options.blocco) this.lPOverlay.destroy();											
							}.bind(this)
						});
					
						this.lPCorpo.tween('opacity', 0.1);
					}else if(this.options.effect==1){
						this.lPCorpo.set('tween', {duration: 1000, 
							onComplete: function(){
								this.lPCorpo.destroy();
							    if(this.options.blocco) this.lPOverlay.destroy();											
							}.bind(this)
						});
						
						this.lPCorpo.tween('top', -(this.options.height + this.options.top) + "px");
					}else{
						this.lPCorpo.set('tween', {
							duration: 1000,
							onComplete: function(){
								this.lPCorpo.destroy();
							    if(this.options.blocco) this.lPOverlay.destroy();											
							}.bind(this)
						});
					
						this.lPCorpo.tween('opacity', 0.1);
					}
					
				}
				
				
			}
		});
		
		window.addEvent('domready', function() {
		    /*if($("lbPCorpo")!=null){
		        
		        
				iPTop = ((window.getSize().y - iPHeight)/2).toInt();
		        if(iPTop<0) iPTop = 50;
		        iPLeft = ((window.getSize().x-iPWidth)/2).toInt();
			    
			    //creo la div principale e quella di sovrapposizione
			    if(bBlocco){
					var lPOverlay = new Element("div", {
					    'id': "lbPromoOverlay", 
					    'styles':{
						    'opacity': '0.8',
			                'position': 'fixed',
			                'z-index': '9999',
			                'left': 0,
			                'top': 0,
			                'width': '100%',
			                'height': '100%',
			                'background-color': '#1265A0',
			                'cursor': 'pointer'
					    },
					    events: {click: close}
				    });			    	
			    }
	    		
			    var lPCorpo = new Element("div", {
				    'id': "lbPromoCorpo", 
				    'styles':{
	                    'position': 'absolute',
	                    'z-index': '9999',
	                    'overflow': 'hidden',
	                    'background-color': '#ffffff',
					    'opacity':  '0',
					    'border':   '5px solid #ffffff'
				    }
			    });
			    
			    lPCorpo.set("html", $("lbPCorpo").get("html"));
				lPCorpo.adopt(
					$$(
						lPCloseit = new Element("div", {
						    'id': "lbPCloseit",
						    'styles':{
	                            'width': '100%',
	                            'height': '25px',
	                            'background-color': 'rgb(255, 255, 255)',
	                            'padding-top': '7px',
	                            'text-align': 'right',
	                            'cursor': 'pointer'
	                        }
					    })
					)
				);
				lPCloseit.set('html',' <span id="lbPCloseit" style="font-size: 12px; font-family: verdana; font-weight: bold; margin-right: 10px;">X chiudi mesaggio</span>');
				
				//Setto la chiusura
			    if(bBlocco){
					lPOverlay.removeEvents("click").addEvent('click', function(){
						lPCorpo.set('tween', {
							duration: 1000,
							onComplete: function(){
								lPCorpo.destroy();
							    lPOverlay.destroy();											
							}
						});
						lPCorpo.tween('opacity', 0.1);
					});
			    }
				
				lPCloseit.removeEvents("click").addEvent('click', function(){
					lPCorpo.set('tween', {
						duration: 1000,
						onComplete: function(){
							lPCorpo.destroy();
						    if(bBlocco) lPOverlay.destroy();											
						}
					});
					lPCorpo.tween('opacity', 0.1);
				});
				
				    		
	
			    if(bBlocco){
				//testo le compatibilità e in caso provvedo
					compatibleOverlay = Browser.Engine.trident4 || (lPOverlay.currentStyle && (lPOverlay.currentStyle.position != "fixed"));
					if (compatibleOverlay) lPOverlay.style.position = "absolute";
				    
					$(document.body).adopt(
					    $$(
						    lPOverlay,
						    lPCorpo
					    )
				    );
				    lPOverlay.inject(document.body);
			    }else{
				    $(document.body).adopt(
					    $$(
						    lPCorpo
					    )
				    );
			    }
			    
			    lPCorpo.inject(document.body);
			    lPCorpo.setStyles({
	                width: iPWidth + "px",
	                height: iPHeight + "px",
	                top: iPTop + "px",
	                left:  iPLeft + "px"
	            });
	    	        
			    lPCorpo.set('tween', {duration: 2000});
			    lPCorpo.tween('opacity', 1);
		    }*/
		});
