/**
 * @author wonkyo
 */

//다국어
function setLanguages(languages)
{
	var result = ajaxRequest(null,'/common/setLanguages', 'languages='+languages);
	var goUrl  = ajaxRequest(null,'/common/setLanguages', 'languages='+languages+'&mode=url');
	var msg  = ajaxRequest(null,'/common/setLanguages', 'languages='+languages+'&mode=msg');
	
	if(result)
	{
		netgameLayer(msg, '', '', 3, 'GNB', goUrl);
	}
	else
	{
		location.reload();
	}
}


function netgameGnbGames() {
	var obj				=	document.getElementById('gnbSupport');
	obj.style.display	=	'none';
	
	var obj				=	document.getElementById('gnbGame');
	obj.style.display	=	(obj.style.display != '') ? '' : 'none';
}

function netgameGnbSupport() {
	var obj				=	document.getElementById('gnbGame');
	obj.style.display	=	'none';	
	
	var obj				=	document.getElementById('gnbSupport');
	obj.style.display	=	(obj.style.display != '') ? '' : 'none';
}

function ieMinWidth() 
{
   if(document.body.clientWidth < 1001)
   {
      return "1000px";
   }else{
      return "auto";
   }
}



function netgameGnbMenu(idx) {
	var goUrl;

	switch(idx) {
	case 1 :
		if(!netgameUserCheck()) return;
		goUrl			=	'http://www.netgame.com/charge/charge.php';
		break;
	case 2 :
		goUrl			=	'http://www.netgame.com/download/download.php';
		break;
	case 3 :
		if(!netgameUserCheck()) return;
		
		netgameIframeLayer('http://www.netgame.com/sign/edit_check.php', 550, 296);
		return;
		
		break;
	case 4 :
		if(!netgameUserCheck()) return;

		var pageUrl		=	[];
		
		pageUrl['www']			=	'http://www.netgame.com/help/customer.php';
		pageUrl['hero']			=	'http://www.netgame.com/help/customer.php?cate=hero';
		pageUrl['fate']			=	'http://www.netgame.com/help/customer.php?cate=fate';
		pageUrl['cloudnine']	=	'http://www.netgame.com/help/customer.php?cate=cloudnine';
		pageUrl['op7']			=	'http://www.netgame.com/help/customer.php?cate=op7';
		pageUrl['cow']			=	'http://www.netgame.com/help/customer.php?cate=cow';
		pageUrl['rode']			=	'http://www.netgame.com/help/customer.php?cate=rode';

		goUrl			=	pageUrl[thisGame()] ? pageUrl[thisGame()] : '#';
		
		break;
	default :
		goUrl			=	'http://www.netgame.com/';
		break;
	}
	
	if(goUrl == '#') {
		error('Coming soon...');
	} else {
		top.location.href	=	goUrl;
	}
}


var netgameImg		=	'http://image.netgame.com/netgame/common/gnb';
var netgameGnb		=	'';

netgameGnb			+=	'<link href="http://www.netgame.com/css/gnb.css" type="text/css" rel="stylesheet" />';
netgameGnb			+=	'<div id="gnbNetgame" >';

netgameGnb			+=	'	<h1><a href="javascript:netgameGnbMenu();"><img src="'+netgameImg+'/logo_netgame.gif" alt="netgame" /></a></h1>';
netgameGnb			+=	'	<ul class="gnbMenu">';

netgameGnb			+=	'		<li><a href="javascript:netgameGnbGames()"><img src="'+netgameImg+'/gnb_games.gif" alt="ALL GAMES" /></a>';
netgameGnb			+=	'			<dl id="gnbGame" style="display:none;">';
netgameGnb			+=	'				<dt><img src="'+netgameImg+'/h_rpg.gif" alt="RPG/FPS" /></dt>';
netgameGnb			+=	'				<dd><a href="http://rode.netgame.com/"><img src="'+netgameImg+'/rpg_rode.gif" alt="RODE" /></a></dd>';
netgameGnb			+=	'				<dd><a href="http://cow.netgame.com/"><img src="'+netgameImg+'/rpg_cow.gif" alt="COW" /></a></dd>';
netgameGnb			+=	'				<dd><a href="http://hero.netgame.com/"><img src="'+netgameImg+'/rpg_hero.gif" alt="HERO" /></a></dd>';
netgameGnb			+=	'				<dd><a href="http://fate.netgame.com/"><img src="'+netgameImg+'/rpg_fate.gif" alt="Scions of FATE" /></a></dd>';
netgameGnb			+=	'				<dd><a href="http://op7.netgame.com/"><img src="'+netgameImg+'/rpg_op7.gif" alt="OPERATION 7" /></a></dd>';
netgameGnb			+=	'				<dd><a href="http://cloudnine.netgame.com/"><img src="'+netgameImg+'/rpg_cloudnine.gif" alt="Cloud Nine" /></a></dd>';
netgameGnb          +=  '               <dd><a href="http://mini.netgame.com/games/block-star"><img src="'+netgameImg+'/rpg_blockstar.gif" alt="Block Star" /></a></dd>';
netgameGnb          +=  '               <dd><a href="http://mini.netgame.com/games/music-shake"><img src="'+netgameImg+'/rpg_musicshake.gif" alt="Music Shake" /></a></dd>';
netgameGnb			+=	'			</dl>';
netgameGnb			+=	'		</li>';
netgameGnb			+=	'		<li><a href="javascript:netgameGnbMenu(1);"><img src="'+netgameImg+'/gnb_ncash.gif" alt="CHARGE nCash" /></a></li>';
netgameGnb			+=	'		<li><a href="javascript:netgameGnbSupport()"><img src="'+netgameImg+'/gnb_support.gif" alt="SUPPORT" /></a>';
netgameGnb			+=	'			<ul id="gnbSupport" style="display:none;">';
netgameGnb			+=	'				<li class="top"><a href="javascript:netgameGnbMenu(2);"><img src="'+netgameImg+'/support_download.gif" alt="DOWNLOAD" /></a></li>';
netgameGnb			+=	'				<li><a href="javascript:netgameGnbMenu(3);"><img src="'+netgameImg+'/support_account.gif" alt="MY ACCOUNT" /></a></li>';
netgameGnb			+=	'				<li><a href="javascript:netgameGnbMenu(4);"><img src="'+netgameImg+'/support_cs.gif" alt="CUSTOMER SERVICE" /></a></li>';

if(document.cookie.indexOf('MGUSA=') != -1 || document.cookie.indexOf('MGGNG=') != -1) 
{
	netgameGnb			+=	'				<li><a href="javascript:error(\'You already signed in. The menu can be used before you signed in.\');"><img src="'+netgameImg+'/support_sign.gif" alt="FREE SIGN UP NOW" /></a></li>';
}
else
{
	netgameGnb			+=	'				<li><a href="javascript:netgameAccount(1, \''+thisGame()+'\');"><img src="'+netgameImg+'/support_sign.gif" alt="FREE SIGN UP NOW" /></a></li>';
}

netgameGnb			+=	'			</ul>';
netgameGnb			+=	'		</li>';
netgameGnb			+=	'	</ul>';
netgameGnb			+=	'	<ul class="gnbNation">';
netgameGnb			+=	'		<li><a href="javascript:setLanguages(\'US\');"><img src="'+netgameImg+'/gnb_english.gif" alt="English" /></a></li>';
netgameGnb			+=	'		<li><a href="javascript:setLanguages(\'EP\');"><img src="'+netgameImg+'/gnb_espanol.gif" alt="Espanol" /></a></li>';
netgameGnb			+=	'		<li><a href="javascript:setLanguages(\'DE\');"><img src="'+netgameImg+'/gnb_deutsch.gif" alt="Deutsch" /></a></li>';
netgameGnb			+=	'		<li><a href="javascript:setLanguages(\'PT\');"><img src="'+netgameImg+'/gnb_portugues.gif" alt="Português" /></a></li>';
netgameGnb			+=	'		<li><a href="javascript:setLanguages(\'PL\');"><img src="'+netgameImg+'/gnb_poland.gif" alt="Język polski" /></a></li>';
netgameGnb			+=	'		<li><a href="javascript:setLanguages(\'RS\');"><img src="'+netgameImg+'/gnb_pyccknn.gif" alt="Русский" /></a></li>';
netgameGnb			+=	'		<li><a href="javascript:setLanguages(\'FR\');"><img src="'+netgameImg+'/gnb_francais.gif" alt="Français" /></a></li>';
netgameGnb			+=	'		<li><a href="javascript:setLanguages(\'TR\');"><img src="'+netgameImg+'/gnb_turkce.gif" alt="Türkçe" /></a></li>';
netgameGnb			+=	'		<li><a href="javascript:setLanguages(\'NL\');"><img src="'+netgameImg+'/gnb_nederland.gif" alt="Nederland" /></a></li>';
netgameGnb			+=	'	</ul>';

if(document.cookie.indexOf('MGUSA=') != -1 || document.cookie.indexOf('MGGNG=') != -1) 
{
	netgameGnb		+=	'<p class="gnbDate"><iframe src="http://www.netgame.com/lib/ifrmclock.php" width="125" height="20" frameborder="0" scrolling="no"></iframe> <span class="gnbLogout"><a href="javascript:netgameLogout()">Logout</a></span></p>';
}
else
{
	netgameGnb		+=	'<p class="gnbDate"><iframe src="http://www.netgame.com/lib/ifrmclock.php" width="125" height="20" frameborder="0" scrolling="no"></iframe></p>';
}

netgameGnb			+=	'</div>';


document.write(netgameGnb);

/*
document.write('<script type="text/javascript" src="http://www.netgame.com/lib_js/scriptLogger.js"></script>');
*/
