// ==============================================================
// File: NWN.js                                 
//  Created by: Olexander Tsvir5chkov                                     
//  Created by: JavaScript used by NWN partner                
//  Created: 12-06-2009 10:59
// ==============================================================

// -------------------------------------------------------------
// -      Bookmark URL
// -------------------------------------------------------------
function bookmark(url, title) {
    if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) 
    {
        window.external.AddFavorite(url, title);
    }
    else if (navigator.appName == "Netscape") 
    {
        window.sidebar.addPanel(title, url, "");
    }
    else 
    {
        alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
    }
}

// -------------------------------------------------------------
// -      Hide element
// -------------------------------------------------------------
function hideElement(elmID, bBlock) {
    var obj;
    obj = document.getElementById(elmID);
    if (elmID) {
        if (obj && obj.style) {
            if (bBlock) {
                obj.style.display = "none";
            }
            else {
                obj.style.visibility = "hidden";
            }
        }
    }
}
// -------------------------------------------------------------
// -      Show element
// -------------------------------------------------------------
function showElement(elmID, nTop, nLeft, bBlock) {
    var obj;
    obj = document.getElementById(elmID);
    if (obj && obj.style) {
        if (nTop && nLeft) {
            obj.style.top = nTop;
            obj.style.left = nLeft;
        }
        if (bBlock) {
            obj.style.display = "block";
        }
        else {
            obj.style.visibility = "visible";
        }
    }
}

// -------------------------------------------------------------
// -      Open Window. For IE open Modal Window
// -------------------------------------------------------------
function open_window(URL, name, width, height, menubar) {
    var left = parseInt((screen.availWidth / 2) - (width / 2));
    var top = parseInt((screen.availHeight / 2) - (height / 2));
    var windowFeatures = "width=" + width + ",height=" + height + ",status=0,resizable=1,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top + ",menubar=" + menubar;
    myWindow = window.open(URL, name, windowFeatures);
    myWindow.focus();
    return true;
}
