
/**
 * @filesource: popup.js
 * @author: A. RUIZ
 * @email: adrien.ruiz083@gmail.com
 * @date: 12/12/09
 **/

var uniqpopup_loadevent = null;
(function ($) {
    
    $.popup = function (url, options) {
        var settings = {
            width       : 600,
            height      : 450,
            toolbar     : 'no',
            menubar     : 'no',
            scrollbars  : 'no',
            resizable   : 'yes',
            location    : 'no',
            directories : 'no',
            status      : 'no',
            top         : 0,
            left        : 0,
            center      : true,
            load        : function(){}
        }
        options = jQuery.extend (settings, options);
        if (options.center) {
            options.top = screen.height/2-options.height/2;
            options.left = screen.width/2-options.width/2;
        }
        if (typeof options.load == 'function')
            uniqpopup_loadevent = options.load;
        // L'ouverture des popup est atomique, il ne
        // peut y avoir plus de 1 popup par site!
        var win = window.open (url, 'jquerypopup',
            'height      ='+options.height+','
           +'width       ='+options.width+','
           +'toolbar     ='+options.toolbar+','
           +'menubar     ='+options.menubar+','
           +'scrollbars  ='+options.scrollbars+','
           +'resizable   ='+options.resizable+','
           +'location    ='+options.location+','
           +'directories ='+options.directories+','
           +'status      ='+options.status+','
           +'top         ='+options.top+','
           +'left        ='+options.left);
    } // popup ();
    
})(jQuery);
