Overlay.FrameObject = new Class({
	
	Implements: [Options,Events],

	options: {
	  url:'',
		size: {
			width: 450,
			height: 500
		}
	},
  
	initialize: function(options){
		this.setOptions(options);				
		
		this.overlay = new Overlay(document.body, {
			onClick: function(){
			}.bind(this),
			duration : 400
		});				
    
    var x = this.options.size.width,
			  y = this.options.size.height;
       
    this.wrapper = new Element('div', {			
			styles: {
				position    : 'fixed',
        'margin-left' : -(x/2)+94,
        left        : '50%',    
        'margin-top'  : -(y/2)+17,
        top         : '50%',
      	display     : 'block',
      	width       : x,
      	height      : y,
      	padding     : 0,	
      	'z-index'   : 200,
      	clear       : 'both',
      	overflow    : 'hidden'
			}
		}).addClass('assistent').inject(document.body);

    this.neverShowMeButton = new Element('a', 
    {
      html:'<span class="small">Assistenten nicht mehr anzeigen</span>',		
      href:'#',	
			events: {
				click: function(){				  
					this.closeAndStopAssistant();
				}.bind(this)
			}
		}).addClass('stopassistant');
    
    this.closeButton = new Element('a',
    {
      html:'<span class="small">Schliessen</span>',		
      href:'#',	
			events: {
				click: function(){
					this.close();
				}.bind(this)
			}
		}).addClass('close').inject(this.wrapper);  
    
    
    dummy = new Element('div').addClass('iframe').inject(this.wrapper);
    
    this.firstText = new Element('p',
    {
      html:'<span class="black">Wenn Sie hier Ihre Telefonnummer eintragen, sprechen Sie in wenigen Sekunden mit einer freundlichen Mitarbeiterin, die Ihnen gerne mit Rat und Tat zur Seite steht.<br /><strong>Der Anruf ist selbstverst&auml;ndlich kostenlos f&uuml;r Sie!</strong></span>'
		}).addClass('firsttext').inject(dummy);   		
 		    
    var url = this.options.url;
		this.content = new Element('iframe',{
				src: url,
        width:140,
        height:220,			
				frameborder: 0
			}).addClass('callback').inject(dummy);    
			
		this.secondText = new Element('p',
    {
      html:'<span class="black">Bitte an die Vorwahl denken! Aus dem Ausland mit Landesvorwahl!</span>'
		}).addClass('secondtext').inject(dummy);   		
          					 
	},

	open: function(){
		this.open = true;
		this.overlay.open();		
    
		return this;
	},
	
  close: function(){
		this.open = false;
		this.fireEvent('close');
		this.overlay.close();
		return this;
	},
	
	closeAndStopAssistant: function(){
		this.open = false;
		this.fireEvent('closeAndStopAssistant');
		this.overlay.close();
		return this;
	},
	
	
	
	dispose: function(){	    
	  this.wrapper.destroy();
		this.overlay.overlay.destroy();		
	}
	
});
