﻿// Domain Info
var __blnDev = (location.href.indexOf("http://gp-local-") == 0);
var __blnBeta = (location.href.indexOf("http://gp-beta-") == 0);
var __blnalpha20 = (location.href.indexOf("http://gp-alpha-") == 0);
var __blnalpha20Ssl = (location.href.indexOf("http://gp-alpha-") == 0);
var __blnlocal20Ssl = (location.href.indexOf("http://gp-local-") == 0);
var __blnbeta20Ssl = (location.href.indexOf("http://gp-beta-") == 0);
var __blnLive = true;

var __strHostPreFix = "http://";
var __strHostPreFix2 = "http://";
var __strHostPreFix2Ssl = "https://";

if (__blnDev) { __strHostPreFix = "http://gp-local-"; __blnLive = false; }
if (__blnBeta) { __strHostPreFix = "http://gp-beta-"; __blnLive = false; }
if (__blnalpha20) { __strHostPreFix = "http://gp-alpha-"; __blnLive = false; }
if (__blnalpha20Ssl) { __strHostPreFix2Ssl = "https://gp-alpha-"; __blnLive = false; }
if (__blnbeta20Ssl) { __strHostPreFix2Ssl = "https://gp-beta-"; __blnLive = false; }
if (__blnlocal20Ssl) { __strHostPreFix2Ssl = "https://gp-local-"; __blnLive = false; }
if (__blnLive) { __strHostPreFix2 = "https://" }


var __DOMAIN_TOP = "webzen.com";
var __DOMAIN_IMAGE = "image.webzen.com";
var __DOMAIN_PORTAL = __strHostPreFix + "www.webzen.com";
var __DOMAIN_MEMBER = __strHostPreFix + "member.webzen.com";
var __DOMAIN_FORUM = __strHostPreFix + "forum.webzen.com";
var __DOMAIN_ARCHLORD = __strHostPreFix + "archlord.webzen.com";
var __DOMAIN_SUNONLINE = __strHostPreFix + "sunonline.webzen.com";
var __DOMAIN_MUONLINE = __strHostPreFix + "muonline.webzen.com";
var __DOMAIN_UPLOAD = __strHostPreFix + "upload.webzen.com";
var __DOMAIN_FILES = __strHostPreFix + "files.webzen.com";
var __DOMAIN_PAYMENT = __strHostPreFix2Ssl + "pay.webzen.com";


// Message Info
var TEXT11 = "Please enter a vaild user ID.";
var TEXT12 = "The user ID must be a combination of alphabetic characters and numbers.";
var TEXT13 = "The user ID must consist of minimum 4 and maximum 20 characters.";
var TEXT14 = "The user ID cannot only contain numbers.";
var TEXT15 = "You have entered a filtered/blocked user ID string.";
var TEXT16 = "Please enter a valid password.";
var TEXT17 = "The password may only contain characters or numbers.";
var TEXT18 = "We recommended that you use a combination of alphabetic characters and numbers.";
var TEXT19 = "The password must consist of minimum 6 and maximum 20 characters.";
var TEXT20 = "Using 4 consecutive entries of letters or numbers are restricted. (ie.. 1,2,3,4 : ABCD)";
var TEXT21 = "Using 4 consecutive entries of the same characters are restricted. (ie.. 1111 : AAAA)";
var TEXT22 = "You cannot use the password which has at least 4 duplicate character string from the user ID.";
var TEXT27 = "The user ID and password must be differ.";
var TEXT29 = "You can cancel your account termination.";
var TEXT30 = "You have terminated your Webzen account. You may re-sign up within 90 days from the termination date.";
var TEXT31 = "You have terminated your Webzen account.";
var TEXT32 = "You have entered an invalid information or your account doesn't exist. Please try again.";
var TEXT33 = "Illegal access.";
var TEXT34 = "Five (5) failed login attempts. Your account is temporarily disabled, and you must wait at least 10 minutes before you try again. Please ensure that you have entered the correct user ID and password. If the problem continues, contact us at global_admin@webzen.com.";
var TEXT35 = "Unable to login to our website. IP address restrictions may be applied."
var TEXT37 = "Unexpected error has occurred please try again."
var TEXT49 = "failed login.Please try again."
var TEXT51 = "It is a situation of user ID limitation"
var TEXT63 = 'Please enter Item name.'


// Page Info
var arrMenu = new Array();

arrMenu[0] = new Array();
arrMenu[0][0] = { Seq: 0, Text: MENU00, link: "/Default.aspx" };

// News
arrMenu[1] = new Array();
arrMenu[1][0] = { Seq: 10, Text: MENU10, link: "/News/Notice/" };
arrMenu[1][1] = { Seq: 11, Text: MENU11, link: "/News/Notice/" };
arrMenu[1][2] = { Seq: 12, Text: MENU12, link: "/News/Event/" };

// Guides
arrMenu[2] = new Array();
arrMenu[2][0] = { Seq: 20, Text: MENU20, link: "/GameGuide/?nfc=2&nsc=1" };
arrMenu[2][1] = { Seq: 21, Text: MENU21, link: "/GameGuide/?nfc=2&nsc=1" };
arrMenu[2][2] = { Seq: 22, Text: MENU22, link: "/GameGuide/?nfc=2&nsc=2" };
arrMenu[2][3] = { Seq: 23, Text: MENU23, link: "/GameGuide/?nfc=2&nsc=3" };
arrMenu[2][4] = { Seq: 24, Text: MENU24, link: "/GameGuide/?nfc=2&nsc=4" };
arrMenu[2][5] = { Seq: 25, Text: MENU25, link: "/GameGuide/?nfc=2&nsc=5" };

arrMenu[2][1] = new Array();
arrMenu[2][1][0] = { Seq: 210, Text: MENU210, link: "/GameGuide/?nfc=2&nsc=1&ndc=1" };
arrMenu[2][1][1] = { Seq: 211, Text: MENU211, link: "/GameGuide/?nfc=2&nsc=1&ndc=1" };
arrMenu[2][1][2] = { Seq: 212, Text: MENU212, link: "/GameGuide/?nfc=2&nsc=1&ndc=2" };
arrMenu[2][1][3] = { Seq: 213, Text: MENU213, link: "/GameGuide/?nfc=2&nsc=1&ndc=3" };
//arrMenu[2][1][4] = {Seq:214,Text:MENU214,link:"/GameGuide/?nfc=2&nsc=1&ndc=4"};

arrMenu[2][2] = new Array();
arrMenu[2][2][0] = { Seq: 220, Text: MENU220, link: "/GameGuide/?nfc=2&nsc=2&ndc=1" };
arrMenu[2][2][1] = { Seq: 220, Text: MENU221, link: "/GameGuide/?nfc=2&nsc=2&ndc=1" };
arrMenu[2][2][2] = { Seq: 221, Text: MENU222, link: "/GameGuide/?nfc=2&nsc=2&ndc=2" };
arrMenu[2][2][3] = { Seq: 222, Text: MENU223, link: "/GameGuide/?nfc=2&nsc=2&ndc=3" };
arrMenu[2][2][4] = { Seq: 223, Text: MENU224, link: "/GameGuide/?nfc=2&nsc=2&ndc=4" };
//arrMenu[2][2][5] = {Seq:224,Text:MENU225,link:"/GameGuide/?nfc=2&nsc=2&ndc=5"};

arrMenu[2][3] = new Array();
arrMenu[2][3][0] = { Seq: 230, Text: MENU230, link: "/GameGuide/?nfc=2&nsc=3&ndc=1" };
arrMenu[2][3][1] = { Seq: 230, Text: MENU231, link: "/GameGuide/?nfc=2&nsc=3&ndc=1" };
arrMenu[2][3][2] = { Seq: 231, Text: MENU232, link: "/GameGuide/?nfc=2&nsc=3&ndc=2" };
arrMenu[2][3][3] = { Seq: 232, Text: MENU233, link: "/GameGuide/?nfc=2&nsc=3&ndc=3" };
arrMenu[2][3][4] = { Seq: 233, Text: MENU234, link: "/GameGuide/?nfc=2&nsc=3&ndc=4" };

arrMenu[2][4] = new Array();
arrMenu[2][4][0] = { Seq: 240, Text: MENU240, link: "/GameGuide/?nfc=2&nsc=4&ndc=1" };
arrMenu[2][4][1] = { Seq: 240, Text: MENU241, link: "/GameGuide/?nfc=2&nsc=4&ndc=1" };
arrMenu[2][4][2] = { Seq: 241, Text: MENU242, link: "/GameGuide/?nfc=2&nsc=4&ndc=2" };
arrMenu[2][4][3] = { Seq: 242, Text: MENU243, link: "/GameGuide/?nfc=2&nsc=4&ndc=3" };

arrMenu[2][5] = new Array();
arrMenu[2][5][0] = { Seq: 250, Text: MENU250, link: "/GameGuide/?nfc=2&nsc=5&ndc=1" };
arrMenu[2][5][1] = { Seq: 250, Text: MENU251, link: "/GameGuide/?nfc=2&nsc=5&ndc=1" };
arrMenu[2][5][2] = { Seq: 251, Text: MENU252, link: "/GameGuide/?nfc=2&nsc=5&ndc=2" };
arrMenu[2][5][3] = { Seq: 252, Text: MENU253, link: "/GameGuide/?nfc=2&nsc=5&ndc=3" };
arrMenu[2][5][4] = { Seq: 253, Text: MENU254, link: "/GameGuide/?nfc=2&nsc=5&ndc=4" };
arrMenu[2][5][5] = { Seq: 254, Text: MENU255, link: "/GameGuide/?nfc=2&nsc=5&ndc=5" };
arrMenu[2][5][6] = { Seq: 255, Text: MENU256, link: "/GameGuide/?nfc=2&nsc=5&ndc=6" };

// Forum
arrMenu[3] = new Array();
arrMenu[3][0] = { Seq: 30, Text: MENU30, link: __DOMAIN_FORUM };
arrMenu[3][1] = { Seq: 31, Text: MENU31, link: __DOMAIN_FORUM + "/forum73-archlord.aspx" };
arrMenu[3][2] = { Seq: 32, Text: MENU32, link: "/Community/FanSite/" };

// Media
arrMenu[4] = new Array();
arrMenu[4][0] = { Seq: 40, Text: MENU40, link: "/Media/ScreenShot/" };
arrMenu[4][1] = { Seq: 41, Text: MENU41, link: "/Media/ScreenShot/" };
arrMenu[4][2] = { Seq: 42, Text: MENU42, link: "/Media/WallPaper/" };
arrMenu[4][3] = { Seq: 43, Text: MENU43, link: "/Media/ConceptArt/" };

// Ranking
arrMenu[5] = new Array();
arrMenu[5][0] = { Seq: 50, Text: MENU50, link: "/Ranking/DailyTop100.aspx" };
arrMenu[5][1] = { Seq: 51, Text: MENU51, link: "/Ranking/DailyTop100.aspx" };
arrMenu[5][2] = { Seq: 52, Text: MENU52, link: "/Ranking/AccumulativeTop100.aspx" };
arrMenu[5][3] = { Seq: 53, Text: MENU53, link: "/Ranking/Guild.aspx" };
arrMenu[5][4] = { Seq: 54, Text: MENU54, link: "/Ranking/Siege.aspx" };
arrMenu[5][5] = { Seq: 55, Text: MENU55, link: "/Ranking/FinalBattle.aspx" };


// Shop
arrMenu[6] = new Array();
arrMenu[6][0] = { Seq: 60, Text: MENU60, link: "/ItemShop/Catalog/" };
arrMenu[6][1] = { Seq: 61, Text: MENU61, link: "/ItemShop/Catalog/" };
//arrMenu[6][2] = { Seq: 62, Text: MENU62, link: "http://new-itemshop.archlord.webzen.com/GameShop/ALShopMainFrm.asp" };
arrMenu[6][2] = { Seq: 62, Text: MENU62, link: "javascript:alert('Service will be available soon.');" };
arrMenu[6][3] = { Seq: 63, Text: MENU63, link: "/ItemShop/Guide/" };
arrMenu[6][4] = { Seq: 64, Text: MENU64, link: "" };


// Etc
arrMenu[7] = new Array();
arrMenu[7][0] = { Seq: 70, Text: MENU70, link: "" };
arrMenu[7][1] = { Seq: 71, Text: MENU71, link: "" };
arrMenu[7][2] = { Seq: 72, Text: MENU72, link: "" };
arrMenu[7][3] = { Seq: 73, Text: MENU73, link: "" };
arrMenu[7][4] = { Seq: 74, Text: MENU74, link: "" };
arrMenu[7][5] = { Seq: 75, Text: MENU75, link: "/_HTML/ActivexInstall.aspx" };

arrMenu[8] = new Array();
arrMenu[8][0] = { Seq: 80, Text: MENU80, link: __DOMAIN_PORTAL + "/Download/Archlord" };
arrMenu[8][1] = { Seq: 81, Text: MENU81, link: __DOMAIN_PORTAL + "/Download/Archlord" };


var _naviLoginSts = false;
function setNavLoginSts(blnSts)
{
	_naviLoginSts = blnSts;
}

function getNavLoginSts()
{
	return _naviLoginSts;
}

// Page Move
function fnGoMenu(intDepth1, intDepth2) {

	//Hide Menu
	//	if(arrMenu[intDepth1][intDepth2].Seq == 62)
	//	{
	//		alert("Service will be available soon.");
	//		return;
    //	}
    
	var strLink = "/default.aspx";

	try {

		if (typeof (arrMenu[intDepth1][intDepth2].length) == "undefined")
		{
			for (var intLoop = 0; intLoop < arrMenu[intDepth1].length; intLoop++)
			{
				if (intLoop == intDepth2)
				{
					if(getNavLoginSts())
				    {
				        if (intDepth1 == 6 && intLoop == 4) {				            
				            document.location.href = __DOMAIN_PAYMENT + "/BuyWCoin/";
					        break;
					    }
					    else {					        
					        strLink = arrMenu[intDepth1][intLoop].link;
					        document.location.href = strLink;
					        break;
			            }
			        }
			        else
			        {
			            if(intDepth1 == 6 && intLoop == 4)
				        {
				            document.location.href = __DOMAIN_LOGIN + "/Home/Login?ReturnUrl=" + __DOMAIN_PAYMENT + "/BuyWCoin/";
					        break;
					    }
					    else
					    {
					        strLink = arrMenu[intDepth1][intLoop].link;
					        document.location.href = strLink;
					        break;
			            }
			        }
				}
			}
		}
		else
		{
			var strMenu = String(intDepth2);
			var sMmenu = strMenu.substring(0, 1);
			var sSmenu = strMenu.substring(1, 2);

			for (var intLoop = 0; intLoop < arrMenu[intDepth1][intDepth2].length; intLoop++)
			{
				if (intLoop == sSmenu)
				{
					strLink = arrMenu[intDepth1][[intDepth2]][intLoop].link;
					document.location.href = strLink;
					break;
				}
			}
		}
	}
	catch (e)
	{
		document.location.href = strLink;
	}
}

// Left Menu
var old = '';
function fnMenu(name) {

	submenu = document.getElementById("guide_" + name + "").style;

	if (old != submenu)
	{
		if (old != '')
		{
			old.display = 'none';
		}
		submenu.display = 'block';
		old = submenu;
	}
	else
	{
		submenu.display = 'none';
		old = '';
	}
}

function printLeftMenu(intDepth1, intDepth2, intDepth3) {

    document.write("<div class=\"snb_wrap\">")
	document.write("<h2><span class=\"icon\">" + arrMenu[intDepth1][0].Text + "</span></h2>")
	document.write("<div class=\"subMenu_1dep_mid\">")
	document.write("<div class=\"subMenu_1dep_bottom\">");
    document.write("<div class=\"subMenu_1dep_top\">");
	document.write("<ul class=\"snb_1dep\">")

	for (var intLoop = 1; intLoop < arrMenu[intDepth1].length; intLoop++) {
		if (intDepth1 == 2) // Guides
		{
			var strMenu = String(intDepth2);
			var sMmenu = strMenu.substring(0, 1);
			var sSmenu = strMenu.substring(1, 2);

			document.write("<li class=\"d3_mnu\">");
			switch (intLoop)
			{
				case 1:
					strGuidesName = MENU21; //BASIC GUIDES
					break;
				case 2:
					strGuidesName = MENU22; //PLAYER INTERACTION
					break;
				case 3:
					strGuidesName = MENU23; //CHARACTER/SKILLS
					break;
				case 4:
					strGuidesName = MENU24; //ITEMS/QUESTS
					break;
				case 5:
					strGuidesName = MENU25; //MAPS
					break;
				default:
					strGuidesName = "N/A";
					break;
			}

			if (intDepth2 == intLoop)
			{
				document.write("<h3><a href=\"/GameGuide/\" onclick=\"fnMenu(" + intLoop + "); return false;\" class=\"on\">" + strGuidesName + "</a></h3>");
			}
			else
			{
				document.write("<h3><a href=\"/GameGuide/\" onclick=\"fnMenu(" + intLoop + "); return false;\" class=\"off\">" + strGuidesName + "</a></h3>");
			}

			document.write("<ul id=\"guide_" + intLoop + "\" style=\"display:none\">");

			document.write("<div class=\"subMenu_2dep_mid\" style=\"display: block;\">");
			document.write("<div class=\"subMenu_2dep_bottom\">");
			document.write("<div class=\"subMenu_2dep_top\">");

			for (var intLoopB = 1; intLoopB < arrMenu[intDepth1][intLoop].length; intLoopB++) 
            {

				if (intDepth2 == intLoop && intDepth3 == intLoopB)
				{
					document.write("<li><a href=\"" + arrMenu[intDepth1][intLoop][intLoopB].link + "\" class=\"m_on\">- " + arrMenu[intDepth1][intLoop][intLoopB].Text + "</a></li>");
				}
				else
				{
					document.write("<li><a href=\"" + arrMenu[intDepth1][intLoop][intLoopB].link + "\" class=\"m_off\">- " + arrMenu[intDepth1][intLoop][intLoopB].Text + "</a></li>");
            	}
            }

            document.write("</div>");
            document.write("</div>");
            document.write("</div>");

            document.write("</ul>");
			document.write("</li>");
		}
		else {

            if (intDepth2 == intLoop)
			{
			    //로그인 되어 있을 때
			    if(getNavLoginSts())
				{
				    // BUY W COIN 메뉴
			        if(intDepth1 == 6 && intLoop == 4)
			        {
				        document.write("<li class=\"d2_mnu\"><a href="+__DOMAIN_PAYMENT + "/BuyWCoin/"+" class=\"on\">" + arrMenu[intDepth1][intLoop].Text + "</a></li>")
			        }
			        else
			        {
			            document.write("<li class=\"d2_mnu\"><a href=\"" + arrMenu[intDepth1][intLoop].link + "\" class=\"on\">" + arrMenu[intDepth1][intLoop].Text + "</a></li>")
			        }
			    }
			    //로그인 되어 있지 않을 경우
			    else
			    {
			         // BUY W COIN 메뉴
			        if(intDepth1 == 6 && intLoop == 4)
			        {
				        document.write("<li class=\"d2_mnu\"><a href="+__DOMAIN_LOGIN + "/Home/Login?ReturnUrl=" + __DOMAIN_PAYMENT + "/BuyWCoin/"+" class=\"on\">" + arrMenu[intDepth1][intLoop].Text + "</a></li>")
			        }
			        else
			        {
			            document.write("<li class=\"d2_mnu\"><a href=\"" + arrMenu[intDepth1][intLoop].link + "\" class=\"on\">" + arrMenu[intDepth1][intLoop].Text + "</a></li>")
			        }
			    }
			}
			else {
				    // BUY W COIN 메뉴
				    if (intDepth1 == 6 && intLoop == 4) {
			            document.write("<li class=\"d2_mnu\"><a href=" + __DOMAIN_PAYMENT + "/BuyWCoin/" + " class=\"off\">" + arrMenu[intDepth1][intLoop].Text + "</a></li>")
				    }
				    else {				        
				        document.write("<li class=\"d2_mnu\"><a href=\"" + arrMenu[intDepth1][intLoop].link + "\" class=\"off\">" + arrMenu[intDepth1][intLoop].Text + "</a></li>")
				    }
			}
        }
    }
    document.write("</ul>");
    document.write("</div>");
    document.write("</div>");    
    document.write("</div>")
	document.write("</div>")

	if (intDepth1 == 2) // Guides
	{
		submenu = document.getElementById('guide_' + intDepth2).style;

		if (old != submenu)
		{
			if (old != '')
			{
				old.display = 'none';
			}
			submenu.display = 'block';
			old = submenu;
		}
		else
		{
			submenu.display = 'none';
			old = '';
		}
	}
}

// Page Navi
function printHistory(intDepth1, intDepth2, intDepth3) {

	var strMenu = String(intDepth2);
	var sMmenu = strMenu.substring(0, 1);
	var sSmenu = strMenu.substring(1, 2);

	document.write("<div class=\"locationtitle\">")
	document.write("<div class=\"location\">")
	document.write("<a href=\"/Default.aspx\" class=\"home\">" + arrMenu[0][0].Text + "</a>")

	if (intDepth2 == 0)
	{
		document.write(" &gt; <strong>" + arrMenu[intDepth1][0].Text + "</strong>")
		document.write("</div>")
		document.write("<h3 class=\"subtitle\">" + arrMenu[intDepth1][intDepth2].Text + "</h3>")
	}
	else if (intDepth1 == 2)  // Guides
	{
		switch (intDepth2)
		{
			case 1:
				strGuidesName = MENU21; //BASIC GUIDES
				strGuidesLink = "/GameGuide/?nfc=2&nsc=1";
				break;
			case 2:
				strGuidesName = MENU22; //PLAYER INTERACTION
				strGuidesLink = "/GameGuide/?nfc=2&nsc=2";
				break;
			case 3:
				strGuidesName = MENU23; //CHARACTER/SKILLS
				strGuidesLink = "/GameGuide/?nfc=2&nsc=3";
				break;
			case 4:
				strGuidesName = MENU24; //ITEMS/QUESTS
				strGuidesLink = "/GameGuide/?nfc=2&nsc=4";
				break;
			case 5:
				strGuidesName = MENU25; //MAPS
				strGuidesLink = "/GameGuide/?nfc=2&nsc=5";
				break;
			default:
				strGuidesName = "";
				strGuidesLink = "";
				break;
		}

		if (intDepth3 > 0)
		{
			document.write(" &gt; <a href=\"" + arrMenu[intDepth1][0].link + "\" class=\"home\"> " + arrMenu[intDepth1][0].Text + "</a>")
			document.write(" &gt; <a href=\"" + strGuidesLink + "\" class=\"home\"> " + strGuidesName + "</a>");
		}
		

		for (var intLoop = 1; intLoop < arrMenu[intDepth1][sMmenu].length; intLoop++)
		{
			if (intDepth3 == intLoop)
			{
				document.write(" &gt; <strong>" + arrMenu[intDepth1][sMmenu][intLoop].Text + "</strong>")
				break;
			}
		}

		document.write("</div>")
		document.write("<h3 class=\"subtitle\">" + arrMenu[intDepth1][sMmenu][intLoop].Text + "</h3>")
	}
	else {

		document.write(" &gt; <a href=\"" + arrMenu[intDepth1][0].link + "\" class=\"home\">" + arrMenu[intDepth1][0].Text + "</a>")

		for (var intLoop = 1; intLoop < arrMenu[intDepth1].length; intLoop++)
		{
			if (intDepth2 == intLoop)
			{
				document.write(" &gt; <strong>" + arrMenu[intDepth1][intLoop].Text + "</strong>")
				break;
			}
		}

		document.write("</div>")
		document.write("<h3 class=\"subtitle\">" + arrMenu[intDepth1][intDepth2].Text + "</h3>")
	}

	document.write("</div>")
}

// Page Move Forum
function fnGoForum()
{
	var strLink = __DOMAIN_FORUM + "/default.aspx";

	document.location.href = strLink;
}
