function openWindow(url, width, height, scrollbars, wname,
                    top, left) {
    var scrW = window.screen.availWidth;
    var scrH = window.screen.availHeight - ((navigator.userAgent.toLowerCase().indexOf('chrome')!=-1)?100:0);
    var w, h, sb, wnm;
    //validating passed in width and height
    if (!(w = width)) w = 640;
    if (!(h = height)) h = 480;
    //resizing dimensions to not exceed the screen ones
    var k;
    if (w > scrW) {
        k = scrW / w;
        w = Math.round(w * k);
    }
    if (h > scrH) {
        k = scrH / h;
        h = Math.round(h * k);
    }

    if (!(sb = scrollbars)) sb = '1';
    var l = (left ? left : Math.round((scrW - w) / 2));
    var t = (top ? top : Math.round((scrH - h) / 2) - 20);
    if (!(wnm = wname)) wnm = '_blank';

    var sFeatures = "toolbar=0"
            + ", directories=0"
            + ", status=0"
            + ", menubar=0"
            + (", scrollbars=" + sb)
            + ", resizable=1"
            + (", width=" + w)
            + (", height=" + h)
            + (", left=" + l)
            + (", top=" + t);

    var newWin = window.open(url, wnm, sFeatures);
    newWin.status = "";
    newWin.focus();
}