function Header() {
    this._tPreviewGameOpen = null;
    this._divGameId = "divHeaderGameList";
};
Header.prototype.init = function() 
{
    this.createDiv("divHeader", this.getArea(), "head");
};
Header.prototype.createDiv= function(id, innertag, classname) {
    var divObj = this.createTag("div",id, classname);
    divObj.innerHTML = innertag;
    document.body.insertBefore(divObj, document.body.firstChild);
};
Header.prototype.createTag = function(tag, id, classname) {
    var ret = document.createElement(tag);
    ret.setAttribute("id", id);
    ret.setAttribute("name", id);
    if(classname != "") ret.className= classname;
    return ret;
};
Header.prototype.displayGame= function (id, bShow) {
    document.getElementById(id).style.display = bShow ? 'block' : 'none';
};
Header.prototype.gameOpen = function(id) {
	clearTimeout(this._tPreviewGameOpen);	
	this._tPreviewGameOpen = setTimeout('headHandler.displayGame(\"'+ id +'\", true);', 0);
};
Header.prototype.gameClose = function(id) {
	clearTimeout(this._tPreviewGameOpen);
	this._tPreviewGameOpen = setTimeout('headHandler.displayGame(\"'+ id +'\", false);',300);
};
Header.prototype.getArea= function() {
    var getGameMouseEvent= function(id) {
        return "onmouseover='headHandler.gameOpen(\"" + id + "\");' onmouseout='headHandler.gameClose(\"" + id + "\");'";
    };
    var ret = "";
    ret +=" <h1><a href='/Home/Home.aspx'>T3FUN GLOBAL GAMES</a></h1>";
    ret +="	<ul class='mainMenu'>";
    ret +="		<li class='news'><a href='/News/Notice_List.aspx'>NEWS</a></li>";
    ret +="		<li class='games'><a " + getGameMouseEvent(this._divGameId) +">GAMES</a></li>";
    ret +="		<li class='dnld'><a href='/DataRoom/Download.aspx'>DOWNLOAD</a></li>";
    ret +="		<li class='tcoin'><a href='/TCash/Payment.aspx'>TCOIN</a></li>";
    ret +="		<li class='forums'><a href='/Forums/Forum_list.aspx'>FORUMS</a></li>";
//    ret +="		<li class='forums'><a href='#' onclick=\"window.open('/popup/forumpopup.aspx','forumPopup','width=450px,height=428px');\">FORUMS</a></li>";
    ret +="		<li class='support'><a href='/Support/Faq_List.aspx'>SUPPORT</a></li>";
    ret +="	</ul>";
    ret +="	<div class='headBtns'>";
    if(this.isAuthenticated())
    {
        ret +="	<a href='javascript:RequestLogout();' class='logout'>LOGOUT</a>";
        ret +="	<a href='/MemberShip/User_ModifyCheck.aspx' class='myAcc'>My Account</a>";
    } 
    else 
    {
        ret +="	<a href='/MemberShip/Login.aspx' class='login'>LOGIN</a>";
        ret +="	<a href='/MemberShip/SignUp_01.aspx' class='signUp'>SIGN UP</a>";
    }    
    ret +="	</div>";
    ret +="	<div class='gameList' id='" + this._divGameId + "' style='display:none;' " + getGameMouseEvent(this._divGameId) +">";
    ret +="    <ul>";
    ret +="	    <li><a href='http://aika.t3fun.com'>AIKA</a></li>";
    ret +="	    <li><a href='http://wyd.t3fun.com'>WYD</a></li>";
//    ret +="	    <li><a href='http://tantra.t3fun.com'>Tantra</a></li>";
    ret +="	    <li><a href='http://camon.t3fun.com'>Camon Hero</a></li>";
    ret +="	    <li class='soon'><a href='/GameInfo/GrandMer.aspx?Game=Grandmer'>Coming Soon</a></li>";
    ret +="	  </ul>";
    ret +=" </div>";
    return ret;
};


Header.prototype.isAuthenticated = function() {
    return (xmlHttpRequest.getcookie("UserID") != "" && xmlHttpRequest.getcookie("t3funinfo") !="" && xmlHttpRequest.getcookie("t")) ? true : false;
};
var headHandler = new Header();
headHandler.init();