var sw = screen.availWidth;
var sh = screen.availHeight;

function openPopImage(fileURL) {
	var url = "/lib/template/pop_img.asp?FileURL="+fileURL
	openWindowCenter(url,'',100,100,1);
}

function copyUrl(el) {
	var obj = document.getElementById(el);
	var value = obj.innerText;
	clipboardData.setData('Text',value);
	alert("°Ô½Ã¹°ÀÇ ÁÖ¼Ò°¡ º¹»çµÇ¾ú½À´Ï´Ù.\r\n¸Þ½ÅÀú,ºí·Î±×,Ä«Æä,¹Ì´ÏÈ¨ÇÇ °Ô½ÃÆÇ¿¡ \r\nctrl+v(ºÙ¿©³Ö±â)·Î ÀÔ·ÂÇÏ¼¼¿ä.")
}

// ³»¿ëº¹»ç
function copyContents(elementID) {
	var element = document.getElementById(elementID);
	var html = element.innerHTML;
	html += "<br/>\r\ncopyright¨Ï NEXON Corporation All Rights Reserved. "
	html += "<a href='http://elancia.nexon.com' target='_blank'>http://elancia.nexon.com</a> ¿øº» °Ô½Ã¹° È®ÀÎ"
	clipboardData.setData('Text',html);
	alert("°Ô½Ã¹° ³»¿ëÀÌ Å¬¸³º¸µå¿¡ ÀúÀåµÇ¾ú½À´Ï´Ù.\nHTML ÀÔ·ÂÀÌ °¡´ÉÇÑ °÷¿¡ Ctrl + v¸¦\n´­·¯ ³»¿ëÀ» º¹»çÇÏ¼¼¿ä.")
}

// ¹Ìµð¾î ¼Ò½º clipboard·Î º¹»ç
function clipMediaCode(param,fileURL,width,height) {
	if(param=="movie") {
		code = "<EMBED src=\""+fileURL+"\" width=\""+width+"\" height=\""+height+"\" type=\"video/x-ms-wmv\" enablecontextmenu=\"0\" showstatusbar=\"1\"></EMBED>";
	} else if(param=="ost") {
		code = "<EMBED src=\""+fileURL+"\" type=\"video/x-ms-mp3\" height=\"68\" type=\"video/x-ms-mp3\" enablecontextmenu=\"0\" showstatusbar=\"1\"></EMBED>";
	} else {return;}
	alert("HTML ÄÚµå°¡ ÀÚµ¿À¸·Î º¹»çµÇ¾îÁ³½À´Ï´Ù\n¸Þ¸ðÀå È¤Àº ºí·Î±×³ª ¹Ì´ÏÈ¨ÇÇÀÇ °Ô½ÃÆÇ¿¡ ctrl+v¸¦ ÇÏ½Ã¸é\nº¹»çµÈ HTML ÄÚµå¸¦ È®ÀÎÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù");
	clipboardData.setData('Text',code);
}

// ÅÇ¸¸µé±â
function __htmlTab() {
	this.tabArray = new Array();
	this.tabType = 1;
	this.imgURL = null;
	this.styleL = null;
	this.styleC = null;
	this.styleR = null;
	this.imgDelemeter = null;	
	this.cPosition = 0;
	
	this.add=function(imgOn,imgOff,link) {
		this.tabArray.push({On:imgOn,Off:imgOff,Link:link});
	}
	this.generate=function() {
		var str = "";
		if(this.tabType==1) {
			if (this.styleC==null) { this.styleC = "style='background:url(\""+this.imgURL+"/tab/tab_c.gif\") repeat-x;' class='vab'"; }
			if (this.styleR==null) { this.styleR = "style='background:url(\""+this.imgURL+"/tab/tab_r.gif\");width:5px;'"; }
			if (this.imgDelemeter==null) { this.imgDelemeter = "<img src='http://s.nx.com/S2/Nexon2006/image/global/bg_blank.gif' width='2' />"; }
			
			str += "<table width='650'>"
			+"<tr style='height:48px;'>"
			+"<td "+this.styleL+"></td>"
			+"<td "+this.styleC+">"
			for (var i=0;i<this.tabArray.length;i++){
				if(this.cPosition==i) {
					str += "<img src='"+this.imgURL+this.tabArray[i].On+"' class='vat' />"
				} else {
					str += "<a href='"+this.tabArray[i].Link+"' onfocus='this.blur();'><img src='"+this.imgURL+this.tabArray[i].Off+"' class='vat' /></a>"
				}				
				str += this.imgDelemeter
			}
			str += "</td>"
			+"<td "+this.styleR+"></td>"
			+"</tr>"
			+"</table>"
		} else if(this.tabType==2) {
			if (this.styleC==null) { this.styleC = "class='tac'"; }
			if (this.imgDelemeter==null) { this.imgDelemeter = "<img src='http://s.nx.com/S2/Nexon2006/image/global/bg_blank.gif' width='2' />"; }
			
			str += "<table width='650'>"
			+"<tr style='height:30px;'>"
			+"<td "+this.styleC+">"
			for (var i=0;i<this.tabArray.length;i++){
				if(this.cPosition==i) {
					str += "<img src='"+this.imgURL+this.tabArray[i].On+"' class='vat' />"
				} else {
					str += "<a href='"+this.tabArray[i].Link+"' onfocus='this.blur();'><img src='"+this.imgURL+this.tabArray[i].Off+"' class='vat' /></a>"
				}
				if(i<this.tabArray.length-1 && this.imgDelemeter!="") {
					str += this.imgDelemeter
				}
			}
			str += "</td>"
			+"</tr>"
			+"</table>"
			
		}
		document.write(str);
	}
}

// È¾½ºÅ©·Ñ
function __scroll(id,width,totalCnt,showCnt,speed) {
	this.id = id;
	this.width = width;
	this.totalCnt = totalCnt;
	this.showCnt = showCnt;
	this.speed = speed;	//width ÀÇ ¾à¼ö°¡ ÁÁ´Ù.
	
	if(this.width==null) {this.width=100;}
	if(this.totalCnt==null) {this.totalCnt=0;}
	if(this.showCnt==null) {this.showCnt=0;}
	if(this.speed==null) {this.speed=5;}
	
	this.prog = null;
	this.pos = 0;
	this.cLeft = 0;
	this.tLeft = width;

	this.next = function() {
		var div = document.getElementById(this.id);
		if(div==null) {return;}
		if(this.prog!=null) {return;}
		
		if(this.pos>=(this.totalCnt-this.showCnt)) {return;}
		this.tLeft = -1*(this.pos+1)*width;
		this.cLeft = parseInt(div.style.left);
		this.cLeft -= speed;
		if(this.cLeft>this.tLeft) {
			div.style.left = this.cLeft+"px";
			this.prog = "next";
			window.setTimeout("scroll_"+this.id+".prog=null;scroll_"+this.id+".next()", 20);
		} else {
			this.cLeft = this.tLeft;
			div.style.left = this.cLeft+"px";
			this.pos += 1;
			this.prog = null;
		}
	}
	
	this.prev = function() {
		var div = document.getElementById(this.id);
		if(div==null) {return;}
		if(this.prog!=null) {return;}
		
		if(this.pos<=0) {return;}
		this.tLeft = -1*(this.pos-1)*width;
		this.cLeft = parseInt(div.style.left);
		this.cLeft += speed;			
		if(this.cLeft<this.tLeft) {
			div.style.left = this.cLeft+"px";
			this.prog = "prev";
			window.setTimeout("scroll_"+this.id+".prog=null;scroll_"+this.id+".prev()", 20);
		} else {
			this.cLeft = this.tLeft;
			div.style.left = this.cLeft+"px";
			this.pos -= 1;
			this.prog = null;
		}
	}
}

// ¸Þ´º °ü·Ã 
var arrMnu = new Array();
arrMnu.push({key:"top0",txt:"LOGO",url:"/default.asp"});
arrMnu.push({key:"top1",txt:"HOME",url:"/default.asp"});
arrMnu.push({key:"top2",txt:"SITEMAP",url:"/global/sitemap.asp"});
arrMnu.push({key:"top3",txt:"FAQ",url:"support1"});
arrMnu.push({key:"top4",txt:"CLASSICRPG",url:"javascript:window.open('http://classicrpg.nexon.com/');"});

arrMnu.push({key:"news0",txt:"ÀÏ·£¼Ò½Ä",url:"news1"});
arrMnu.push({key:"news1",txt:"°øÁö»çÇ×",url:"/news/notice/list.asp"});
arrMnu.push({key:"news2",txt:"¾÷µ¥ÀÌÆ®",url:"/news/update/list.asp"});
arrMnu.push({key:"news3",txt:"ÀÌº¥Æ®",url:"/news/event/list.asp"});
arrMnu.push({key:"news4",txt:"ÀÏ·£ÆÀÀÌ¾ß±â",url:"/news/story/list.asp"});

arrMnu.push({key:"guide0",txt:"½ÃÀÛ°¡ÀÌµå",url:"guide1"});
arrMnu.push({key:"guide1",txt:"ÀÏ·£½Ã¾Æ¼Ò°³",url:"/guide/intro/intro.asp"});
arrMnu.push({key:"guide2",txt:"½ÃÀÛÇÏ±â",url:"/guide/start/start1.asp"});
arrMnu.push({key:"guide3",txt:"¹è¿ì±â",url:"/guide/learn/default.asp"});

arrMnu.push({key:"game_info0",txt:"°ÔÀÓÁ¤º¸",url:"game_info1"});
arrMnu.push({key:"game_info1",txt:"½ÃÀÛÇÏ±â",url:"/game_info/gamestart/gamestart1.asp"});
arrMnu.push({key:"game_info2",txt:"Ä³¸¯ÅÍ/Á÷¾÷",url:"/game_info/character/character1.asp"});
arrMnu.push({key:"game_info3",txt:"¾îºô¸®Æ¼/½ºÆç",url:"/game_info/ability/ability1.asp"});
arrMnu.push({key:"game_info4",txt:"¸¶À»&NPC",url:"/game_info/villageNPC/villageNPC1.asp"});
arrMnu.push({key:"game_info5",txt:"´øÀü",url:"/game_info/dungeon/dungeon1_1.asp"});
arrMnu.push({key:"game_info6",txt:"»ç³É",url:"/game_info/field/field1.asp"});
arrMnu.push({key:"game_info7",txt:"¸ó½ºÅÍ",url:"/game_info/monster/list.asp"});
arrMnu.push({key:"game_info8",txt:"Äù½ºÆ®",url:"/game_info/quest/quest1_1.asp"});
arrMnu.push({key:"game_info9",txt:"¾ÆÀÌÅÛ",url:"/game_info/item/list.asp"});
arrMnu.push({key:"game_info10",txt:"Áöµµ",url:"/game_info/map/map1.asp"});

arrMnu.push({key:"community0",txt:"Ä¿¹Â´ÏÆ¼",url:"community1"})
arrMnu.push({key:"community1",txt:"ÀÚÀ¯°Ô½ÃÆÇ",url:"/community/free/list.asp"})
arrMnu.push({key:"community2",txt:"°ÔÀÓ°Ô½ÃÆÇ",url:"/community/game/list.asp"})
arrMnu.push({key:"community3",txt:"Áö½ÄÀÎ",url:"/community/kin/list.asp"}) 
arrMnu.push({key:"community4",txt:"ÀÏ·£Àü±¤ÆÇ",url:"/community/led/list.asp"}) 
arrMnu.push({key:"community5",txt:"ÅÂ±×½ºÅ©¸°¼¦",url:"/community/tagshot/list.asp"}) 
arrMnu.push({key:"community6",txt:"ÆÒ¾ÆÆ®",url:"/community/fanart/list.asp"}) 
arrMnu.push({key:"community7",txt:"°ø°¨´ñ±Û",url:"/community/poll/list.asp"})
arrMnu.push({key:"community8",txt:"¾ÆÀÌµð¾î°Ô½ÃÆÇ",url:"/community/idea/list.asp"}) 

arrMnu.push({key:"honor0",txt:"¸í¿¹ÀÇÀü´ç",url:"honor1"})
arrMnu.push({key:"honor1",txt:"·©Å·",url:"/honor/ranking/best.asp"})
arrMnu.push({key:"honor2",txt:"º£½ºÆ® ÆÒÆäÀÌÁö",url:"/honor/fanpage/list.asp"})
arrMnu.push({key:"honor3",txt:"±æµåÀü",url:"/honor/gongsung/list.asp"})

arrMnu.push({key:"cash_shop0",txt:"Ä³½Ã¼¥",url:"cash_shop2"})
arrMnu.push({key:"cash_shop1",txt:"Ä³½Ã¾÷µ¥ÀÌÆ®",url:"/cash_shop/update/list.asp"})
arrMnu.push({key:"cash_shop2",txt:"Ä³½Ã¾ÆÀÌÅÛ",url:"/cash_shop/cash_item/list.asp"})

arrMnu.push({key:"pds0",txt:"ÀÚ·á½Ç",url:"pds1"})	
arrMnu.push({key:"pds1",txt:"°ÔÀÓ´Ù¿î·Îµå",url:"/pds/download.asp"})
arrMnu.push({key:"pds2",txt:"µå¶óÀÌ¹ö",url:"/pds/driver.asp"})
arrMnu.push({key:"pds3",txt:"¸ÖÆ¼¹Ìµð¾î",url:"/pds/multi.asp"})
//arrMnu.push({key:"pds3",txt:"¸ÖÆ¼¹Ìµð¾î",url:"javascript:alert('ÁØºñÁßÀÔ´Ï´Ù');"})
arrMnu.push({key:"pds4",txt:"°¶·¯¸®",url:"/pds/gallery.asp"})	
arrMnu.push({key:"pds5",txt:"¿ùÆäÀÌÆÛ",url:"/pds/wallpaper.asp"})	

arrMnu.push({key:"support0",txt:"°í°´Áö¿ø",url:"support3"})	
arrMnu.push({key:"support1",txt:"FAQ",url:"javascript:window.open('http://help.nexon.com/help/page/nx.aspx?url=faq/faq&n4FAQBoardSN=6');"})
arrMnu.push({key:"support2",txt:"¹ö±×¸®Æ÷Æ®",url:"/support/bug_report/write.asp"})	
arrMnu.push({key:"support3",txt:"°í°´»ó´ã¾È³»",url:"/support/support.asp"})	

function getMnuURL(param) {
	for(var i=0;i<arrMnu.length;i++) {
		if(arrMnu[i].key==param) {
			return arrMnu[i].url;
		}
	}
}
function goURL(param) {
	if(!param) return;
	url = getMnuURL(param);
	if(!url) return;
	if(url.indexOf("javascript:")>-1) {
		eval(url.replace("javascript:",""));
	} else if(url.indexOf(".asp")<0) {
		goURL(url)	
	} else {
		location.href = url;
	}
}

function goDownload() {
	location.href = "/pds/download.asp";
}

// ¸ÞÀÎ±¤°íÃ¢ ¸µÅ©
function goTopBanner(num) {
	num=eval(num);
	try {
		//ifrm_wiselog.location='/blank.asp?section=lunia&position=main&bannername=ad_flash'+(num+1);
	} catch(e) {alert(e);}
	switch(num) {
		case 1:
			location.href='/board/654311427/10';
			break;
		case 2:
			location.href='/board/654311427/11';
			break;
		case 3:			
			break;
	}
}