﻿function showFile(file) {
    if (!file) return;
    new Ajax.Updater("fileWrapper", "/html/" + file + ".htm", {
        method: 'get',
        onSuccess: function() {
            var bodyHeight = (document.viewport.getHeight() / 2) + document.viewport.getScrollOffsets().top;
            var bodyWidth = $("site").getWidth();
            var wrapperHeight = $("fileWrapperOuter").getHeight();
            LightBox.Show("fileWrapperOuter", { top: bodyHeight, left: bodyWidth / 2, width: 400 });
            handlers.showFileCloserHandle = handlers.showFileCloser.bindAsEventListener(handlers);
            Event.observe("fileWrapperClose", "click", handlers.showFileCloserHandle);
        }
    });
}

var handlers = {
    showFileCloser: function(evnt) {
        LightBox.Hide("fileWrapperOuter", "site");
        Event.stopObserving("lightboxBG", "click", handlers.showFileCloserHandle);
    }
};
	