function findWindowCenter(winWidth, winHeight) {
    // Target the window to open in the center of the screen
    var screenWidth = screen.width;
    var screenHeight = screen.height;

    var windowX = (screenHeight - winHeight) / 2;
    var windowY = (screenWidth - winWidth) / 2;

    var centerString = "width=" + winWidth + ",height=" + winHeight + ",top=" + windowX + ",left=" + windowY;

    return centerString;
}

function popupWin(srcObj, name, width, height) {
    // Get HREF from anchor tag
    var srcURL = srcObj.getAttribute('href');
    // Create popup window
    var windowXY = findWindowCenter(width, height);
    var winPop = open(srcURL, name, windowXY + ',scrollbars=yes,status=no,resizable=yes');
    if (!winPop.opener) winPop.opener = self;
    winPop.focus();
    if (window.event) window.event.cancelBubble = true;
}

function popupSupport(srcObj) {
    popupWin(srcObj, 'Support', 600, 600);
    return false;
}

function popupCraft(srcObj) {
    popupWin(srcObj, 'Craft', 600, 600);
    return false;
}

function popupGlossary(srcObj) {
    popupWin(srcObj, 'Glossary', 600, 600);
    return false;
}

function popupResources(srcObj) {
    popupWin(srcObj, 'Resources', 600, 600);
    return false;
}

function popupHelp(srcObj) {
    popupWin(srcObj, 'Help', 600, 600);
    return false;
}

function popupLD(srcObj) {
    popupWin(srcObj, 'LD', 400, 300);
    return false;
}

function popupCredits(srcObj) {
    popupWin(srcObj, 'Credits', 600, 600);
    return false;
}

function popupCopyright(srcObj) {
    popupWin(srcObj, 'Copyright', 600, 600);
    return false;
}


