﻿/* NCsoft UIDev Part Script Library, global.js ver 0.53
 * (c) 2007 NCsoft UIDev ; http://webuidev.ncsoft.net
 *
 * this file for common case
 * last update : 2006/01/25 (surprise@ncsoft.net)
/* ------------------------------------------------------ */


/* -------------- using top ----------------- */
//image over
function imgOver(imgObj){
	var imgSrc = imgObj.src;
	var imgSrcOver = imgSrc.replace("_off.", "_on.");
	imgObj.src = imgSrcOver;
}

//image out
function imgOut(imgObj){
	var imgSrc = imgObj.src;
	var imgSrcOut = imgSrc.replace("_on.", "_off.");
	imgObj.src = imgSrcOut;
}

//tr bgcolor change
function chgClass(selobj, cn){
	if(cn==null) selobj.className = "";
	else selobj.className = cn;	
}

/* -------------- using top ----------------- */




//open popup ; normal
function openPopup(url, width, height, scroll, winName){
	var url = url;
	var setup = "width=" + width + ",height=" + height + ",toolbar=no,location=no,status=no,menubar=no,top=20,left=20,scrollbars=" + scroll +",resizable=no" ;
	if (winName == "" || !winName) winName = "popup"; 
	var win = window.open(url, winName, setup);
	win.focus();
}

//open popup ; show alert message if popup is denied
function openDenyPopup(url, width, height, scroll, winName){
	var setup = "width=" + width + ",height=" + height + ",toolbar=no,location=no,status=no,menubar=no,top=20,left=20,scrollbars=" + scroll +",resizable=no" ;
	
	if (winName == "" || !winName) winName = "popup"; 
	var win = window.open(url,winName,setup);
	
	if (win == null) alert("i°¨e?¨e?? i??i??i°½i?? i??i?ⓒi?´ i￡¼i?­i??i?¤.");
	else win.focus();
}

//go url
function goUrl(url){
	window.location.href=url;
}

//go url replace
function goUrlReplace(url){
	window.location.replace(url);
}

//open full screen
function openFullScreen(url){
	var setup = "fullscreen=1,scrollbars=0";
	var win = window.open(url,"popup",setup);
}

//reload page
function reloadPage(){
	self.location.reload(); 
}

//footer > open family site
function openFamilySite(sel){
	var url = document.getElementById(sel).value;
	if(url != "") window.open(url);
}

//image over ; below ver 1.2 (don't use replace())
function imgOver2(imgObj)
{
	var orgImgSrc = imgObj.src;
	var cutNum = orgImgSrc.length - 4;
	var newImgSrc = orgImgSrc.substring(0, cutNum);
	var overImgSrc = newImgSrc + "_on.gif";
	imgObj.src = overImgSrc;
}

//image out ; below ver 1.2 (don't use replace())
function imgOut2(imgObj)
{
	var orgImgSrc = imgObj.src;
	var cutNum = orgImgSrc.length - 7;
	var newImgSrc = orgImgSrc.substring(0, cutNum);
	var overImgSrc = newImgSrc + ".gif";
	imgObj.src = overImgSrc;
}

/* -------------------------------------------------------------------------------- */

//change Over Row Class
function changeOverRowClass(elId, tagName, searchClass) {
	if(document.getElementById(elId) == null) return; 
	var el = document.getElementById(elId).getElementsByTagName(tagName);

	for (i=0; i<el.length; i++) {
		if (el[i].className == searchClass || el[i].className == searchClass + " on") {
			el[i].onmouseover = changeOverRowClassOver;
			el[i].onmouseout = changeOverRowClassOut;
		}
	}
}

function changeOverRowClassOver() {
	if (this.className == "") {
		this.className = this.className + " on";
	} else {
		this.className = "on";
	}
}

function changeOverRowClassOut() {
	if (this.className == "on") {
		this.className = "";
	} else {
		this.className = this.className.replace(" on", "");
	}
}


//check Flash Version
function MM_CheckFlashVersion(reqVerStr,msg){
  with(navigator){
    var isIE  = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);
    var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
    if (!isIE || !isWin){  
      var flashVer = -1;
      if (plugins && plugins.length > 0){
        var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";
        desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc;
        if (desc == "") flashVer = -1;
        else{
          var descArr = desc.split(" ");
          var tempArrMajor = descArr[2].split(".");
          var verMajor = tempArrMajor[0];
          var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");
          var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;
          flashVer =  parseFloat(verMajor + "." + verMinor);
        }
      }
      // WebTV has Flash Player 4 or lower -- too low for video
      else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0;

      var verArr = reqVerStr.split(",");
      var reqVer = parseFloat(verArr[0] + "." + verArr[2]);
  
      if (flashVer < reqVer){
        if (confirm(msg))
          window.location = "http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
      }
    }
  } 
}

//show Flash Object ; 1
function showFlashObject(objID, objSource, objWidth, objHeight, objQuality, objWmode, objBgcolor){
	//page url
	var pageUrl=self.window.location.href;
	if(pageUrl.substring(0,5)=="https") swfUrl="https";
	else swfUrl="http";
	//default value setting
	if (objID=="") objID="ShockwaveFlash1";
	if (objWidth=="") objWidth="0";
	if (objHeight=="") objHeight="0";
	if (objQuality=="") objQuality="high";
	if(objWmode=="") objWmode="transparent";
	else objWmode="";

	document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+swfUrl+'://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,124,0" width="'+objWidth+'" height="'+objHeight+'" id="'+objID+'" align="middle">');
	document.writeln('<param name="movie" value="'+objSource+'" />');
	document.writeln('<param name="allowScriptAccess" value="always" />');
	document.writeln('<param name="menu" value="false" />');
	document.writeln('<param name="quality" value="high" />');
	document.writeln('<param name="bgcolor" value="'+objBgcolor+'" />');
	document.writeln('<param name="wmode" value="'+objWmode+'" />');
	document.writeln('<embed src="'+objSource+'" allowScriptAccess="always" menu="false" quality="high" bgcolor="'+objBgcolor+'" wmode="'+objWmode+'" width="'+objWidth+'" height="'+objHeight+'" name="'+objID+'" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.writeln('</object>');
}


//show Media Object ; 1
function showMediaObject(objID, objSource, objWidth, objHeight, autostart, showcontrols){
	//default value setting
	if (objID=="") objID="MovieClip1";
	if (objWidth=="") objWidth="400";
	if (objHeight=="") objHeight="345";
	if (autostart=="") autostart="1";
	if (showcontrols=="") showcontrols="0";
	
	document.writeln('<object classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" id="'+objID+'" width="'+objWidth+'" height="'+objHeight+'">');
	document.writeln('<param name="AutoSize" value="1">');
	document.writeln('<param name="AutoStart" value="'+autostart+'">');
	document.writeln('<param name="AutoRewind" value="1">');
	document.writeln('<param name="ClickToPlay" value="0">');
	document.writeln('<param name="Enabled" value="1">');
	document.writeln('<param name="EnableTracker" value="1">');
	document.writeln('<param name="EnableContextMenu" value="0">');
	document.writeln('<param name="ShowStatusBar" value="0">');
	document.writeln('<param name="ShowControls" value="'+showcontrols+'">');
	document.writeln('<param name="ShowAudioControls" value="'+showcontrols+'">');
	document.writeln('<param name="ShowCaptioning" value="0">');
	document.writeln('<param name="Mute" value="0">');
	document.writeln('<param name="ShowDisplay" value="0">');
	document.writeln('<param name="filename" value="'+objSource+'">');
	document.writeln('<!--[if !IE]>-->');
	document.writeln('	<object type="video/x-ms-wmv" data="'+objSource+'" width="'+objWidth+'" height="'+objHeight+'">');
	document.writeln('	<param name="AutoStart" value="'+autostart+'">');
	document.writeln('	<param name="AutoRewind" value="1">');
	document.writeln('	<param name="Enabled" value="1">');
	document.writeln('	<param name="EnableTracker" value="1">');
	document.writeln('	<param name="EnableContextMenu" value="0">');
	document.writeln('	<param name="ShowStatusBar" value="0">');
	document.writeln('	<param name="ShowControls" value="'+showcontrols+'">');
	document.writeln('	<param name="ShowAudioControls" value="'+showcontrols+'">');
	document.writeln('	<param name="ShowCaptioning" value="0">');
	document.writeln('	<param name="ShowDisplay" value="0">');
	document.writeln('	<param name="url" value="'+objSource+'">');
	document.writeln('	<param name="src" value="'+objSource+'">');	
	document.writeln('	</object>');	
	document.writeln('<!--<![endif]-->');
	document.writeln('</object>');
}


//show Flash, Media Object setting
var paramInfo = new Array;

function initParam()
{
	var oldSize = paramInfo.length;

	for (var i=0; i<oldSize; i++) {
		paramInfo.length--;
	}	
}

function setParam(paramName, paramValue)
{
	var idx = paramInfo.length;

	paramInfo[idx] = [];
	paramInfo[idx][0] = paramName;  
	paramInfo[idx][1]= paramValue;
}

//show Flash Object ; 2
function playFlash(objID, objSource, objWidth, objHeight, objStyle, cabVersion, embedAttr)
{
	document.write('<OBJECT id="' + objID + '" name="' + objID + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');

	if (cabVersion != '') {
		document.write('codebase="' + self.window.document.protocol + '"://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + cabVersion + '" ');
	}
	document.write('WIDTH="' + objWidth + '" HEIGHT="' + objHeight + '" ' + objStyle + '>');

	for (var i=0; i<paramInfo.length; i++) {
		document.write('<PARAM NAME="' + paramInfo[i][0] + '" VALUE="'+ paramInfo[i][1] +'">');		
	}	
	
	document.write('<embed src="' + objSource + '" width="' + objWidth + '" height="' + objHeight + '" ' + embedAttr + '>');
	document.write('</OBJECT>');
}

//show Media Object ; 2
function playMedia(objID, objSource, objWidth, objHeight, objStyle)
{
	document.write('<OBJECT id="' + objID + '" name="' + objID + '" classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" ');
	document.write('WIDTH="' + objWidth + '" HEIGHT="' + objHeight + '" ' + objStyle + '>');

	for (var i=0; i<paramInfo.length; i++) {
		document.write('<PARAM NAME="' + paramInfo[i][0] + '" VALUE="'+ paramInfo[i][1] +'">');		
	}	
	
	document.write('</OBJECT>');
}


// hide obj
function hidddenF(objId)
{
	document.getElementById(objId).style.display = "none";
}

/* WallPaper Preview
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
function wallpaperPreview(previewImg)
{
	var e = document.documentElement.clientHeight;
	var winScrollTop = e? document.documentElement.scrollTop : pageYOffset; // i?¤i?￢e¡¤ i??i?￢ Yi¶? i??i¹?
	if (winScrollTop < 260)
	{
		winScrollTop = 260;
	}
	document.getElementById("popWallpaper").style.display = "block";
	document.getElementById("popWallpaper").style.top = winScrollTop + "px";
	document.getElementById("popWallpaperImg").innerHTML = "<img src='"+previewImg+"' alt='' />";
}


/* Event Zone
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
// obj : selected item
// cnt : item count
// pn : parentNode
function eventZone(obj, cnt, pn)
{
	var st = obj.substring(0, obj.length-1);
	var onImgNum = obj.substring(obj.length-1, obj.length);
	for (i=1; i<=cnt; i++)
	{
		document.getElementById(st + i).style.display = "none"; // 전체 컨텐츠 숨김
		document.getElementById(st + "Img" + i).src = document.getElementById(st + "Img" + i).src.replace("_on.", "_off."); // 전체 메뉴 오프이미지로 교체
		if (pn)
		{
			pn.parentNode.getElementsByTagName("li")[i-1].className = ""; // 전체 메뉴 오프 스타일로 교체
		}
	}
	document.getElementById(obj).style.display = ""; // 현재 컨텐츠 보여줌
	document.getElementById(st + "Img" + onImgNum).src = document.getElementById(st + "Img" + onImgNum).src.replace("_off.", "_on."); // 현재 메뉴 온이미지로 교체
	if (pn)
	{
		pn.parentNode.getElementsByTagName("li")[onImgNum-1].className = "select"; // 현재 메뉴 온 스타일로 교체
	}
}

/* 2007.05.02 : start */
function eventZoneRolling(objId, cnt, interval_ms, initNum)
{
	var obj = this;
	var num = initNum;
	var interval;

	obj.repeat = function() {
		if (eventZoneActiveMenuNum != 0)
		{
			num = eventZoneActiveMenuNum + 1;
			if (num > cnt) num = 1;
		}

		eventZone('eventConent'+num, 4, document.getElementById("eventConentMenu").getElementsByTagName("li")[num-1]);

		num = num + 1;
		if (num > cnt) num = 1;
		eventZoneActiveMenuNum = 0;
		interval = setTimeout(function(){obj.repeat();}, interval_ms);		
	}
	obj.repeat();
	objId.onmouseover = function() {clearTimeout(interval);}
	objId.onmouseout = function() {interval = setTimeout(function(){obj.repeat();}, interval_ms);}
}

var eventZoneActiveMenuNum = 0;
function eventZoneActiveNum(activeNum)
{
	eventZoneActiveMenuNum = activeNum;
}

function eventZoneRollingLoad()
{
	var num;

	num = parseInt(Math.random() * document.getElementById("eventConentMenu").getElementsByTagName("li").length) + 1;
	//num = 3;
	eventZone('eventConent'+num, 4, document.getElementById("eventConentMenu").getElementsByTagName("li")[num-1]);

	if (document.getElementById("eventConent"))
	{
		eventZoneRolling(document.getElementById("eventConent"), document.getElementById("eventConentMenu").getElementsByTagName("li").length, 7000, num);
	}
}
/* 2007.05.02 : end */


/* main event */
function toggleEventMenu(idx) {
	var el_event_ing = document.getElementById('event_ing');
	var el_event_game = document.getElementById('event_game');
	var el_event_ing_cnt = document.getElementById('event_ing_cnt');
	var el_event_game_cnt = document.getElementById('event_game_cnt');

	if(idx) {
		el_event_ing.src = "http://static.plaync.co.kr/gate/layout/tab_event1_off.gif";
		el_event_game.src = "http://static.plaync.co.kr/gate/layout/tab_event2_on.gif";
		el_event_ing_cnt.style.display = "none";
		el_event_game_cnt.style.display = "block";
	} else {
		el_event_ing.src = "http://static.plaync.co.kr/gate/layout/tab_event1_on.gif";
		el_event_game.src = "http://static.plaync.co.kr/gate/layout/tab_event2_off.gif";
		el_event_ing_cnt.style.display = "block";
		el_event_game_cnt.style.display = "none";
	}
}


function wrap_rank(obj)
{
	document.getElementById(obj).style.display = "block";
}

// 2007.05.22 : start
function signBannerTypeA(obj, totalCnt, displayCnt, signBannerHeight)
{
	var num = 0;
	
	if (totalCnt == 0)
	{
		obj.innerHTML = "<li>해당항목이 없습니다.</li>";
		return;
	}
	if (displayCnt >= totalCnt)
	{
		return;
	}
	
	obj.innerHTML = obj.innerHTML + "<li style='top: 0px;'>" + obj.getElementsByTagName("li")[0].innerHTML + "</li>";

	this.move = function() {
		if (obj.getElementsByTagName("li")[0].style.top != "-"+signBannerHeight+"px")
		{
			for (i=0; i<obj.getElementsByTagName("li").length; i++)
			{
				obj.getElementsByTagName("li")[i].style.top = parseInt(obj.getElementsByTagName("li")[i].style.top) - 1 + "px";
			}		
			setTimeout(function(){this.move()}, 1);
		}
		else
		{
			this.displayF();
		}
	}
	this.displayF = function() {
		for (i=0; i<obj.getElementsByTagName("li").length; i++)
		{
			obj.getElementsByTagName("li")[i].style.top = "0px";
		}
		obj.getElementsByTagName("li")[num].style.display = "none";
		num = num + 1;
		if (num+1 >= obj.getElementsByTagName("li").length)
		{
			for (i=0; i<obj.getElementsByTagName("li").length; i++)
			{
				obj.getElementsByTagName("li")[i].style.top = "0px";
				obj.getElementsByTagName("li")[i].style.display = "";
			}
			num = 0;
		}
		setTimeout(function(){this.move()}, 1500);
	}
	setTimeout(function(){this.move()}, 1500);
}

// modified by netspider
// use window.attachEvent("onload", setRollingPopularKeyword) instead of .onload
function rollingPopularKeyword()
{
	if (!document.getElementById("signBannerBoard1")) return false;
	signBannerTypeA(document.getElementById("signBannerBoard1"), document.getElementById("signBannerBoard1").getElementsByTagName("li").length, 1, 20);
}

// 2007.04.26 : jhk1026
//if (window.attachEvent) window.attachEvent("onload", rollingPopularKeyword);
//else window.addEventListener("load", rollingPopularKeyword, false);
// 2007.05.22 : end

// login game
function loginGameSelectF(obj, loginForm)
{
	if (document.getElementById("loginGameArea").style.height == "50px")
	{
		document.getElementById("loginGameList").style.display = "none";
		document.getElementById("loginGameSelected").style.display = "block";		
		document.getElementById("loginGameArea").style.height = "15px";
		if (obj)
		{
			var frm = $(loginForm);
			frm.game_id.value = obj.code;
			document.getElementById("loginGameSelected").innerHTML = obj.name;
		}
	}
	else
	{
		document.getElementById("loginGameSelected").style.display = "none";
		document.getElementById("loginGameList").style.display = "block";
		document.getElementById("loginGameArea").style.height = "50px";
	}
}

/* 2007-11-19 : start */
var _loginTxtFocus = null;
function loginTxtFocus(obj){
	_loginTxtFocus = obj;
}

function loginTxtFocusLoad(){
	if(_loginTxtFocus != null) _loginTxtFocus.focus();
}

if (window.attachEvent) window.attachEvent("onload", loginTxtFocusLoad);
else window.addEventListener("load", loginTxtFocusLoad, false);
/* 2007-11-19 : end */

/* 큐브 이벤트 : FAQ */
function cubeFaq(orderNum)
{
	if (document.getElementById("cubeFaq").getElementsByTagName("dd")[orderNum-1].style.display == "block")
	{
		document.getElementById("cubeFaq").getElementsByTagName("dd")[orderNum-1].style.display = "none";
	}
	else 
	{
		for (i=0; i<document.getElementById("cubeFaq").getElementsByTagName("dd").length; i++)
		{
			document.getElementById("cubeFaq").getElementsByTagName("dd")[i].style.display = "none";
		}
		document.getElementById("cubeFaq").getElementsByTagName("dd")[orderNum-1].style.display = "block";
	}
}

function openPopupDefault(url, winName) {
	if (winName == "" || !winName) winName = "popup"; 
	var win = window.open(url,winName, '');
	
	if (win == null) alert("팝업 차단을 해제해 주시기 바랍니다.");
	else win.focus();
}

/* 2007.05.14 : start */
// playNC 통합계정 안내
function openPopupAccountInfo()
{
	document.getElementById("popupAccount").style.display = "block";
}
/* 2007.05.14 : end */




// 팝업 쿠키 관리
function getCookie(strName)
	{

	var strArg = new String(strName + "=");	
	var nArgLen, nCookieLen, nEnd;
	var i = 0, j;
	
	nArgLen    = strArg.length;
	nCookieLen = document.cookie.length;
	
	if(nCookieLen > 0) {
		while(i < nCookieLen) {
		
			j = i + nArgLen;
			
			if(document.cookie.substring(i, j) == strArg) {
			
				nEnd = document.cookie.indexOf (";", j);
				
				if(nEnd == -1) nEnd = document.cookie.length;
				
				return unescape(document.cookie.substring(j, nEnd));
			 
			}
			
			i = document.cookie.indexOf(" ", i) + 1;
			if (i == 0) break;
		}
	}
	
	return("");

	}

/*
// New Service Area 
function newServiceAreaF()
{
	var itemCnt = document.getElementById("newServiceArea").getElementsByTagName("a").length;
	if (document.getElementById("newServiceArea") && itemCnt > 1)
	{
		var num;
		num = parseInt(Math.random() * itemCnt);
		for (i=0; i<document.getElementById("newServiceArea").getElementsByTagName("a").length; i++)
		{
			document.getElementById("newServiceArea").getElementsByTagName("a")[i].style.display = "none";
		}
		document.getElementById("newServiceArea").getElementsByTagName("a")[num].style.display = "";
	}
}
*/

function newServiceAreaF(obj)
{
	var itemCnt = obj.getElementsByTagName("a").length;
	if (obj && itemCnt > 1)
	{
		var num;
		num = parseInt(Math.random() * itemCnt);
		for (i=0; i<obj.getElementsByTagName("a").length; i++)
		{
			obj.getElementsByTagName("a")[i].style.display = "none";
		}
		obj.getElementsByTagName("a")[num].style.display = "";
	}
}

function objRotationF(obj, interval)
{
	// init
	var itemTotalCnt = obj.getElementsByTagName("a").length;
	var activeCnst = parseInt(Math.random() * itemTotalCnt);
	
	// temp
	for (i=0; i<obj.getElementsByTagName("a").length; i++)
	{
		obj.getElementsByTagName("a")[i].style.display = "none";
	}
	obj.getElementsByTagName("a")[activeCnst].style.display = "";
	
	// Repeat
	obj.repeat = function() {
		obj.getElementsByTagName("a")[activeCnst].style.display = "none";
		activeCnst = activeCnst + 1;
		if (activeCnst >= itemTotalCnt)
		{
			activeCnst = 0;
		}
		obj.getElementsByTagName("a")[activeCnst].style.display = "";		
		this.obj = setTimeout(function(){obj.repeat()}, interval);
	}

	// Repeat 여부 체크
	if (itemTotalCnt > 1)
	{
		obj.repeat();
	}	
}

//////////////////////////////////////////////////////////////////////////////
//로그인 도움말
//////////////////////////////////////////////////////////////////////////////
	function ncShowLoginX(e)
	{
		var eX;
		if (window.event)
		{
			if (document.documentElement.clientWidth)
			{
				eX = event.clientX + document.documentElement.scrollLeft;
			}
			else
			{
				eX = event.clientX + document.body.scrollLeft;
			}
		}
		else
		{
			eX = e.pageX;
		}
		return eX;
	}


	function ncShowLoginY(e)
	{
		var eY;
		if (window.event)
		{
			if (document.documentElement.clientHeight)
			{
				eY = event.clientY + document.documentElement.scrollTop;
			}
			else
			{
				eY = event.clientY + document.body.scrollTop;
			}
		}
		else
		{
			eY = e.pageY;
		}
		return eY;
	}

	function ncShowLogin(e,layername)
	{
		var x = ncShowLoginX(e);
		var y = ncShowLoginY(e);
		
		//document.getElementById("result").value = "x=" + x + ", y=" + y;
		
		if(layername == "logintip1"){
			document.getElementById("logintip1").style.display = "block";
			document.getElementById("logintip1").style.top = y + "px";
			document.getElementById("logintip1").style.left = x + "px";
		}else{
			document.getElementById("logintip2").style.display = "block";
			document.getElementById("logintip2").style.top = y + "px";
			document.getElementById("logintip2").style.left = x + "px";
		}
		//document.getElementById("result").value = "x=" + x + ", y=" + y;
	}

	function hideAll(){
		document.getElementById("logintip1").style.display = "none";
		document.getElementById("logintip2").style.display = "none";
	}



	///////////////////////////////////////////////////////////////////////////
	// PlayNC 주목e-게임!                                                    //
	///////////////////////////////////////////////////////////////////////////
	
	var itemRotationTypeB = function(prntObj, chldTag, btnPrev, btnNext) {
		var itemTotalCnt = 0;
		var activeCnst = 0;
		var activeNodeCnst;
		var _itemReArray = new Array();

		for (i=0; i<prntObj.childNodes.length; i++)
		{
			if (prntObj.childNodes[i].nodeName.toUpperCase() == chldTag.toUpperCase())
			{
				_itemReArray[itemTotalCnt] = i;
				itemTotalCnt += 1;
				prntObj.childNodes[i].style.display = "none";
			}
		}
		
		activeCnst = parseInt(Math.random() * itemTotalCnt);
		activeNodeCnst = parseInt(_itemReArray[activeCnst]);
		prntObj.childNodes[activeNodeCnst].style.display = "";
		
		prntObj.btnF = function(orderFlag) {
			activeNodeCnst = parseInt(_itemReArray[activeCnst]);
			prntObj.childNodes[activeNodeCnst].style.display = "none";
			if (orderFlag == "next")
			{
				activeCnst += 1;
				if (activeCnst >= itemTotalCnt) activeCnst = 0;
			}
			else if (orderFlag == "prev")
			{
				activeCnst -= 1;
				if (activeCnst < 0) activeCnst = itemTotalCnt - 1;
			}
			activeNodeCnst = parseInt(_itemReArray[activeCnst]);
			prntObj.childNodes[activeNodeCnst].style.display = "";
		}

		// user action
		btnPrev.onclick = function() {prntObj.btnF("prev")};
		btnNext.onclick = function() {prntObj.btnF("next")};
	}

// main2nd event
function togEventMenu(idx) {
	var el_event_ing = document.getElementById('event_ing');
	var el_event_game = document.getElementById('event_game');
	var el_event_ing_cnt = document.getElementById('event_ing_cnt');
	var el_event_game_cnt = document.getElementById('event_game_cnt');

	if(idx) {
		el_event_ing.src = "http://static.plaync.co.kr/gate/main2nd/tab_event1off.gif";
		el_event_game.src = "http://static.plaync.co.kr/gate/main2nd/tab_event2on.gif";
		el_event_ing_cnt.style.display = "none";
		el_event_game_cnt.style.display = "block";
	} else {
		el_event_ing.src = "http://static.plaync.co.kr/gate/main2nd/tab_event1on.gif";
		el_event_game.src = "http://static.plaync.co.kr/gate/main2nd/tab_event2off.gif";
		el_event_ing_cnt.style.display = "block";
		el_event_game_cnt.style.display = "none";
	}
}

/*20071026*/

function viewTheme() {
	document.getElementById("today_theme").style.display = "none"
	document.getElementById("view_theme").style.display = "block"
}
function todayTheme() {
	document.getElementById("today_theme").style.display = "block"
	document.getElementById("view_theme").style.display = "none"
}

function goplaync() {
	document.location.href = "/";
}

function promotion_more() {
	document.location.href = "http://www.plaync.co.kr/event/eventlist";
}

function lolgamebanner(popurl, popwidth, popheight, isscroll,logid) {
	//alert("popwidth="+popwidth+"- popheight="+popheight+"- isscroll="+isscroll+"- popurl="+popurl);
	try{_trk_clickTrace("EVT", logid);}catch(_e){}
	if(popwidth == "0" && popheight == "0") {
		if(isscroll == "0" ) {
			document.location.href= popurl;
			} else {
				window.open(popurl,"_blank");
			}
	} else {
			openPopup(popurl,popwidth,popheight,isscroll,"lolgamebanner" );
		}
}

/* Flash Banner & XML
-------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/*
objID			: 플래시 아이디
objSource		: 플래시 파일 이름 및 경로
objXML			: 플래시에 입력될 xml 파일 이름
objWidth		: 플래시 가로 사이즈
objHeight		: 플래시 세로 사이즈
objQuality	: 플래시 무비 퀄러티
objWmode	: 플래시 Wmode
objBgcolor	: 플래시 배경색
*/
function flashBannerObject(objID, objSource, objXML, objWidth, objHeight, objQuality, objWmode, objBgcolor)
{
	var cntT;
	var xmlDoc;
	var bannerPriorityCnstT = 0;
	
	try
	{
		if (window.ActiveXObject)
		{
			xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
			xmlDoc.async=false;
			xmlDoc.load(objXML);
		}
		else
		{
			var xmlHttp = false;
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			xmlHttp.open("get", objXML, false);
			xmlHttp.send(null);

			xmlDoc = xmlHttp.responseXML;
		}

		if (window.ActiveXObject)
		{
			cntT = xmlDoc.getElementsByTagName("dataInfo")[0].childNodes.length;
		}
		else
		{
			var cntW = xmlDoc.getElementsByTagName("dataInfo")[0].childNodes.length;
			cntT = (cntW-1) / 2;
		}

		for (i=0; i<cntT; i++)
		{
			bannerPriorityCnstT = eval(bannerPriorityCnstT) + eval(xmlDoc.getElementsByTagName("thumNum")[i].childNodes[0].nodeValue);
		}

		var focusItemCnst = Math.random();
		focusItemCnst = parseInt(focusItemCnst * bannerPriorityCnstT);

		bannerPriorityCnstT = 0;
		var chkMovie =  0;
		for (i=0; i<cntT; i++)
		{
			bannerPriorityCnstT = eval(bannerPriorityCnstT) + eval(xmlDoc.getElementsByTagName("thumNum")[i].childNodes[0].nodeValue);
			if (focusItemCnst < bannerPriorityCnstT)
			{
				chkMovie = i;
				break;
			}
		}
	}
	catch (e)
	{
		chkMovie =  0;
	}
	
	//page url
	var pageUrl=self.window.location.href;
	if(pageUrl.substring(0,5)=="https") swfUrl="https";
	else swfUrl="http";
	//default value setting
	if (objID=="") objID="ShockwaveFlash1";
	if (objWidth=="") objWidth="0";
	if (objHeight=="") objHeight="0";
	if (objQuality=="") objQuality="high";
	if (objWmode=="") objWmode="transparent";

	if (objSource.match(/=/))
	{
		objSource = objSource + "&server=" +  objXML + "&chkMovie=" + chkMovie;
	}
	else
	{
		objSource = objSource + "?server=" +  objXML + "&chkMovie=" + chkMovie;
	}

	document.writeln('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+swfUrl+'://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,124,0" width="'+objWidth+'" height="'+objHeight+'" id="'+objID+'" align="middle">');
	document.writeln('<param name="movie" value="'+objSource+'" />');
	document.writeln('<param name="allowScriptAccess" value="always" />');
	document.writeln('<param name="menu" value="false" />');
	document.writeln('<param name="quality" value="high" />');
	document.writeln('<param name="bgcolor" value="'+objBgcolor+'" />');
	document.writeln('<param name="wmode" value="'+objWmode+'" />');
	document.writeln('<embed src="'+objSource+'" allowScriptAccess="always" menu="false" quality="high" bgcolor="'+objBgcolor+'" wmode="'+objWmode+'" width="'+objWidth+'" height="'+objHeight+'" name="'+objID+'" align="middle" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.writeln('</object>');
}