﻿Prototype.Browser.IE6 = Prototype.Browser.IE && parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE") + 5)) == 6;
Control.Modal.defaultOptions = {
    closeOnClick: false,
    fade: true,
    overlayOpacity: 0.7,
    className: 'modalWindow',
	isAppendClose: true,
    iframeshim: true
};
if(!Prototype.Browser.IE6){
    Control.Overlay.positionOverlay = function(){
        Control.Overlay.container.setStyle({
            position: 'fixed',
            left: '0px',
            top: '0px',
            right: '0px',
            bottom: '0px' });
    };
}
Control.Modal.Observers.beforeOpen = function() {
    if (this.options.isAppendClose == true) {
        if (!this.container.isOpen) {
            this.container.insert({
                top: new Element('div', { id: 'windowHeader' }).insert(
					new Element('a', { id: 'closeWindow' })
						.insert('Close')
						.observe('click', function() { Control.Modal.close(); })
				).observe('click', function() { Control.Modal.close(); })
            });
            this.container.isOpen = true;
        }
    }
    if (!this.overlayFinishedOpening) {
        Control.Overlay.observeOnce('afterShow', function() {
            this.overlayFinishedOpening = true;
            this.open();
        } .bind(this));
        Control.Overlay.show(this.options.overlayOpacity, this.options.fade ? this.options.fadeDuration : false);
        throw $break;
    } else
        Control.Window.windows.without(this).invoke('close');
    if (Control.Overlay.iFrameShim) {
        Control.Overlay.iFrameShim.positionUnder(Control.Overlay.container);
    }
};