
//
// Init popup windows for images
//
function vkysno_popups_init()
{
    var ancs = document.getElementsByTagName("a");
    for (i=0; i<ancs.length; i++) {
        if ((ancs.item(i).className).indexOf("popup")!=-1) {
            // popup-width-height
            parts = ancs.item(i).className.split("-");
            addEvent(ancs.item(i), 'click', vkysno_create_pop_func(ancs.item(i).href, parts[1], parts[2]), false);
        }
    }
}

function vkysno_create_pop_func(href, width, height)
{
    return function(e) { 
        if (e.preventDefault) {
            e.preventDefault();
        }
        vkysno_show_pop(href, width, height); 
        return false;
    };
}

function vkysno_show_pop(href, width, height)
{
        var left = (screen.width-width)/2;
        var top  = (screen.height-height)/2;
        href = (href.indexOf('?')>-1) ? (href+'&by=js') : (href+'?by=js');
        features = 'width='+width+', height='+height+', location=no, menubar=no, personalbar=no, resizable=yes, scrollbars=yes, status=no, titlebar=yes, toolbar=no, left='+left+', top='+top;
	openedWindow = window.open(href, 'mywind', features);
	openedWindow.focus();
        return false;
}


