/**
 * some functions from old code
 *
 * @author   dark
 */
function viewPopup(url, width, height) {

    var LeftPosition = (screen.width) ? (screen.width-width)/2 : 0;
    var TopPosition = (screen.height) ? (screen.height-200-height)/2 : 0;

    var settings = 'height='+height+
    ',width='+width+
    ',scrollbars=yes'+
    ',resizable=yes'+
    ',maximize=yes'+
    ',status=no'+
    ',toolbar=no'+
    ',directories=no'+
    ',menubar=no'+
    ',location=no'
    ;

    var win = window.open(url, 'print', settings);
    win.moveTo(LeftPosition, TopPosition);
    win.focus();
}

function closePopup(sec) {
    setTimeout(function(){
        window.close();
    }, sec*1000);    
}

function setRootCategory(categoryId) {
    if(categoryId != undefined) {
        $.ajax({
            type: "POST",
            url: "/index/set-root-category/",
            data: {
                'format': 'json',
                'category_id': categoryId
            },
            success: function(response){
                if(response.url != '') {
                    window.location.href = response.url;
                }
            }
        });
    }
}

function onLoad(args) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = args;
    } else {
        window.onload = function() {
            oldonload();
            args();
        }
    }
}
