//Initialise window variables
//So no errors will appear when running win_init()
searchCharWin = 999;
CHENtranslationWin = 999;
ENCHtranslationWin = 999;
mainWin = 999;
configWin = 999;
searchWin = 999;
secureWin = 999;

if (window != top) {
    top.location.href = location.href;
}
       		
//Open a window that uses an IFRAME to show its content
function openWinFrame(win, x, y, frame, url) {
    oWin[win].addZ();
    oWin[win].showIt();
    oWin[win].moveIt(x,y,win);
    frame.location.href = url;
}

//Open a window which shows direct content
function openWin(win, x, y) {
    oWin[win].addZ();
    oWin[win].showIt();
    oWin[win].moveIt(x,y);
}

//Open the mainWin with the specified URL.
function mainWinOpen(url) {
    x = winpage.x2/2-winpage.x2/1.2/2;
    y = 55;
    openWinFrame(mainWin, x, y, mainFrame, url);
}

//Open the secureWin with the specified URL.
function secureWinOpen(url) {
    x = winpage.x2/2-225;
    y = winpage.y2 /2 - 200 + 65;
    openWinFrame(secureWin, x, y, secureFrame, url);
}

//Open the configWin with the specified URL.
function configWinOpen(url) {
    x = winpage.x2/2-150;
    y = winpage.y2/2 - 100;
    openWinFrame(configWin, x, y, configFrame, url);
}

//Open the searchCharWin.
function searchCharWinOpen() {
    x = searchcharx;
    y = searchchary;
    openWin(searchCharWin, x, y);
}

//Open the searchWin.
function searchWinOpen() {
    x = winpage.x2/2-225;
    y = winpage.y2-300;
    openWin(searchWin, x, y);
}

//Open the CHENtranslationWin.
function CHENtranslationWinOpen() {
    x = chenx;
    y = cheny;
    openWin(CHENtranslationWin, x, y);
}

//Open the ENCHtranslationWin.
function ENCHtranslationWinOpen() {
    x = winpage.x2-450;
    y = 302;
    openWin(ENCHtranslationWin, x, y);
}

