/* NCsoft UIDev Part Script Library, global.js ver 0.6
 * this file for common lineage2 case
 * last update : 2009/04/29
/* ------------------------------------------------------ */

// Lineage2 Common Var
var static_path_lin2 ='http://static.plaync.co.kr/lineage2';
/*var lin2_path = getCurrUrl();*/
var lin2_path = "";
if (location.href.indexOf('/rc.') == -1) {
	var power_path ='http://power.plaync.co.kr/lineage2';
	var qna_path ='http://qna.plaync.co.kr/lineage2';
	var search_path ='http://search.plaync.co.kr/lineage2';
	var lin2payment_path ='https://ncshop.plaync.co.kr/purchaseWeb/Payment/L2/list.aspx';
} else {
	var power_path ='http://rc.power.plaync.co.kr/lineage2';
	var qna_path ='http://rc.qna.plaync.co.kr/lineage2';
	var search_path ='http://rc.search.plaync.co.kr/lineage2';
	var lin2payment_path ='http://ncshop.plaync.co.kr/purchaseWeb/Payment/L2/list.aspx';
}

function getCurrUrl(){
	var temp_url = location.href;
	temp_url = temp_url.split("//");
	temp_url = temp_url[1].substr(0, temp_url[1].indexOf("/"));
	lin2_path = document.location.protocol + "//" + temp_url;
	return lin2_path;
}

// Lineage2 Common top navigation link
function MenuRedirect(depth1, depth2) {
	var url="";
	depth1 = String(depth1);
	depth2 = String(depth2);
	switch(depth1){
	case "0":
		switch(depth2){
			case "0": url= lin2_path+"/index"; break;
		}break;
	case "1":
		switch(depth2){
			case "0": url= lin2_path+"/raid/"; break;
			case "1": url= power_path+"/%EC%B4%88%EB%B3%B4%EC%9E%90+%EA%B0%80%EC%9D%B4%EB%93%9C"; break;
			case "2": url= lin2_path+"/info/preview/"; break;
			case "3": url= lin2_path+"/ranking/raid/"; break;
			case "4": url= lin2_path+"/raid/"; break;
			case "5": url= lin2_path+"/olympiad/"; break;
			case "6": url= lin2_path+"/board/devblog/list"; break;
		}break;
	case "2":
		url= power_path; break;
	case "3":
		url= qna_path; break;
	case "4":
		switch(depth2){
			case "0": url= lin2_path+"/board/class/list"; break;
			case "1": url= lin2_path+"/board/class/list"; break;
			case "2": url= lin2_path+"/linkedbbs/serverchannel"; break;
			case "3": url= lin2_path+"/board/free/list"; break;
			case "4": url= lin2_path+"/board/fanart/list"; break;
			case "5": url= lin2_path+"/board/kayshallie/view"; break;
			case "6": url= lin2_path+"/board/fansite/list"; break;
		}break;
	case "5":
		switch(depth2){
			case "0": url= lin2_path+"/board/l2online/list"; break;
			case "1": url= lin2_path+"/board/l2online/list"; break;
			case "2": url= lin2_path+"/board/l2movie/list"; break;
			case "3": url= lin2_path+"/board/cartoon/multifarious/list"; break;
			case "4": url= lin2_path+"/board/novel/list?category=11"; break;
		}break;
	case "6":
		switch(depth2){
			case "0": url= lin2_path+"/pds/client/"; break;
			case "1": url= lin2_path+"/pds/client/"; break;
			case "2": url= lin2_path+"/pds/driver/"; break;
			case "3": url= lin2_path+"/pds/wallpaper/"; break;
			case "4": url= lin2_path+"/pds/ost/"; break;
			case "5": url= lin2_path+"/pds/screentshot/"; break;
			case "6": url= lin2_path+"/pds/originpicture/"; break;
			case "7": url= lin2_path+"/pds/screensaver/"; break;
		}break;
	case "7":
		switch(depth2){
			case "0": url= lin2_path+"/board/notice/list"; break;
			case "1": url= lin2_path+"/board/notice/list"; break;
			case "2": url= lin2_path+"/board/testserver/list";  break;
			case "3": url= lin2_path+"/board/update/list";  break;
			case "4": url= lin2_path+"/event/eventzone/l2EventList";  break;
			case "5": url= lin2_path+"/promotion/list/battle ";  break;
		}break;
	case "8":
		url= lin2payment_path; break;
	}
	if(url) document.location.href = url;
}
// Lineage2 Common Layout
function showQuickmenu() {
	document.writeln("<div class='wrap_service'><h3>서비스</h3>");
	document.writeln("<ul>");
	document.writeln("<li class='odd'><strong><a href='https://ncshop.plaync.co.kr/purchaseWeb/Payment/L2/list.aspx'>결제</a></strong></li>");
	document.writeln("<li><a href='http://cscenter.plaync.co.kr'>고객센터</a></li>");
	document.writeln("<li class='odd'><a href='https://ncshop.plaync.co.kr/purchaseWeb/MyPage/free_coupon_status.aspx?gamecode=32'>쿠폰등록조회</a></li>");
	document.writeln("<li><a href='https://security.plaync.co.kr/privateservice/ncotp/intro.aspx'>NCOTP</a> / <a href='https://security.plaync.co.kr/privateservice/mControl/intro.aspx'>엠컨트롤</a></li>");
	document.writeln("<li class='odd'><a href='/service/pcbang'>PC방 포인트존</a></li>");
	document.writeln("<li><a href='${cl_attribute.ncweb_l2plus}'>부가서비스 안내</a></li>");
	document.writeln("</ul></div>");
}
function showGamestart() {
	document.writeln('<h2>게임시작</h2><ul><li>');
	showFlashObject("start",static_path_lin2+"/layout/swf/gamestart.swf","195","157");
	document.writeln('</li><li><a href="'+lin2_path+'/pds/client/" class="btn_download"><dfn>클라이언트다운로드</dfn></a></li></ul>');
}
function showNavi(chkPage,ch1) {
	document.writeln('<h2 class="skip">리니지2 메뉴</h2>');
	showFlashObject("navi",static_path_lin2+"/layout/swf/navi_v2.swf?chkPage="+chkPage+"&ch1="+ch1,"666","66");
}
function showFooter() {
	document.writeln('<div class="wrap_footer">');
	document.writeln('<div id="l2footer">');
	document.writeln('<div class="copyright">LINEAGE2 is a registered trademark of NCsoft Corporation. Copyright &copy; NCsoft Corporation. All Rights Reserved.</div>');
	document.writeln('<div class="cooperation">');
	document.writeln('<ul>');
	document.writeln('<li class="youth"><a href="http://youth.go.kr/mb/mb08300.asp" title="사이버윤리지수" target="_blank"><dfn>사이버윤리지수</dfn></a></li>');
	document.writeln('<li class="msn"><a href="http://www.msn.co.kr" title="MSN" target="_blank"><dfn>MSN</dfn></a></li>');
	document.writeln('<li class="intel"><a href="http://www.intel.com/kr/" title="intel" target="_blank"><dfn>intel</dfn></a></li>');
	document.writeln('<li class="eng"><dfn>E&amp;G</dfn></li>');
	document.writeln('</ul>');
	document.writeln('</div>');
	document.writeln('</div>');
	document.writeln('<div class="wrap_grade">');
	document.writeln('<table summary="15세 이용가 등급표">');
	document.writeln('<caption>15세 이용가 등급표</caption>');
	document.writeln('<tr><th scope="row">제명</th><td>Lineage II</td><th scope="row">상호</th><td>(주)엔씨소프트</td></tr>');
	document.writeln('<tr><th scope="row">이용등급</th><td>15세 이용가(Non-pvp)</td><th scope="row">등급분류번호</th><td>OL-070717-020호</td></tr>');
	document.writeln('<tr><th scope="row">제작연월일</th><td>2003.07.04</td><th scope="row">배급업 등록번호</th><td>제 1999-000001호</td></tr>');
	document.writeln('</table>');
	document.writeln('<table summary="18세 이용가 등급표">');
	document.writeln('<caption>15세 이용가 등급표</caption>');
	document.writeln('<tr><th scope="row">제명</th><td>Lineage II</td><th scope="row">상호</th><td>(주)엔씨소프트</td></tr>');
	document.writeln('<tr><th scope="row">이용등급</th><td>18세 이용가(pvp)</td><th scope="row">등급분류번호</th><td>OL-070717-019호</td></tr>');
	document.writeln('<tr><th scope="row">제작연월일</th><td>2003.07.04</td><th scope="row">배급업 등록번호</th><td>제 1999-000001호</td></tr></table></div>');
	document.writeln('<div id="commonfooter">');
	document.writeln('<p class="ncsoft"><a href="http://www.ncsoft.com" target="_blank" title="NCSOFT"><dfn>NCSOFT</dfn></a></p>');
	document.writeln('<ul class="utilmenu">');
	document.writeln('<li class="m1"><a href="http://www.ncsoft.com" target="_blank" title="회사소개"><dfn>회사소개</dfn></a></li>');
	document.writeln('<li class="m2"><a href="http://www.plaync.co.kr/util/policy_lineage2" target="_parent" title="이용약관"><dfn>이용약관</dfn></a></li>');
	document.writeln('<li class="m3"><a href="http://www.plaync.co.kr/util/privacy" target="_parent" title="개인정보 취급 방침 및 청소년 보호 정책"><dfn>개인정보 취급 방침 및 청소년 보호 정책</dfn></a></li>');
	document.writeln('<li class="m4"><a href="http://cscenter.plaync.co.kr/policy/rule/lineage2.asp" target="_parent" title="운영정책"><dfn>운영정책</dfn></a></li>');
	document.writeln('<li class="m5"><a href="http://www.ncsoft.com/korean/support/contact.aspx?category=05" target="_blank" title="사업제휴/퍼블리싱"><dfn>사업제휴/퍼블리싱</dfn></a></li>');
	document.writeln('<li class="m6"><a href="https://security.plaync.co.kr" title="보안센터"><dfn>보안센터</dfn></a></li>');
	document.writeln('<li class="m7"><a href="http://www.plaync.co.kr/util/servicemap" title="plaync 서비스맵"><dfn>plaync 서비스맵</dfn></a></li>');
	document.writeln('<li class="m8"><a href="http://pcbang.ncsoft.net/ " target="_blank" title="pc방"><dfn>pc방</dfn></a></li>');
	document.writeln('</ul>');
	document.writeln('<address>');
	document.writeln('㈜엔씨소프트 서울 특별시 강남구 삼성동 157-37   대표전화 02-2186-3300 / FAX 02-2186-3400   대표이사 김택진   사업자 등록번호 220-81-43000');
	document.writeln('통신판매업신고 제14381호   개인정보 관리책임자 곽순욱 이재성   청소년 보호책임자 이재성   고객상담 1600-0020 코드번호 5번(전국공통)');
	document.writeln('</address>');
	document.writeln('</div>');
	document.writeln('</div>');
}
function bookmarksite (title, url) {if (window.sidebar) window.sidebar.addPanel(title, url, ""); else if (window.opera && window.print) { var elem = document.createElement('a');elem.setAttribute('href', url);elem.setAttribute('title', title);elem.setAttribute('rel', 'sidebar');elem.click();} else if (document.all) window.external.AddFavorite(url, title);}
function startPage(Obj,urlStr){if (document.all && window.external){ Obj.style.behavior='url(#default#homepage)'; Obj.setHomePage(urlStr);} else {alert('리니지2를 시작페이지로 버튼을 드래그 하여 브라우저 상단의 홈아이콘 위에 올려주세요.');}}
/* game start */
function loadLauncherActiveX() {
	var html ='<object ID="NCWebLauncher" style="left: 0px; top: 0px" codeBase="http://static.plaync.co.kr/plugin/gamelauncher/ncweb.cab#version=1,0,0,2" height="0" width="0" classid="CLSID:7C6E92FA-4429-4FB6-909B-798E2EFFAEF0" VIEWASTEXT></object>';
	var div = document.createElement("DIV");
	div.name = div.id = "divLauncherObject";
	document.body.appendChild(div);
	div.innerHTML = html;
}
function gameStart() {
	try {if(document.readyState != "complete") return;}catch(e){}
	GetClickCountRate('gameLauncherCount.xml');
	launch(4);
}
function GetClickCountRate(fileName) {
	try {
		var xmlhttp = null;

		try{xmlhttp=new XMLHttpRequest();}
		catch(e) {
			try {xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');}
			catch(e){
				try{xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');}
				catch(e){}
			}
		}
		if(xmlhttp != null) {
			var strURL	= "/statistics/" + fileName;
			xmlhttp.Open("POST", strURL, false);
			xmlhttp.setRequestHeader("Content-type:", "application/x-www-form-urlencoded");
			xmlhttp.send(null);
		}
	}
	catch(e) {}
}

//login_area : memo
function showService(num) {
	var sTab = $('tab').select('li');
	if(num >0 && sTab[num-1].className == "on") num = 0;

	for(var i=0; i<sTab.length && sTab[i].className!="inactive" ; i++) sTab[i].className = "";
	if(0<num) sTab[num-1].className = "on";

	var sInfo = $('service_info').select('p');
	for (var i=0; i<sInfo.length; i++) sInfo[i].style.display = 'none';
		sInfo[num].style.display = 'block';
}
//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 Media Object
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>');
}