var IframeModal = new Class({



	initialize: function(url,w,h,title){
	
	
			this.url = url;
			this.width = w;
			this.height = h;
			this.title = title;
			
			this.close = new Element('a',{
                    
                        html: 'Fenster schlie&szlig;en',
                        href: 'javascript:void(0)',
                        styles:{
                        
                              'position': 'absolute',
                              'right': '10px',
                              'top': '10px',
							  'z-index':1020
                        }
                    
            });
            this.close.set('class','modalclose'); 
			
			this.center = new Element('div',{
                    
                            id: 'modalForeground',
                            styles:{
                            
                                 'position':'absolute',
                                 'z-index':1010,
                                 'width': '100%',
								 'height': $(document.body).getSize().y+'px',
                                 'top': $(document.body).getScroll().y + 20 + 'px',
								 'left': '0px'
								 
                            }
                    
            });
			
			this.div = new Element('div',{
                        
                        styles: {
                          'background-color':'#ffffff',
                          'margin': '0px auto',
                          'opacity':0,
						  'position':'relative',
						  'text-align':'left',
						  'width':  this.width + 40 + 'px',
						  'height': this.height + 80 + 'px'
                        }
            });
			
			
			this.iframe = new Element('iframe',{
			
					src: this.url,
					height: this.height,
					width: this.width,
					border: 0,
					frameborder:0,
					styles:{
					    'position':'absolute',
						'left': '20px',
						'top': '60px',
						'margin' : '0px',
						'padding' : '0px',
						'border' : '0px',
						'width':  this.width +  'px',
						'height': this.height  + 'px',
						'border': 'solid 1px #eeeeee'
					}
					
			
			});
			
			this.headline = new Element('h3',{
                    
                        html: this.title,
                        styles:{
                        
                          'position': 'absolute',
                          'left': '20px',
                          'top': '20px',
						  'text-align':'left',
						  'width': this.width + 'px'
                        
                        }
                    });
			
			this.headline.set('class','modal');
	
	},
	
	start: function(){
	
			 
			      
			            
			            this.iframe.inject(this.div);
						this.headline.inject(this.div);
			       		this.close.inject(this.div,'top');
						this.div.inject(this.center);
                        this.center.inject($(document.body));
						this.div.fade('in');
						
						this.close.addEvent('click',function(){
                          
                                 $('modalOverlay').fade('out');
                                 this.div.get('tween', {property: 'opacity', duration: 'long',onComplete:function(){
                                 
                                 this.center.dispose();                 
                                 $('modalOverlay').fireEvent('click');
                                 
                        }.bind(this)}).start(1,0);
                                 
                          
                       }.bind(this));	
						
			 
              		this.modalShow({
                    
                              modalStyle:{
                                'background-color':'#000000',
                                'opacity':0.3,
                                'position':'absolute',
                                'z-index':1000
                              }
                   });

	
	}




}).implement(new Modalizer);
