﻿// JScript File

var ATOLPopup = new Class({

    initialize: function(_element, _popup, _closeEl) {
        
        this.element = _element;
        this.popup = _popup;
        this.closeEl =_closeEl;
        this.element.addEvent('click', this.show.bind(this));
        this.closeEl.addEvent('click', this.close.bind(this));
    },
    
    show: function(e) {
        e = new Event(e).stop();
        this.backgroundDiv = new Element('div', {'id': 'lbOverlay'}).injectInside(document.body);
        $('lbOverlay').addClass('background-full');
        this.backgroundDiv.setStyles({'top': window.getScrollTop(), 'height': window.getHeight()});
        this.backgroundDiv.setStyle('opacity', 0);
        var exampleFx = new Fx.Style(this.backgroundDiv, 'opacity', {
    	    duration: 500
  	    });
        exampleFx.start(0, 0.8);
        var top = window.getScrollTop() + (window.getHeight() / 15);
       
        
        this.popup.style.display = "block";
        this.popup.style.top = top + "px";
        this.popup.style.left = (window.getWidth() / 2) - (this.popup.getSize().size.x / 2) + "px";
    },
    
    close: function(e) {
        e = new Event(e).stop();
        this.backgroundDiv.setStyle('opacity', 0);
        this.popup.style.display = 'none';
    }




});