var RequestModal = new Class({



	initialize: function(url,w){
	
	
			this.url = url;
			this.width = w;
			
			this.close = new Element('a',{
                    
                        html: 'Fenster schlie&szlig;en',
                        href: 'javascript:void(0)',
                        styles:{
                        
                              'position': 'absolute',
                              'right': '10px',
                              'top': '10px'
                        }
                    
            });
            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'
                        }
            });
			
			
			
			
			
	
	},
	
	start: function(){
	
			
			new Request({
			
					url: this.url,
					onSuccess: function(responseText, responseXML){
					
					
					    this.div.setStyles({
						
								'width': this.width + 'px',
								'padding': '20px'
						
						
						});
									    
						this.div.set('html',responseText);
						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
                              }
                        });
						
						
					
					}.bind(this)
			
			
			}).send();

	
	}




}).implement(new Modalizer);
