strGnb = "";
strGnbStyle = "";

if (document.location.href.toLowerCase().indexOf( "https://" ) == 0)
{
	strGnbBaseURL = "https://www.nopp.co.kr";
}
else
{
	strGnbBaseURL = "http://www.nopp.co.kr";
}
strGnbBaseImgURL = strGnbBaseURL + "/img";

strGnbMainRootURL = "http://www.nopp.co.kr/";
strGnbTRRootURL = "http://tr.nopp.co.kr/";
strGnbO2JamRootURL = "http://o2jam.nopp.co.kr/";
strGnbFFRootURL = "http://ff.nopp.co.kr/event/FinalCBT/TeamBattle.aspx?adcode=tbnp";
strGnbMainLogoURL = "http://www.nopp.co.kr/";

strGnbLoginURL = "http://www.nopp.co.kr/member/mem_login_frm.asp";
strGnbLogOutURL = "http://www.nopp.co.kr/member/mem_logout.asp";
strGnbMemberJoinURL = "http://www.nopp.co.kr/member/mem_registselect_frm.asp";
strGnbMyInfoURL = "http://www.nopp.co.kr/member/billing/mycash_info.asp";

strGnbO2JamLoginURL = "http://o2jam.nopp.co.kr/Html_Files/Members/members_login.phtml";

strGnbBillChargeURL = "https://bill.nopp.co.kr/Fillup/AcceptFillup.asp";

strGnbCScenterURL = "http://www.nopp.co.kr/cscenter/cscenter_main.asp";

strGnbLoginCookieName = "NOPPMEMUSER";

d = new Date();
dMonth = d.getMonth();
dDate = d.getDate();
dHour = d.getHours();

function fnGNBGetGameCode()
{
	var gamecode = location.host.substr(0, location.host.indexOf("."));
	return gamecode;
}

strGnbGameCode = fnGNBGetGameCode();

if(strGnbGameCode == "tr")
{
	strGnbTextAlign = "center";
}
else
{
	strGnbTextAlign = "center";
}
/*
if(strGnbGameCode == "o2jam")
{
	strGnbLoginURL = strGnbO2JamLoginURL;
}
*/
/*================*/
var objDateLogo = new Date();

if(objDateLogo.getSeconds() % 2 == 0)
{
	strGnbMainLogoURL = strGnbMainRootURL;
}
else
{
	strGnbMainLogoURL = strGnbMainRootURL;
}

/*================*/


document.write( "<scr" + "ipt src ='" + strGnbBaseURL + "/common/js/gnb/gnb_gamelayer.js' charset='euc-kr' type='text/javascript'></scr" + "ipt>" );


strGnbStyle = strGnbStyle + "<st"+"yle type='text/css'>";
strGnbStyle = strGnbStyle + "	img { border:0px; }";
strGnbStyle = strGnbStyle + "	.gnbMain	{ width:100%;height:38px;border:0;background:url('" + strGnbBaseImgURL + "/gnb/bg.gif') repeat-x;text-align:" + strGnbTextAlign + ";}";
strGnbStyle = strGnbStyle + "	.gnbLine_01 { background:#CA3847; }";
strGnbStyle = strGnbStyle + "	.gnbLine_02 { background:#D4D4D4; }";
strGnbStyle = strGnbStyle + "</st"+"yle>";

strGnb = strGnb + "<div style='text-align:center'>";
strGnb = strGnb + "<table cellspacing='0' cellpadding='0' class='gnbMain'>";
strGnb = strGnb + "  <tr>";
strGnb = strGnb + "    <td height='2' class='gnbLine_01'><img src='" + strGnbBaseImgURL + "/common/blank.gif' width='1' height='2'></td>";
strGnb = strGnb + "  </tr>";
strGnb = strGnb + "  <tr>";
strGnb = strGnb + "    <td height='35' align='center'><table width='970' border='0' cellspacing='0' cellpadding='0'>";
strGnb = strGnb + "      <tr>";
strGnb = strGnb + "        <td width='22'></td>";
strGnb = strGnb + "        <td width='117'><a href='" + strGnbMainLogoURL + "' onfocus='this.blur()'><img src='" + strGnbBaseImgURL + "/gnb/nowcomlogo.gif' width='117' height='24'></a></td>";
strGnb = strGnb + "        <td align='center'><table width='300' border='0' cellspacing='0' cellpadding='0'>";
strGnb = strGnb + "            <tr>";
strGnb = strGnb + "              <td width='30'>&nbsp;</td>";
strGnb = strGnb + "              <td width='72'><a href='" + strGnbTRRootURL + "' onfocus='this.blur()'><img src='" + strGnbBaseImgURL + "/gnb/game_m01.gif' height='24' onmouseover='fnGNBShowHideGameLayer(\"tr\", \"y\");'></a></td>";
strGnb = strGnb + "              <td width='25' align='center'><img src='" + strGnbBaseImgURL + "/gnb/img01.gif' width='5' height='24'></td>";
strGnb = strGnb + "              <td width='51'><a href='" + strGnbO2JamRootURL + "' onfocus='this.blur()'><img src='" + strGnbBaseImgURL + "/gnb/game_m02.gif' height='24' onmouseover='fnGNBShowHideGameLayer(\"o2jam\", \"y\");'></a></td>";
strGnb = strGnb + "              <td width='25' align='center'><img src='" + strGnbBaseImgURL + "/gnb/img01.gif' width='5' height='24'></td>";
strGnb = strGnb + "              <td width='82'><a href='" + strGnbFFRootURL + "' onfocus='this.blur()'><img src='" + strGnbBaseImgURL + "/gnb/game_m04_preobt.gif' height='24' onmouseover='fnGNBShowHideGameLayer(\"ff\", \"y\");'></a></td>";
strGnb = strGnb + "            </tr>";
strGnb = strGnb + "        </table></td>";
strGnb = strGnb + "        <td width='180'><div id='divGnbAd'></div>" + "<scr" + "ipt src ='" + strGnbBaseURL + "/common/js/gnb/gnb_ad.js' charset='euc-kr' type='text/javascript'></scr" + "ipt>" + "</td>";

if(fnGNBIsLogin())
{
	strGnb = strGnb + "        <td width='70' align='right'><a href='" + strGnbLogOutURL + "' onfocus='this.blur()'><img src='" + strGnbBaseImgURL + "/gnb/btn_logout.gif' width='64' height='24'></a></td>";
	strGnb = strGnb + "        <td width='245' align='right'><table width='235' border='0' cellspacing='0' cellpadding='0'>";
	strGnb = strGnb + "            <tr>";
	strGnb = strGnb + "              <td width='18'><img src='" + strGnbBaseImgURL + "/common/blank.gif' width='18'></td>";
	strGnb = strGnb + "              <td>&nbsp;</td>";
	strGnb = strGnb + "              <td width='58' align='center'><a href='javascript:fnGNBBillCharge(\"\");' onfocus='this.blur()'><img src='" + strGnbBaseImgURL + "/gnb/info_m02.gif' name='Image9' width='58' height='24' border='0' onMouseOut='this.src=\"" + strGnbBaseImgURL + "/gnb/info_m02.gif\"' onMouseOver='this.src=\"" + strGnbBaseImgURL + "/gnb/info_m02c.gif\"'></a></td>";
	strGnb = strGnb + "              <td align='center'><img src='" + strGnbBaseImgURL + "/gnb/img02.gif' width='5' height='24'></td>";
	strGnb = strGnb + "              <td width='58' align='center'><a href='" + strGnbCScenterURL + "' onfocus='this.blur()'><img src='" + strGnbBaseImgURL + "/gnb/info_m03.gif' name='Image12' width='58' height='24' border='0' onMouseOut='this.src=\"" + strGnbBaseImgURL + "/gnb/info_m03.gif\"' onMouseOver='this.src=\"" + strGnbBaseImgURL + "/gnb/info_m03c.gif\"'></a></td>";
	strGnb = strGnb + "              <td align='center'><img src='" + strGnbBaseImgURL + "/gnb/img02.gif' width='5' height='24'></td>";
	strGnb = strGnb + "              <td width='58' align='center'><a href='" + strGnbMyInfoURL + "'; onfocus='this.blur()'><img src='" + strGnbBaseImgURL + "/gnb/info_m05.gif' name='Image14' width='53' height='24' border='0' onMouseOut='this.src=\"" + strGnbBaseImgURL + "/gnb/info_m05.gif\"' onMouseOver='this.src=\"" + strGnbBaseImgURL + "/gnb/info_m05c.gif\"'></a></td>";
	strGnb = strGnb + "            </tr>";
	strGnb = strGnb + "        </table></td>";
}
else
{
	strGnb = strGnb + "        <td width='70' align='right'><a href='" + strGnbLoginURL + "?returl=" + top.document.URL + "' onfocus='this.blur()'><img src='" + strGnbBaseImgURL + "/gnb/btn_login.gif' width='52' height='24'></a></td>";
	strGnb = strGnb + "        <td width='245' align='right'><table width='235' border='0' cellspacing='0' cellpadding='0'>";
	strGnb = strGnb + "            <tr>";
	strGnb = strGnb + "              <td width='18' align='center'><img src='" + strGnbBaseImgURL + "/common/blank.gif' width='18'></td>";
	strGnb = strGnb + "              <td>&nbsp;</td>";
	strGnb = strGnb + "              <td width='58' align='center'><a href='" + strGnbLoginURL + "?returl=" + top.document.URL + "' onfocus='this.blur()'><img src='" + strGnbBaseImgURL + "/gnb/info_m02.gif' name='Image9' width='58' height='24' border='0' onMouseOut='this.src=\"" + strGnbBaseImgURL + "/gnb/info_m02.gif\"' onMouseOver='this.src=\"" + strGnbBaseImgURL + "/gnb/info_m02c.gif\"'></a></td>";
	strGnb = strGnb + "              <td align='center'><img src='" + strGnbBaseImgURL + "/gnb/img02.gif' width='5' height='24'></td>";
	strGnb = strGnb + "              <td width='58' align='center'><a href='" + strGnbCScenterURL + "' onfocus='this.blur()'><img src='" + strGnbBaseImgURL + "/gnb/info_m03.gif' name='Image12' width='58' height='24' border='0' onMouseOut='this.src=\"" + strGnbBaseImgURL + "/gnb/info_m03.gif\"' onMouseOver='this.src=\"" + strGnbBaseImgURL + "/gnb/info_m03c.gif\"'></a></td>";
	strGnb = strGnb + "              <td align='center'><img src='" + strGnbBaseImgURL + "/gnb/img02.gif' width='5' height='24'></td>";
	strGnb = strGnb + "              <td width='58' align='center'><a href='javascript:fnGNBMemberJoin();' onfocus='this.blur()'><img src='" + strGnbBaseImgURL + "/gnb/info_m04.gif' name='Image14' width='58' height='24' border='0' onMouseOut='this.src=\"" + strGnbBaseImgURL + "/gnb/info_m04.gif\"' onMouseOver='this.src=\"" + strGnbBaseImgURL + "/gnb/info_m04c.gif\"'></a></td>";
	strGnb = strGnb + "            </tr>";
	strGnb = strGnb + "        </table></td>";
}

strGnb = strGnb + "      </tr>";
strGnb = strGnb + "    </table></td>";
strGnb = strGnb + "  </tr>";
strGnb = strGnb + "  <tr>";
strGnb = strGnb + "    <td height='1' class='gnbLine_02'><img src='" + strGnbBaseImgURL + "/common/blank.gif' width='1' height='1'></td>";
strGnb = strGnb + "  </tr>";
strGnb = strGnb + "</table>";
strGnb = strGnb + "</div>";

if(fnGNBGetCookie("firstflag") == "1" && strGnbGameCode != "ff")
{
	strGnb = strGnb + "<div id='GNBFirstCash'><img src='" + strGnbBaseImgURL + "/gnb/layer_bonus.gif' width='124' height='22' border='0'></div>";
}
//o2jam event layer
/*
if(dDate > 14)
{
	strGnb = strGnb + "<div id='GNBO2JamEvent20090217'><img src='" + strGnbBaseImgURL + "/gnb/layer_o2jam_alram.gif' width='116' height='19' border='0'></div>";
}
else
{
	strGnb = strGnb + "<div id='GNBO2JamEvent20090217'><a href='http://o2jam.nopp.co.kr/news.phtml?bbs_id=news_notice&bbs_url=view&bbs_mode=view&PageNo=1&PageListCnt=15&idxSeq=1289&Flag=title&key=&captionSeq=05'><img src='" + strGnbBaseImgURL + "/gnb/layer_o2jam_alram_20090310.gif' width='126' height='19' border='0'></a></div>";	
}
*/
document.write (strGnbStyle);
document.write (strGnb);

function fnGNBViewMessage()
{
	if(strGnbGameCode == "tr")
	{
		 fnGNBOpenWindow("" + strGnbTRRootURL + "/message/MessageList.asp", "msgWin", "665", "480", "no");
	}
}


function fnGNBIsLogin()
{
	if(fnGNBReadCookie(strGnbLoginCookieName) == null)
	{
		return 0;
	}
	else
	{
		return 1;
	}
}

function fnGNBReadCookie(cookiename)
{
    var numOfCookies = document.cookie.length;
    var nameOfCookie = cookiename + '=';
    var cookieLen    = nameOfCookie.length;
    var x            = 0;

    while( x <= numOfCookies) {
		var y = (x + cookieLen);
		if (document.cookie.substring(x,y) == nameOfCookie)
			return 1;
		x = document.cookie.indexOf(' ',x) + 1;
		if (x == 0)
			break;
	}
    return null;
}

function fnGNBGetCookie( cookieName )
 {
  var search = cookieName + "=";
  var cookie = document.cookie;
 
  // ÇöÀç ÄíÅ°°¡ Á¸ÀçÇÒ °æ¿ì
  if( cookie.length > 0 )
  {
   // ÇØ´ç ÄíÅ°¸íÀÌ Á¸ÀçÇÏ´ÂÁö °Ë»öÇÑ ÈÄ Á¸ÀçÇÏ¸é À§Ä¡¸¦ ¸®ÅÏ.
   startIndex = cookie.indexOf( cookieName );
 
   // ¸¸¾à Á¸ÀçÇÑ´Ù¸é
   if( startIndex != -1 )
   {
    // °ªÀ» ¾ò¾î³»±â À§ÇØ ½ÃÀÛ ÀÎµ¦½º Á¶Àý
    startIndex += cookieName.length;
 
    // °ªÀ» ¾ò¾î³»±â À§ÇØ Á¾·á ÀÎµ¦½º ÃßÃâ
    endIndex = cookie.indexOf( "&", startIndex );
 
    // ¸¸¾à Á¾·á ÀÎµ¦½º¸¦ ¸øÃ£°Ô µÇ¸é ÄíÅ° ÀüÃ¼±æÀÌ·Î ¼³Á¤
    if( endIndex == -1) endIndex = cookie.length;
 
    // ÄíÅ°°ªÀ» ÃßÃâÇÏ¿© ¸®ÅÏ
    return unescape( cookie.substring( startIndex + 1, endIndex ) );
   }
   else
   {
    // ÄíÅ° ³»¿¡ ÇØ´ç ÄíÅ°°¡ Á¸ÀçÇÏÁö ¾ÊÀ» °æ¿ì
    return false;
   }
  }
  else
  {
   // ÄíÅ° ÀÚÃ¼°¡ ¾øÀ» °æ¿ì
   return false;
  }
 }

function fnGNBBillCharge(szPayTool)
{
    fnGNBOpenWindow("" + strGnbBillChargeURL + "?paytool="+szPayTool, "fillup", "420", "520", "yes");
}

function fnGNBOpenWindow(url, boxname, width, height, scrollbars)
{
	var winLeft = (screen.width - width) / 2;
    var winTop = (screen.height - height) / 2;
    var winProps = "width="+width+",height="+height+",top="+winTop+",left="+winLeft+",scrollbars=" + scrollbars + "";

    window.open(url,boxname,winProps);
}

function fnGNBMemberJoin()
{
		if (strGnbGameCode == "tr")
		{
			/*
			var strBrowser;
			var objDialog;
			var scwidth = (screen.width/2) - 360;
			var scheight = screen.height/2 - 210;
			
			strBrowser = navigator.userAgent;					
			
			if(objDialog == null)
			{
				objDialog = window.open("" + strGnbTRRootURL + "/main/member_pop.asp", "memberjoin", "width=370, height=360, top="+scheight+",left="+scwidth+",scrollbars=no,status=no");			
			}
			*/
			top.location.href = "" + strGnbMemberJoinURL + "?returl=" + top.document.URL +  "&gamecode=1";

		}	
		else if (strGnbGameCode == "o2jam")
		{
			top.location.href = "" + strGnbMemberJoinURL + "?returl=" + top.document.URL +  "&gamecode=3";
		}
		else if (strGnbGameCode == "ff")
		{
			top.location.href = "" + strGnbMemberJoinURL + "?returl=" + top.document.URL +  "&gamecode=4";
		}
		else
		{
			top.location.href = "" + strGnbMemberJoinURL + "?returl=" + top.document.URL +  "";
		}		
		
}