
function do_login()
{
    var login = new Object;

    login.name = 'login-name';
    login.pass = 'login-pass';

    login.action = xGetElementById('server-path').value+'/login.php';
    login.error = xGetElementById('server-path').value;
    login.logout = xGetElementById('server-path').value + '/logout.php';

    md5_login(login);
}

function forgot_password()
{
    location.href=xGetElementById('server-path').value + '/main.php?context=public&path=about-forgotmypassword';
}

function menu_mouseover(e)
{
    var event = new xEvent(e);
    event.target.className = 'current_middle';
}

function menu_mouseout(e)
{
    var event = new xEvent(e);
    event.target.className = 'menu_middle';
}

function click_to_call()
{
    xPos = xClientWidth()/2 - 250;
    yPos = xClientHeight()/2 - 150;

    window.open("http://click2call2.tnz.co.nz/tnz.html","contactUs","width=510,height=310,left="+xPos+",top="+yPos+",screenX="+xPos+",screenY="+yPos);
}

function back_chat()
{
    xPos = xClientWidth()/2 - 250;
    yPos = xClientHeight()/2 - 150;

    window.open(xGetElementById('server-path').value + "/livechat/index.htm","contactUs","width=510,height=310,left="+xPos+",top="+yPos+",screenX="+xPos+",screenY="+yPos);
    //window.open("http://www.tnz.co.nz/backchat/index.htm","contactUs","width=510,height=310,left="+xPos+",top="+yPos+",screenX="+xPos+",screenY="+yPos);
}

function init_window()
{
    if( xGetElementById('main-header-logged-in') )
    {
        var elems = xGetElementsByClassName('menu_middle');
        
        for(var prop in elems)
        {
            if( elems[prop].innerHTML != "" )
            {
                xAddEventListener(elems[prop],'mouseover',menu_mouseover,false);
                xAddEventListener(elems[prop],'mouseout',menu_mouseout,false);
            }           
        }
    }
}

xAddEventListener(window,'load',init_window,false);