﻿Popups = {
    init: function() {
        jQuery(".fancy_popup").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': false, 'autoScale': true });
        jQuery(".normal_popup").click(function() {
            window.open(jQuery(this).attr('href'), "", "status = 1, height = 400, width = 400, resizable = 0");
            return false;
        });
        return false;
    },
    initWithSize: function(width, height) {
        Popups.initFancyWithSizeForElements(jQuery(".fancy_popup"), width, height);
        Popups.initNormalWithSizeForElements(jQuery(".normal_popup"), width, height);
    },
    initFancyWithSizeForElements: function(elements, width, height) {
        elements.fancybox({ 'zoomSpeedIn': 300,
            'zoomSpeedOut': 300,
            'overlayShow': false,
            'width': width,
            'height': height,
            'autoDimensions': false,
            'hideOnContentClick': false,
            'hideOnOverlayClick': true,
            'ajax': { 'dataType': 'script' },
            'onComplete': Popups.afterChange
        })
        return false;
    },
    initNormalWithSizeForElements: function(elements, width, height) {
        elements.click(function() {
            window.open(jQuery(this).attr('href'), "", "status = 1, height = " + height + ", width = " + width + ", resizable = 0");
            return false;
        });
        return false;
    },
    initScrollableWithSizeForElements: function(elements, width, height) {
        elements.click(function() {
        window.open(jQuery(this).attr('href'), "", "status = 1, height = " + height + ", width = " + width + ", scrollbars = 1, resizable = 0");
            return false;
        });
        return false;
    },
    afterChange: null
}
