﻿/*----------------------------------------------------------------------------------------+
	Design - Script
+----------------------------------------------------------------------------------------*/
function MM_preloadImages() {
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) {
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImgRestore() {
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() {
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


/*----------------------------------------------------------------------------------------+
	嬴檜溯歜 濠翕葬餌檜鍔
+----------------------------------------------------------------------------------------*/
function frameSelfResize(objname) {
	//var objname = window.name;

	try {
		if( !(objname == null || objname == "" || parent == null) )	{
			var objFrame = eval("parent.document.all." + objname);		
			var objSize = eval("parent.document." + objname);
			if(typeof(objFrame) != "undefined") {
				objFrame.style.height = parseInt(objSize.document.body.scrollHeight)+50;
				objFrame.height = parseInt(objSize.document.body.scrollHeight)+50;
			}
		}
	} catch(e) {
	}
}

function SimplereSize(obj){
	try {
		obj.height = eval(obj.name + '.document.body').scrollHeight;
	} catch(e) {
	}
}


/*----------------------------------------------------------------------------------------+
	欽牖啪 機擊 嗥選陽 餌辨棻.
	餌辨 寞徹 <a href="javascript:openwin('/account/regnumberlaw.asp','pop1',475,645,80,200,'no','no')"
+----------------------------------------------------------------------------------------*/
function openwin(url,popName,Width,Height,Top,Left,Resizable,Scrollbars)
{ 	
	javaOption ='width='+Width+',height='+Height+',top='+Top+',left='+Left+',resizable='+Resizable+',scrollbars='+Scrollbars;

	remote = window.open(url,popName,javaOption);

	if(remote != null)
	{
		if(remote.opener == null)
		{
			remote.opener = self;
		}
	}
}


/*----------------------------------------------------------------------------------------+
	煎斜檣
+----------------------------------------------------------------------------------------*/
var ERROR_MSG_VALIDATION_FAILED = "啗薑 傳朝 綠塵廓蒂 殮溘雖 彊懊剪釭 衝檜 溜蝗棲棻.";

function IsValidAccount(strUserId, strPassword)
{	
	var intStringLength;
	var bRtn;

	intStringLength = strUserId.length;
	if ( ( intStringLength < 4 ) || ( intStringLength > 16) ) return;
	var reg1 = /^([a-z]|[A-Z]|[0-9])([0-9]|[a-z]|[A-Z]){1,16}$/g;		
	return reg1.test(strUserId)
}

function LogonDefault(form)
{	

	var strUserId = form.id.value;
	var strPassword = form.pwd.value;
	var strLoginSite = form.loginsite.value;	
	var vReturn;
		
	if (!IsValidAccount(strUserId, strPassword)) {
		alert(ERROR_MSG_VALIDATION_FAILED);
		return;
	}
		
	form.action = strLoginSite + "/Lib/checkLogin.asp";
	form.method="post";	
	form.submit();
	return;
}

/*----------------------------------------------------------------------------------------+
	機璽擊 蝶觼萼曖 醞懈戲煎 檜翕衛鑑棻.
+----------------------------------------------------------------------------------------*/
function center(width,height)
{	
	var winToTop = (screen.height) ? (screen.height-height)/2 : 0;
	var winToLeft = (screen.width) ? (screen.width-width)/2 : 0;	
	strlocation = 'width=' + width + ',height=' + height + ',top=' + winToTop + ',left=' + winToLeft;
	return strlocation;
}

/*----------------------------------------------------------------------------------------+
	鷓斜蒂 嬴蝶酈煎 晦煎 滲唳晦
+----------------------------------------------------------------------------------------*/
function ConvertTextToHTML(strContent)
{
	var newstr;
	var strLine;
	var retString = "";
	var sizeString = strContent.length;
	
	for (var i=0; i < sizeString; i++) {
		strLine = strContent.charAt(i);

		strLine = strLine.replace("&", "&amp;");
		strLine = strLine.replace("'", "&#39;");
		strLine = strLine.replace("\"", "&quot;");
		strLine = strLine.replace(">", "&gt;");
		strLine = strLine.replace("<", "&lt;");
		strLine = strLine.replace("[", "&#91;");
		strLine = strLine.replace("]", "&#93;");
		strLine = strLine.replace(/\t/, "&#9;");
		strLine = strLine.replace(/\n/, "&#10;");
		strLine = strLine.replace(/\r/, "<br/>");
		strLine = strLine.replace(" ", "&#160;");
		retString = retString + strLine
	}
	return retString;
}

/*----------------------------------------------------------------------------------------+
	贗葛戲煎 犒餌晦
+----------------------------------------------------------------------------------------*/
function copyUrl(url){		
	if(isIE) 
	{
		window.clipboardData.setData('Text',url);
		window.alert("輿模陛 犒餌腎歷蝗棲棻");
	}
}

/*----------------------------------------------------------------------------------------+
	餌檜 檜翕
+----------------------------------------------------------------------------------------*/
function goUrl(what)
{
	document.location.href=what;
}

/*----------------------------------------------------------------------------------------+
	賅萇 檜雖縑憮 2衛除檜 雖釭賊 煎斜嬴醒擊 衛麵幗萼棻.
+----------------------------------------------------------------------------------------*/
function LoginCheck(sec)
{	
	setTimeout('LogOutDefault()', sec);
}

function LogOutDefault()
{
	document.location.href=PT2_WwwJs +"/Lib/LogOut.asp";
}


/*----------------------------------------------------------------------------------------+
	啪歜 褒
+----------------------------------------------------------------------------------------*/
function gameLaunch (Rpath, AuthKey, Uid, UBirth)
{
	try
	{
		var ATX
			ATX = WebLauncher.DoNow(Rpath, Uid, Uid, AuthKey, UBirth);
		if (!ATX) goLinkPage(710);
	}
	catch (e)
	{
		top.goLinkPage(710);
	}
}


/*----------------------------------------------------------------------------------------+
	啗薑翱唸機
function LinkUserPop ()
{
	var popUser = window.open('/game/LinkUserPop.asp', 'popUser', 'scrollbars=no, resizable=no, width=550, height=450, left='+(screen.width-580)/2+', top='+(screen.height-550)/2);

	if (popUser == null) {
		alert("\n啗薑翱唸擊 試盪 罹撿 憮綠蝶蒂 檜辨褒 熱 氈蝗棲棻.\n\n離欽脹 機璽擊 辨 輿褊衛螃.\n");
	}else{
		popUser.focus();
	}
}
+----------------------------------------------------------------------------------------*/

function ServerUnionPop() {
var svUnion = window.open('/game/ServerUnion.asp', 'svUnion', 'scrollbars=no, resizable=no, width=550, height=450, left='+(screen.width-580)/2+', top='+(screen.height-550)/2);
(svUnion == null) ? alert("\n啗薑翱唸擊 試盪 罹撿 憮綠蝶蒂 檜辨褒 熱 氈蝗棲棻.\n\n離欽脹 機璽擊 辨 輿褊衛螃.\n") : svUnion.focus();
}


/*----------------------------------------------------------------------------------------+
	議衛醱瞪機
+----------------------------------------------------------------------------------------*/
function CashChargePop ()
{
	var popCash = window.open(Ace_SecureJs +'/payment/main.asp', 'popUser', 'scrollbars=no, resizable=no, width=470, height=400, left='+(screen.width-470)/2+', top='+(screen.height-400)/2);

	if (popCash == null) {
		alert("\n離欽脹 機璽擊 辨 輿褊衛螃.\n");
	}else{
		popCash.focus();
	}
}


/******************** PDS File DOWNLOAD START ********************/
function downLoad_File(menu ,filename)
{
    if(/^[\w\W]{1,}.(gif|bmp|jpg|jpeg|png)$/gi.test(filename))
    {
	top.location.href = _File_Url + "/App/downloads/downloads_file_down.aspx?FileMenu=" + menu + "&FilePath="+ filename;
    }
    else if(menu == "SupportQNA")
    {
        top.location.href = _File_Url + "/App/downloads/downloads_file_down.aspx?FileMenu=" + menu + "&FilePath="+ filename;
    }
}
/******************** PDS File DOWNLOAD END ********************/