function openChat( r )
{
    window.open("http://bbs.gamer.com.tw/chatroom/index.php?r="+r,"Chatroom","width=760,height=500,menubar=0,location=0,resizable=1").focus();
}

function getTime()
{
    return (new Date()).getTime();
}

function isIE()
{
    return navigator.appName == "Microsoft Internet Explorer";
}

function redir( url )
{
    rand = getTime();
    if( url.indexOf("?") == -1 )
    {
        location.href = url+"?rand="+rand;
    }
    else
    {
        location.href = url+"&rand="+rand;
    }
}

function setStatus( st )
{
}

function help(title)
{
    location.href = "http://user.gamer.com.tw/help";
}

function getCookie( key )
{
    key = key+"=";
    start = document.cookie.indexOf( key, 0);
    if( start == -1 ) return "";
    end = document.cookie.indexOf( ";", start );
    if( end == -1 ) end = document.cookie.length;
    if( isIE() )
    {
        return unescape(document.cookie.substring( start+key.length, end ));
    }
    else
    {
        return document.cookie.substring( start+key.length, end );
    }
}

function setCookie( key, value )
{
    if( isIE() )
    {
        document.cookie = escape(key)+"="+escape(value);
    }
    else
    {
        document.cookie = key+"="+value;
    }
}

function delCookie( key )
{
    document.cookie = key+"=NONE; expires=Tue, 01-01-1980 00:00:00 GMT";
}

function board(bid)
{
    location.href="/cgi-bin/brdAnnounce?brd="+bid;
}

function finger(uid)
{
    window.open( "/cgi-bin/finger?uid="+uid );
}

function login( from )
{
   w = window.open( "/sys/login.php?from="+from, "LOGIN", "width=180,height=200,toolbar=0,menubar=0,statusbar=0" );
   w.focus();
}

function bim()
{
   w = window.open('http://msg.gamer.com.tw/BIM/','BIM','width=280,height=400,menubar=0,resizable=1');
   w.focus();
}

function documentWrite(output){
  document.write(output);
}

function setWide(){
  delCookie('HP');
  location.href = "http://www.gamer.com.tw/";
}
