﻿//QA 
//var atongBaseURL = "http://betach.arario.jp/";
//REAL
var atongBaseURL = "http://www.arario.jp/";


function gotoMenu(str)
	{
		sub_no = 0
	
//	alert(str);
		if (str == '01_1'){gotoAllPage('DC003005')};	//Announce
		if (str == '01_2'){gotoAllPage('DC003006')};	//Update
		if (str == '01_3'){gotoAllPage('DC003007')};	//Event
		if (str == '01_4'){gotoAllPage('DC003104')};	//Schedule
		
		if (str == '02_1'){gotoAllPage('DC003002')};	//GoCommunity
		if (str == '02_5'){gotoAllPage('DC003067')};	//GoCommunity
		if (str == '02_2'){gotoAllPage('DC003003')};	//TrialRide
		if (str == '02_3'){gotoAllPage('DC003001')};	//FreeBoard
		if (str == '02_4'){gotoAllPage('DC003051')}; 	//ScreenShot
//		if (str == '04_4'){gotoAllPage('DC003004')};	//TesterZone
//		if (str == '04_5'){gotoAllPage('DC003004')};	//
		
		if (str == '03_1'){gotoAllPage('DC003058')};	//Team Main
		if (str == '03_2'){gotoAllPage('DC003057')};	//TeamSearch
		if (str == '03_3'){gotoAllPage('DC003056')}; 	//Team Board
		if (str == '03_4'){gotoAllPage('DC003054')};	//MyTeamRoom
		if (str == '03_5'){gotoAllPage('DC003055')};	//Channel Info
		
		
		if (str == '04_1'){gotoAllPage('DC003019')};	//LineUp
		
		if (str == '05_1'){gotoAllPage('DC003011')};	//Story Prologue
		if (str == '05_2'){gotoAllPage('DC003014')};	//Game Mode
		if (str == '05_3'){gotoAllPage('DC003037')};	//Free Market1
		if (str == '05_4'){gotoAllPage('DC003040')};	//Parts1
		if (str == '05_5'){gotoAllPage('DC003052')};	//UnderCity
		if (str == '05_6'){gotoAllPage('DC003053')};	//ChannelBattle
		if (str == '05_7'){gotoAllPage('DC003016')};	//Battle Is
		if (str == '05_8'){viewBeginnerGuide()};		//Begin Guide

		if (str == '06_1'){gotoAllPage('DC003008')};	//ClientDown
		if (str == '06_2'){gotoAllPage('DC003009')};	//Movie
		if (str == '06_3'){gotoAllPage('DC003010')};	//BGM

		if (str == '07_1'){gotoAllPage('DC003021')};	//QnA Faq
		if (str == '07_2'){gotoAllPage('DC003036')};	//Bug List
		if (str == '07_3'){gotoAllPage('DC003024')};	//Do QnA
		if (str == '07_4'){gotoAllPage('DC003022')};	//My QnA
		if (str == '07_5'){gotoAllPage('DC003043')};	//Policy
		
	}
	
	

	function gotoAllPage(board_no){
		target="_top";
		targetURL = "Main";
		sub_no = 0
		

		switch(board_no){

			case 'DC003001':
				sub_no = 1;
				targetURL = "goFreeBoard";
				break;
			case 'DC003002':
				sub_no = 2;
				targetURL = "goCommunity";
				break;
			case 'DC003003':
				sub_no = 3;
				targetURL = "goTrialRide";
				break;
			case 'DC003004':
				sub_no = 4;
				targetURL = "goTeserZone";
				break;
			case 'DC003005':
				sub_no = 5;
				targetURL = "goAnnounce";
				break;
			case 'DC003006':
				sub_no = 6;
				targetURL = "goUpdate";
				break;
			case 'DC003007':
				sub_no = 7;
				targetURL = "goEvent";
				break;
			case 'DC003008':
				sub_no = 8;
				if(parent.cpd == "ncjp") 
					targetURL = "goNCDown";
				else
					targetURL = "goDown";
				break;
			case 'DC003009':
				sub_no = 9;
				targetURL = "goMovie";
				break;
			case 'DC003010':
				sub_no = 10;
				targetURL = "goBgm";
				break;
			case 'DC003011':
				sub_no = 11;
				targetURL = "goStory1";
				break;
			case 'DC003012':
				sub_no = 12;
				targetURL = "goStory2";
				break;
			case 'DC003013':
				sub_no = 13;
				targetURL = "goStory3";
				break;
			case 'DC003014':
				sub_no = 14;
				targetURL = "goGameMode";
				break;
			case 'DC003015':
				sub_no = 15;
				targetURL = "goBattleIs";
				break;
			case 'DC003016':
				sub_no = 16;
				targetURL = "goTrackInfo1";
				break;
			case 'DC003017':
				sub_no = 17;
				targetURL = "goTrackInfo2";
				break;
			case 'DC003019':
				sub_no = 19;
				targetURL = "goLineup";
				break;
			case 'DC003020':
				sub_no = 20;
				targetURL = "goQna";
				break;
			case 'DC003021':
				sub_no = 21;
				targetURL = "goQnaFaq";
				break;
			case 'DC003022':
				sub_no = 22;
				targetURL = "goMyQna";
				break;
			case 'DC003023':
				sub_no = 23;
				targetURL = "goOpinion";
				break;
			case 'DC003024':
				sub_no = 24;
				//targetURL = "goMailQnA";
				targetURL = "goInquiry";
				break;
			case 'DC003025':
				sub_no = 25;
				targetURL = "goMainBegin2";
				break;
			case 'DC003026':
				sub_no = 26;
				targetURL = "goMainPower";
				break;
			case 'DC003028':
				sub_no = 28;
				targetURL = "QuickStart01";
				break;
			case 'DC003029':
				sub_no = 29;
				targetURL = "goMyPage";
				break;
			case 'DC003030':
				sub_no = 30;
				targetURL = "SearchMain";
				break;
			case 'DC003031':
				sub_no = 31;
				targetURL = "SearchID";
				break;
			case 'DC003032':
				sub_no = 32;
				targetURL = "SearchPass";
				break;
			case 'DC003036':
				sub_no = 36;
				targetURL = "goBugList";
				break;
			case 'DC003037':
				sub_no = 37;
				targetURL = "goFreeMarket1";
				break;
			case 'DC003038':
				sub_no = 38;
				targetURL = "goFreeMarket2";
				break;
			case 'DC003039':
				sub_no = 39;
				targetURL = "goFreeMarket3";
				break;
			case 'DC003040':
				sub_no = 40;
				targetURL = "goParts1";
				break;
			case 'DC003041':
				sub_no = 41;
				targetURL = "goParts2";
				break;
			case 'DC003042':
				sub_no = 42;
				targetURL = "goParts3";
				break;
			case 'DC003043':
				sub_no = 43;
				targetURL = "goPolicy";
				break;
			case 'DC003044':
				sub_no = 44;
				targetURL = "Event_0306";
				break;
			case 'DC003045':
				sub_no = 45;
				targetURL = "Event_0306_1";
				break;
			case 'DC003046':
				sub_no = 46;
				targetURL = "Event_0306_2";
				break;
			case 'DC003047':
				sub_no = 47;
				targetURL = "Event_0306_3";
				break;
			case 'DC003048':
				sub_no = 48;
				targetURL = "Event_0306_1P";
				break;
			case 'DC003051':
				sub_no = 51;
				targetURL = "ScreenShotList";
				break;
			case 'DC003052':
				sub_no = 52;
				targetURL = "goUnderCity";
				break;
			case 'DC003053':
				sub_no = 53;
				targetURL = "goChannelBattle";
				break;
			case 'DC003054':
				sub_no = 54;
				targetURL = "myTeamRoom";
				break; 
			case 'DC003055':
				sub_no = 55;
				targetURL = "teamInfo"; //Channel Battle Info
				break;
			case 'DC003056':
				sub_no = 56;
				targetURL = "teamBoardList";
				break;
			case 'DC003057':
				sub_no = 57;
				targetURL = "teamSearchList";
				break;
			case 'DC003058':
				sub_no = 58;
				targetURL = "teamMain";
				break;
			case 'DC003061' : 
				sub_no = 61;
				targetURL = "item1";
				break;
			case 'DC003062' : 
				sub_no = 62;
				targetURL = "item2";
				break;
			case 'DC003063' : 
				sub_no = 63;
				targetURL = "item3";
				break;
			case 'DC003064' : 
				sub_no = 64;
				targetURL = "item4";
				break;	
			case 'DC003065':
				sub_no = 65;
				targetURL = "virtualChasing";
				break;
			case 'DC003066':
				sub_no = 66;
				targetURL = "goOperation";
				break;
			case 'DC003067':
				sub_no = 67;
				targetURL = "goDoricoma";
				break;
			case 'DC003068':
				sub_no = 68;
				targetURL = "GTChampionship";
				break;
			case 'DC003104':
				sub_no = 104;
				targetURL = "goSchedule";
				break;
			case 'DC003114':
				sub_no = 104;
				targetURL = "goStory4";
				break;
			case 'DC003118':
				sub_no = 118;
				targetURL = "goTrackInfo3";
				break;
			case 'DC003119':
				sub_no = 119;
				targetURL = "goTrackInfo4";
				break;
			case '21_5': 
				targetURL = "QuickStart05";
				break;
			case 'sitemap':
				targetURL = "Sitemap";
				break;
			default:
		}
//alert("gotoPage" + targetURL);		

//alert("board_no" + board_no　+ "sub_no" + sub_no　);		
		var cpd = parent.cpd;
		setCount('DC004003', sub_no, cpd);
		document.location.href  = "goPage.action?pageName=" + targetURL + "&cpd="+cpd;
	}

	function MM_swapImgRestore() { //v3.0
	  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_preloadImages() { //v3.0
	  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) { //v4.01
	  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_swapImage() { //v3.0
	  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 updateByPost(url, divName, formName){
		var myAjax = new Ajax.Updater(
			divName,
			url,
			{
				method: 'post',
				parameters:Form.serialize(formName)
				//onComplete: showResponse
			}
		);
	}

	function updateByGet(url, divName, param){
		
		var myAjax = new Ajax.Updater(
			divName, 
			url, 
			{
				method: 'get', 
				parameters: param
		});
	}

	
	
	function updateByPostAfterFN(url, divName, formName){	
		var myAjax = new Ajax.Updater(
			divName,
			url,
			{
				method: 'post',
				parameters:Form.serialize(formName),
				onComplete: postAfterFN
			}
		);
	}
	
	function cleanDIV(divName){
		document.getElementById((divName)).innerHTML = "";
	}
	
	function trim(str){
	  // str = str.replace(/^\s*/,'').replace(/\s*$/, '');
	  var re1 = /^\s+|\s+$/g;
	    var re2 = /^　+|　+$/g;
	    var trimFlag = true;
	    while(trimFlag) {
	        var length = str.length;
	        str = str.replace(re1, '');
	        str = str.replace(re2, '');
	        if(str.length == length) {
	            trimFlag = false;
	        }
	    }
	   return str; 
	}
	
	function setCount(gbn, sub_no, cpd)
	{
//		document.location.href =  "addCount.action?gbn=" + gbn + "&sub_no=" + sub_no;	
		updateByGet("addCount.action","","gbn="+gbn+"&sub_no="+sub_no+ "&cpd="+cpd);
	}

	function addViewCount(gbn, seq_no)
	{
		document.location.href =  "addViewCount.action?gbn=" + gbn + "&seq_no=" + seq_no;	
	}

	function MailCheck(ObjMail){
		ObjMail = trim(ObjMail);
	
		if (ObjMail.search(/(\S+)@(\S+)\.(\S+)/) == -1 ) 
		{
		    return false;    
		}
		return true;
	}

	function WriteEmbed(emb_id){ 
		document.write(document.getElementById(emb_id).value);
	}

	function goMainPower(){
		gotoAllPage("DC003026");
	}
	function goMainBegin(){
		gotoAllPage("DC003025");
	}
	function viewBeginnerGuide(){
//		setCount('DC004003', 33);
		window.open("goPage.action?pageName=goBeginGuide", "ARARIO", "width=800 ,height=600, scrollbars=no");
	}
	function viewQna(){
		gotoAllPage("DC003020");
	}
	function viewPowerGuide(){
		window.open("goPage.action?pageName=goSorryPopup", "ARARIO", "width=395 ,height=295, scrollbars=no");
	}
	function viewStartRegiPopup(){
		opener.location.href =  "javascript:gotoAllPage('DC003028');";
	}
	function viewStartHomePopup(){
		opener.location.href =  "javascript:gotoAllPage('DC003026');";
	}
	
	function viewStartRegi(){
		var cpd = parent.cpd;
		cpd = "ncjp";
		if(parent.cpd == "ncjp"){		
			top.location.href = "https://ssl.plaync.jp/login/Cplogin.aspx?cpcode=driftcity&pagestatus=1&returl=http%3A%2F%2Fdriftcity.plaync.jp%2F";
		}else{
			setCount('DC004003', 28, cpd);
			document.location.href =  "goPage.action?pageName=QuickStart01";
			//opener.location.href =  "goPage.action?pageName=QuickStart01";	
		}
	}
	function viewStartRegiOpen(){
		var cpd = parent.cpd;
		cpd = "ncjp";
		if(parent.cpd == "ncjp"){		
			top.location.href = "https://ssl.plaync.jp/login/Cplogin.aspx?cpcode=driftcity&pagestatus=1&returl=http%3A%2F%2Fdriftcity.plaync.jp%2F";
		}else{
			setCount('DC004003', 28, cpd);
			window.open("goPage.action?pageName=QuickStart01");
		}
	}
	function viewDownLoadOpen(){
		var cpd = parent.cpd;
		setCount('DC004003', 8, cpd);
		if(parent.cpd == "ncjp"){		
			window.open("http://driftcity.plaync.jp/?pageName=goDown");
		}else{
			window.open("http://driftcity.arario.jp/?pageName=goDown");
		}
	}
	//if you use iframe then you can use this function on the below// 
	function viewStartRegi2(){
		var cpd = parent.cpd;
		setCount('DC004003',28, cpd);
		parent.location.href = "../goPage.action?pageName=QuickStart01";
	}
	
	function viewDownLoad(){
		var cpd = parent.cpd;
		setCount('DC004003', 8, cpd);
		document.location.href =  "goPage.action?pageName=goDown"
		//window.open("goPage.action?pageName=goSorryPopup", "ARARIO", "width=395 ,height=295, scrollbars=no");
	}
	function viewDownLoadFile(){
		window.open("http://arario.nefficient.jp/arario/gamedownload/driftcity/setupfile/driftcity_setup.exe", "ARARIO", "width=395 ,height=295, scrollbars=no");
		//alert('オープンサービスまでお待ちください。');
//		setCount('DC004003', 35);
	}
	function viewMypage(){
//		document.location.href =  "goPage.action?pageName=goMyPage"
//		window.open("goPage.action?pageName=goMyPage", "ARARIO", "width=395 ,height=295, scrollbars=no");
		var myPageURL = "http://www.arario.jp/memberInfoAuth.action";
		var cpd = parent.cpd;
		if(cpd == "ncjp"){
			top.location.href = "http://myinfo.plaync.jp/profile/index.nc";
		}else{
			//window.open(myPageURL,'myPage','width=655,height=600,statusbar=no,scrollbars=yes,toolbar=no,resizable=no');
			document.location.href = myPageURL;
		}
//		setCount('DC004003', 29);
	}
		
	//2008.10.27 ユーザー制裁機能
	function checkWriteRestraint(){
		var result = true;
		var restraint = "ok";
		var myAjax = new Ajax.Request("checkBeforeWrite.action"
				,{
					onSuccess:function (transport){
						restraint = transport.responseText;
						if(restraint != "ok"){							
							alert(restraint);
						}
						$('restraint').value = restraint;
					}
				});
	}

	
	function goLogin(){
		var v_user_id = $('user_id').value;
		var v_user_pass = $('user_pass').value;
		var rURL = document.URL;
		var v_data = "user_id="+v_user_id+"&user_pass="+v_user_pass;

	    if(v_user_id.length < 1){
	        alert('IDを入力してください。');
	        document.formLogin.user_id.focus();
	    } else if(v_user_pass.length < 1){
	        alert("パスワードを入力してください。");
	        document.formLogin.user_pass.focus();
	    } else {
	        document.formLogin.rURL.value = document.URL;
	        new Ajax.Request(
	    		  'lecpt.jsp',
	    		  {
	    			  method:'POST',
	    			  parameters:v_data,
	    			  onSuccess:function(transport){
	    			  	msg = transport.responseText;
	    			  	document.formLogin.ecode.value = msg.trim();
	 	                document.formLogin.action = "http://www.arario.jp/commonLogin.htmls";
	 	                document.formLogin.submit();
	    		  	  }
	    		  }
	        );
	    }
		
//		var myAjax = new Ajax.Request(
//			'checkBeforeLogin.action?user_id='+user_id ,
//			{
//				onSuccess:memberCheck
//			}
//		);
	}
	
	function memberCheck(transport){
		var user_id, user_pass, param;
		user_id = $('user_id').value;
		user_pass = $('user_pass').value;
		
		var flag = transport.responseText;
		if(flag == "ok"){
			param = "user_id=" + user_id +"&user_pass=" + user_pass; 
			var myAjax = new Ajax.Request(
				'userIdPassCheck.action',
				{
					method:'POST',
					parameters:param,
					onSuccess:ajaxLogin
				}
			);
		}else{
			alert(flag);
		}
	}
	
	function ajaxLogin(transport){
		var flag = transport.responseText;
		if(flag == "true"){
			var user_id = $F('user_id');
			var user_pass = $F('user_pass');
			
			var myAjax = new Ajax.Request(
					"memberLogin.action",
					{
						method:'POST',
						parameters:"user_id="+user_id + "&user_pass="+user_pass,
						onSuccess:rld
					}
				);
		}else{
			alert("IDまたはパスワードが間違っています。ご確認の上、再度ログインしてください。\nまたIDまたはパスワードを忘れてしまった場合、再発行を行ってください。");
		}
	}

	function rld(){
		document.location.reload();
	}
	
	function goMainLogin(){
		var user_id, user_pass, param;
		user_id = $F('user_id');
		user_pass = $F('user_pass');
		param = "user_id=" + user_id +"&user_pass=" + user_pass; 
		var myAjax = new Ajax.Request(
			'userIdPassCheck.action',
			{
				method:'POST',
				parameters:param,
				onSuccess:login
			}
		);
	}
	
	function araLogin(){
		var user_id = $F('user_id');
		var myAjax = new Ajax.Request(
			'checkBeforeLogin.action?user_id='+user_id ,
			{
				onSuccess:araMemberCheck
			}
		);
	}
	
	function araMemberCheck(transport){
		var user_id, user_pass, param;
		user_id = $('user_id').value;
		user_pass = $('user_pass').value;
		var flag = transport.responseText;
		if(flag == "ok"){
			param = "user_id=" + user_id +"&user_pass=" + user_pass; 
			var myAjax = new Ajax.Request(
				'userIdPassCheck.action',
				{
					method:'POST',
					parameters:param,
					onSuccess:function(transport){
						var flag = transport.responseText;
						if(flag == "true"){
							var user_id = $F('user_id');
							var user_pass = $F('user_pass');
							
							var myAjax = new Ajax.Request(
									"memberLogin.action",
									{
										method:'POST',
										parameters:"user_id="+user_id + "&user_pass="+user_pass,
										onSuccess:function(){
											var rURL = $F('rURL');
											var carName = $F('carName');
											if(carName!="")
												document.location.href = "goPage.action?pageName="+rURL + "&carName="+carName;
											else
												document.location.href = "goPage.action?pageName="+rURL;
										}
									}
								);
						}else{
							alert("IDまたはパスワードが間違っています。ご確認の上、再度ログインしてください。\nまたIDまたはパスワードを忘れてしまった場合、再発行を行ってください。");
						}
					}
				}
			);
		}else{
			alert(flag);
		}
	}
	
	function goLogout(){
		//		window.open("goPage.action?pageName=goSorryPopup", "ARARIO", "width=395 ,height=295, scrollbars=no");
		
		if (confirm("ログアウトしますか？")) {
			var myAjax = new Ajax.Request('memberLogout.action', {
				onSuccess: rld
			});
			
		//logoutForm.target = "ifrLogout";
		//			formLogout.action = "memberLogout.action";
		//			formLogout.submit();
		//document.location.reload();
		//document.location.href = "goPage.action?pageName=MainPlo";
		}
	}
	
	function gotoBestBoardList(){
		var cpd = parent.cpd;
		setCount('DC004003', 27, cpd);
		var board_no = 'DC003027';
		document.location.href =  "goPage.action?board_no=" + board_no + "&pageName=goBestTrialRide";
	}
	function changeChar(){
		char_no = document.forms["formLogout"].char_no.value;	
		alert(char_no);
		new Ajax.Request('changeChar.action?char_no='+char_no, {onSuccess: rld});
		
//		char_no = formLogout.char_no.value;
//		formLogout.target = "ifrLogout";	
//		formLogout.action = "changeChar.action";
//		formLogout.submit();
//		settimeout("document.location.reload()",1);
	}
	
	function changeChar(char_no){
		if(!char_no){
			char_no = document.forms["formLogout"].char_no.value;
		}
		new Ajax.Request('changeChar.action?char_no='+char_no);
		setTimeout("document.location.reload()", 200);
	}
	
	function changeChar1(){

		char_no = formLogout.char_no.value;
		formLogout.target = "ifrLogout1";
		formLogout.action = "changeChar.action";
		formLogout.submit();
		//settimeout("document.location.reload()",100);
		//settimeout("document.location.href = event0417.action",100);
	}
	function viewHome(){
		window.open('http://www.arario.co.jp/', 'ArarioCoporation', 'width=900,height=600,statusbar=yes,toolbar=yes,resizable=yes,top=20,left=20;');
	}

	function alertLogin(){
		alert('ログインしてからご利用ください。');
	}
	
	
	function modifyCancel(){
		document.location.reload();
	}
	function goModify(m_type, gbn){
		modifyForm.m_type.value = m_type;
		modifyForm.target = "modifyMember";
		modifyForm.action = "updateMember.action";

		if(m_type == 'pwd'){
			document.modifyForm.pwd.value = trim(modifyForm.pwd.value);
			pwd = modifyForm.pwd.value;
			document.modifyForm.new_pwd.value = trim(modifyForm.new_pwd.value);
			new_pwd = modifyForm.new_pwd.value;
			document.modifyForm.new_pwd_confirm.value = trim(modifyForm.new_pwd_confirm.value);		
			new_pwd_confirm = modifyForm.new_pwd_confirm.value;
			
			if(pwd == ''){
				alert('パスワードを入力してください。');
				modifyForm.pwd.focus();
			}
			else if(new_pwd == ''){
				alert('パスワードの確認を入力してください。');
				modifyForm.new_pwd.focus();			
			}
			else if(new_pwd_confirm == ''){
				alert('パスワードの確認を入力してください。');
				modifyForm.new_pwd_confirm.focus();			
			}
			else if(new_pwd != new_pwd_confirm ){
				alert('パスワードが一致しません。');
				modifyForm.new_pwd_confirm.focus();
			}
			else if(new_pwd.length < 6){
				alert('パスワードは6文字以上入力してください。');
				modifyForm.new_pwd.focus();			
			}
			else {
				modifyForm.submit();
				//document.location.reload();			
			}
		} else if(m_type == 'email'){
			modifyForm.action = "isExistEmail.action";
			modifyForm.submit();
			document.modifyForm.email.value = trim(modifyForm.email.value);
			var email = modifyForm.email.value;			
			document.modifyForm.email_confirm.value = trim(modifyForm.email_confirm.value);		
			var email_confirm = modifyForm.email_confirm.value;
			if(email != email_confirm){
				alert('メールアドレスが一致しません。');
				modifyForm.email_confirm.focus();
			}
			/*
			else if(document.modifyForm.isExistEmail.value == "true"){
				alert('すでに登録されたメールアドレスです。');
				modifyForm.email_confirm.focus();
			}
			*/
			else if(!MailCheck(email)) {
				alert('メールアドレスを正しく入力して下さい。');
				modifyForm.email.focus();
			}
			else {
				setTimeout('updateEmail()', 500);
				//document.location.reload();			
			}

		} else if(m_type == 'addr'){
			document.modifyForm.post1.value = trim(modifyForm.post1.value);
			post1 = modifyForm.post1.value;
			document.modifyForm.post2.value = trim(modifyForm.post2.value);
			post2 = modifyForm.post2.value;
			document.modifyForm.post.value = trim(modifyForm.post1.value) + '-' + trim(modifyForm.post2.value);		
			document.modifyForm.addr1.value = trim(modifyForm.addr1.value);
			addr1 = modifyForm.addr1.value;
			document.modifyForm.addr2.value = trim(modifyForm.addr2.value);
			addr2 = modifyForm.addr2.value;
			
			if(post1.length != 3){
				alert('郵便番号を入力してください。');
				modifyForm.post1.focus();			
			}
			else if(post2.length != 4){
				alert('郵便番号を入力してください。');
				modifyForm.post2.focus();			
			}
			else if(addr1 == ''){
				alert('住所を入力してください。');
				modifyForm.addr1.focus();			
			}
			else {
				modifyForm.submit();
				//document.location.reload();		
			}
		} else if(m_type == 'newsletter'){
			modifyForm.submit();
			//document.location.reload();
		}
	}
	
	
	function updateEmail(){
		if(document.modifyForm.isExistEmail.value == 'false'){
			modifyForm.action = "updateMember.action";
			modifyForm.submit();
		}
	}
	
	function viewInfo(id){
		
		
		//document.location.href =  "goPage.action?pageName=PopupLogout";
		
		var status = document.getElementById(id).style.display;
		
		if(status == 'none'){
			document.getElementById("pass").style.display = 'none';
			document.getElementById("email").style.display = 'none';
			document.getElementById("newsletter").style.display = 'none';
			document.getElementById("addr").style.display = 'none';
			//document.getElementById("phone").style.display = 'none';
			document.getElementById(id).style.display = '';
		} else {
			document.getElementById(id).style.display = 'none';
		}
	}

function jsCheckDate( dateVal )
{
     var isDate  = true ;
     if ( dateVal.length != 8 )
     {
          isDate = false ;
     }
     else
     {
           var yy = dateVal.substring(0,4) +"" ;
           var mm = dateVal.substring(4,6) +"" ;
           var dd = dateVal.substring(6,8) +"" ;
           if ( !jsCheckYYYY(yy) )
              isDate = false ;
           else if ( !jsCheckMM(mm) )
              isDate = false ;
           else if ( !jsCheckDD (yy,mm,dd) )
              isDate = false ;
     }
     return isDate ;
}
function jsCheckYYYY(toCheck)
{
   return ( ( toCheck.length == 4) && ( jsCheckNumber(toCheck)  ) && ( toCheck != "0000") );
}
function jsCheckMM(toCheck)
{
      return ((toCheck.length > 0) && (jsCheckNumber(toCheck)) && (0< eval(toCheck)) && (eval(toCheck) < 13));
}
function jsCheckDD(yyyy,mm,toCheck)
{
      var isYMD  = false;
      var monthDD= new jsMonthArray(31,28,31,30,31,30,31,31,30,31,30,31);
      var im     = eval(mm) - 1;
      if ( toCheck.length == 0 )  return false;
      if ( !jsCheckNumber(toCheck)  )  return false;
      var dd     = eval(toCheck);
      if ( ( (yyyy%4 == 0) && (yyyy%100 != 0) ) || (yyyy%400 == 0) )
      {
           monthDD[1] = 29;
      }
      if ( (0 < dd) && (dd <= monthDD[im]) ) isYMD = true;
           return isYMD;
}

function jsMonthArray(m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11)
{
      this[0] = m0;
      this[1] = m1;
      this[2] = m2;
      this[3] = m3;
      this[4] = m4;
      this[5] = m5;
      this[6] = m6;
      this[7] = m7;
      this[8] = m8;
      this[9] = m9;
      this[10] = m10;
      this[11] = m11;
}

function jsCheckNumber(toCheck)
{
     var chkstr = toCheck+"" ;
     var isNum = true ;
     if ( jsCheckNull(toCheck) )
          return false;
     for (j = 0 ; isNum && (j < toCheck.length) ; j++)
     {
          if ((toCheck.substring(j,j+1) < "0") || (toCheck.substring(j,j+1) > "9"))
          {
             if ( toCheck.substring(j,j+1) == "-" || toCheck.substring(j,j+1) == "+")
             {
                if ( j != 0 )
                {
                   isNum = false;
                }
             }
             else
       isNum = false;
     }
     }
     if (chkstr == "+" || chkstr == "-") isNum = false;
     return isNum;
}
function jsCheckNull( toCheck )
{
     var chkstr = toCheck + "";
     var is_Space = true ;
     if ( ( chkstr == "") || ( chkstr == null ) )
    return( true );
     for ( j = 0 ; is_Space && ( j < chkstr.length ) ; j++)
     {
      if( chkstr.substring( j , j+1 ) != " " )
         {
        is_Space = false ;
         }
     }
     return ( is_Space );
}
function checkKey(key)
{

    if ((key >= 48 && key <= 57) // 키보드 상단 숫자키
       || (key >= 96 && key <= 105) // 키패드 숫자키
       || key == 8  // 백스페이스 키
       || key == 37 // 왼쪽 화살표 키
       || key == 39 // 오른쪽 화살표 키
       || key == 46 // DEL 키
       || key == 13 // 엔터 키

       || key == 9  // Tab 키
       ) {
           return true;
      } else {
          // alert(key);
          return false;
     }
}

function checkKeyID(key)
{
//alert(key);
    if ((key >= 48 && key <= 57) // 키보드 상단 숫자키
       || (key >= 65 && key <= 90) // 영문키
       || (key >= 96 && key <= 105) // 키패드 숫자키
       || (key >= 34 && key <= 40)
       || (key >= 45 && key <= 46)
       || key == 8  // 백스페이스 키
       || key == 13 // 엔터 키
       || key == 9  // Tab 키
       ) {
           return true;
      } else {
          // alert(key);
          return false;
     }
}

function radioSelect(form){
	for(var i=0; i < form.length; i++) {

		if (form[i].checked == true){
			return form[i].value;					
			break;		
		}
	}
	return false;
}

function trim(text) {
 if (text == "") {
  return text;
 }
 var len = text.length;
 var st = 0;
 while ((st < len) && (text.charAt(st) <= ' ')) {
  st++;
 }
 while ((st < len) && (text.charAt(len - 1) <= ' ')) {
  len--;
 }
 return ((st > 0) || (len < text.length)) ? text.substring(st, len) : text;
}
/* text의 좌측의 공백을 제거해서 리턴*/
function ltrim(text) {
 if (text == "") {
  return text;
 }
 var len = text.length;
 var st = 0;
 while ((st < len) && (text.charAt(st) <= ' ')) {
  st++;
 }
 return (st > 0) ? text.substring(st, len) : text;
}
/* text의 우측의 공백을 제거해서 리턴*/
function rtrim(text) {
 if (text == "") {
  return text;
 }
 var len = text.length;
 var st = 0;
 while ((st < len) && (text.charAt(len - 1) <= ' ')) {
  len--;
 }
 return (len < text.length) ? text.substring(st, len) : text;
}

function GetSelectedTxt(objSelect){
    var i;
    var selectedtext = "";
    for(i=0;i<objSelect.options.length;i++){
            if(objSelect.options[i].selected==true){
                    selectedtext= objSelect.options[i].text;
                    break;
            }
    }
	return selectedtext;
} 
function GetRadioSelectedTxt(form){

	for(var i=0; i < form.length; i++) {

		if (form[i].checked == true){
			return form[i].id;					
			break;		
		}
	}
}

	function viewRules(type){
		var returnPage = "CopyRight";
		
		if(type == 'copy'){
			returnPage = 'CopyRight';
		} else if(type == 'priv'){
			returnPage = 'Privacy';
		} else if(type == 'serv'){
			returnPage = 'Service';
		} else if(type == 'business'){
			returnPage = 'Business';
		}
		//setCount('DC004003', 34);
		
		window.open('goPage.action?pageName=' + returnPage, 'Rules', 'width=1000,height=600,statusbar=no,scrollbars=yes,toolbar=no,resizable=yes,top=20,left=20;');
	}

function viewEvent(cDate, todate){
	//alert(document.formSearch.logdt.value);
	//var ddate = document.formSearch.logdt.value;
	
	if (cDate=='080306'){
		window.open('goPage.action?pageName=Event_0306','Event_080306','width=910,height=650,statusbar=no,scrollbars=yes,toolbar=no,resizable=no,top=0,left=0;');		
	} else if (cDate == '080306_1p_t'){
		window.open('../goPage.action?pageName=Event_0306_1P','Event_080306_1p','width=460,height=510,statusbar=no,scrollbars=no,toolbar=no,resizable=no,top=0,left=0;');
	} else if (cDate=='080306_1p'){
		window.open('goPage.action?pageName=Event_0306_1P','Event_080306_1p','width=460,height=510,statusbar=no,scrollbars=no,toolbar=no,resizable=no,top=0,left=0;');		
	} else if (cDate=='080306_2p'){
		window.open('goPage.action?pageName=Event_0306_2P','Event_080306_2p','width=460,height=650,statusbar=no,scrollbars=yes,toolbar=no,resizable=no,top=0,left=0;');		
	} else if (cDate=='080306_2p_t'){
		window.open('../goPage.action?pageName=Event_0306_2P','Event_080306_2p','width=460,height=650,statusbar=no,scrollbars=yes,toolbar=no,resizable=no,top=0,left=0;');		
	} else if (cDate=='main_1'){
		document.location.href =  "goPage.action?board_no=" + 'DC003007' + "&pageName=" + 'goFreeBoardView' + "&seqNo=" + 3 + "&noticeYn=" + 'N';
	} else if (cDate=='main_2'){
		document.location.href =  "goPage.action?board_no=" + 'DC003007' + "&pageName=" + 'goFreeBoardView' + "&seqNo=" + 3 + "&noticeYn=" + 'N';
	} else if (cDate=='080306_2p_result'){

		if (document.formSearch.logdt.value == '20080520'){
			document.formSearch.logdt.value = '20080327';
			updateByPost('event0306_2_result.action', '0306_2pInner', 'formSearch');
			document.formSearch.logdt.value = '20080327';
		} else if (document.formSearch.logdt.value == '20080403'){
			document.formSearch.logdt.value = '20080327';
			updateByPost('event0306_2_result.action', '0306_2pInner', 'formSearch');
			document.formSearch.logdt.value = '20080327';
		} else if (document.formSearch.logdt.value == '20080327'){
			document.formSearch.logdt.value = '20080320';
			updateByPost('event0306_2_result.action', '0306_2pInner', 'formSearch');
			document.formSearch.logdt.value = '20080320';
		} else if (document.formSearch.logdt.value == '20080320'){
			document.formSearch.logdt.value = '20080313';
			updateByPost('event0306_2_result.action', '0306_2pInner', 'formSearch');
			document.formSearch.logdt.value = '20080313';
		} else {
			document.formSearch.logdt.value = '20080313';
			updateByPost('event0306_2_result.action', '0306_2pInner', 'formSearch');
		}
		
	} else if (cDate == '080321') {
		document.location.href = "goPage.action?board_no=" + "DC003007" + "&pageName=" + "goFreeBoardView" + "&seqNo="+4+"&noticeYn=" + "N";
	} else if (cDate == '080321_goldentime') {
		document.location.href = "goPage.action?board_no=" + "DC003007" + "&pageName=" + "goFreeBoardView" + "&seqNo="+5+"&noticeYn=" + "N";
	} else if (cDate == '080417_1'){
		window.open('event0417.action','Event_0417_1','width=1024,height=700,statusbar=no,scrollbars=yes,toolbar=no,resizable=no,top=0,left=0;');
	}
	
	
//	document.location.href =  "goPage.action?board_no=" + 'DC003007' + "&pageName=" + 'goFreeBoardView' + "&seqNo=" + 2 + "&noticeYn=" + 'N';

}

// Copying ClipBoard Text or Something
// 클립보드에 텍스트를 복사하는 함수
function copyClipBoard(text)	{
   if (window.clipboardData.setData("text", text))
     alert("コピーしました。");
   else
     alert("コピーしませんでした。");
}
function copyClipBoard2(text)	{
   if (window.clipboardData.setData("text", text))
     alert("アドレスをコピーしました。");
   else
     alert("アドレスをコピーしませんでした。");
}

//Function of April Event
function aprilSchedule(){
	document.location.href="goPage.action?board_no=DC003104&pageName=goFreeBoardView&seqNo=1&noticeYn=N";
}
function goldenTime2(){
	document.location.href="goPage.action?board_no=DC003007&pageName=goFreeBoardView&seqNo=6&noticeYn=N";
}

//Function of AprilScheduel

function openCras_sch(type){
	if(type == ""){
		document.location.href ='goPage.action?board_no=DC003006&pageName=goFreeBoardView&seqNo=5&noticeYn=N';
	}else{
		parent.document.location.href ='goPage.action?board_no=DC003006&pageName=goFreeBoardView&seqNo=5&noticeYn=N';	
	}
} 
function goldentime2_sch(type){
	if(type==""){	
		document.location.href ='goPage.action?board_no=DC003007&pageName=goFreeBoardView&seqNo=6&noticeYn=N'; 
	}else { 
		parent.document.location.href ='goPage.action?board_no=DC003007&pageName=goFreeBoardView&seqNo=6&noticeYn=N';		
	}
}

function eventMainBanner(seq_no, type){
	if(type=="C"){ 
		document.location.href = 'goPage.action?board_no=DC003007&pageName=goFreeBoardView&seqNo='+seq_no+'&noticeYn=N';
	}else{ 
		parent.document.location.href = 'goPage.action?board_no=DC003007&pageName=goFreeBoardView&seqNo='+seq_no+'&noticeYn=N';
	}
}

function goUpdatePage(seq_no, type){
	if(type==""){ 
		document.location.href = 'goPage.action?board_no=DC003006&pageName=goFreeBoardView&seqNo='+seq_no+'&noticeYn=N';
	}else{ 
		parent.document.location.href = 'goPage.action?board_no=DC003006&pageName=goFreeBoardView&seqNo='+seq_no+'&noticeYn=N';	
	}
}

function goAnnouncePage(seq_no, type){
	if(type==""){ document.location.href = 'goPage.action?board_no=DC003005&pageName=goFreeBoardView&seqNo='+seq_no+'&noticeYn=N';
	}else{ parent.document.location.href = 'goPage.action?board_no=DC003005&pageName=goFreeBoardView&seqNo='+seq_no+'&noticeYn=N';	
	}
}

function goLineUp(type){
	if(type == ""){
		parent.document.location.href = "goPage.action?pageName=goLineup";
	}else{
		document.location.href = "goPage.action?pageName=goLineup";
	}
}
function goLineUPS(){
	parent.document.location.href = "goPage.action?pageName=goLineup";
}
function gameCoinCF(){
	parent.location.href = "http://www.cfonline.jp/getBoardArticle.action?board_name=event&seq_no=13";
}
function goCommunity(seq_no){
	document.location.href="goPage.action?board_no=DC003002&pageName=goFreeBoardView&seqNo="+seq_no+"&noticeYn=N";
}
function goDC(){
	parent.location.href = "http://www.driftcity.jp";
}
function goCF(){
	parent.location.href = "http://www.cfonline.jp";
}

function goUnitedSupport(){
	parent.location.href = "goPage.action?pageName=united_support";
}
//goCMQnaStep1
function goCMQna1(){
	parent.location.href = "goPage.action?pageName=cmQnaStep1";
}

//goCMQnaStep2
function goCMQna2(gbn){
	parent.location.href = "cmqnastep2.action?gbn="+gbn;
}

//goCMQnaStep3
function goCMQna3(){
	var gbn = $('gbn').value;
	var cd_nm = $('cd_nm').value;
	var title = $('title').value;
	var form = $('cmqnaForm')	
	form.submit();
	//parent.location.href = "cmqnastep3.action";
}

function araCashList(){
	var gbn = '4';
	var month = $('month').value;
	var usn = $('usn').value;
	//alert(gbn + " " + month + " " + usn);
	updateByGet("AraCashList.action","chargeList","usn="+usn+"&gbn="+gbn+"&month="+month);
}


//preLoadCarImage
function uploadCarImg(){
	var eventForm = $('eventForm');
	eventForm.action = "CarImgUpload.action";
	eventForm.submit();
}

function carImgCheck(){
	var eventForm = $('eventForm');
	
	if(eventForm.title.value == ""){
		alert("一言コメントを記入してください");
	}else if(eventForm.contents.value == ""){
		alert("コメントを記入してください");
	}else if(10 < eventForm.title.value.length  ){
		alert("一言コメントは10文字以上は入力できません");
		eventForm.title.value = "";
		eventForm.title.focus();
	}else if( 150 < eventForm.contents.value.length){
		alert("コメントは150文字以上は入力できません");
		eventForm.contents.value = "";
		eventForm.contents.focus();
	}else if(eventForm.file.value.length < 1){
		alert("スクリーンショットを選択してください。");
	}else{
		eventForm.action = "CarImgCheck.action";
		eventForm.target = "_self";
		eventForm.submit();
	}
}

function setSize(img_width){
	var img = document.images.imgview;
			
	if(img.width > img_width){
		 img.height = (img_width/img.width)*img.height;
		 img.width = img_width;
	}		
}
function changeCharOnEvent(){
		var char_no = $('char_no');
		eventForm.target = "ifrFileUp";
		eventForm.action = "changeChar.action";
		eventForm.submit();
		//settimeout("document.location.reload()",100);
		//settimeout("document.location.href = event0417.action",100);
}

function enterForContest(){
	eventForm.action = "CarImgUpload.action"
	eventForm.submit();
}

function initContest(){
	//document.eventForm.page_no.value="1";
	updateByPost('CarContestList.action', 'contestList', 'eventForm');
}

function callLogin(seq_no){
	alert('ログインしてからご利用ください。');
	var seq_no = seq_no;
	var board_no = $('board_no').value;
	if(board_no == 'contestView'){
		document.location.href ="goPage.action?pageName=araEventLogin&board_no=contestView&rURL="+ seq_no;
	}else if(board_no == 'DC003050'){
		document.location.href ="goPage.action?pageName=araEventLogin&board_no=contestList";
	}
}

function displayDiv(div){
	var obj = document.getElementById(div);
	if(obj.style.display == ""){
		obj.style.display = "none";
	}else{
		obj.style.display = "";
	}
}

function setSize(img_width){
	var img = $('imgview');
			
	if(img.width > img_width){
		 img.height = (img_width/img.width)*img.height;
		 img.width = img_width;
	}		
}
/*2008.07.31 Update*/
function schedule(){
	document.write("<object data='img/flash/schedule.swf' width='633' height='776' type='application/x-shockwave-flash'>");
	document.write("<param name='movie' value='img/flash/schedule.swf' />");
	document.write("<param name='wmode' value='transparent'>");
	document.write("</object>");
}

/*2008.09.04 Renewal*/
function gotoScreenShotView(seq_no){
	
	var cpd = parent.cpd;
	setCount('DC004003', 51, cpd);
	document.location.href =  "goPage.action?board_no=DC003051&pageName=ScreenShotView&seqNo=" + seq_no + "&noticeYn=N";
	
}
function goTeamBoardView(seq_no){
	var cpd = parent.cpd;
	setCount('DC004003', 56, cpd);
	document.location.href = "teamBoardView.action?seq_no="+seq_no;
}

function goTrialRideView(seq_no){
	var cpd = parent.cpd;
	setCount('DC004003', 3, cpd);
	document.location.href = "goPage.action?board_no=DC003003&pageName=goFreeBoardView&seqNo="+seq_no+"&noticeYn=N"
}

function goFreeBoardView(seq_no){
	setCount('DC004003', 1);	
	document.location.href = "goPage.action?board_no=DC003001&pageName=goFreeBoardView&seqNo="+seq_no+"&noticeYn=N"
}

function goAraCashCharge(){
	document.location.href = "goPage.action?pageName=araChargeGuide";
}

function startGame(){
		
	var luncherCheck = valueForm.luncherInstalled.value;
	var openYn = getCookie("OPEN_YN");
	if(openYn == "Y"){
		var myAjax = new Ajax.Request("openIdStartGame.action", {
			onSuccess:function(transport){
				var jsonData = transport.responseText;
				var data = eval("("+jsonData+")");
				var id = data.user_id;
				if(id==""){
					alert("ログインしてからご利用ください。");	
				}else{
					var hashcode = data.hashcode;
					//QA
					//var launcherCode = "artp://?version=2&gameid=driftcity&k0030="+id+"&k0041="+data.op+"&hashcode="+hashcode+"&beta=1";
					//REAL
					var launcherCode = "artp://?version=2&gameid=driftcity&k0030="+id+"&k0041="+data.op+"&hashcode="+hashcode;
					parent.location.href = launcherCode;	
				}
			}
		});
		return;
	}
	
	if(luncherCheck == "false"){		
		alert("ActiveXコントロールのインストールが必要です。\nActiveXコントロールのダウンロードを行ってください。");
	}else if(parent.cpd == "ncjp"){
		var myAjax = new Ajax.Request("executeNCJPLauncher.action", {
			onSuccess:function(transport){
				var jsonData = transport.responseText;
				var data = eval("("+jsonData+")");
				var id = data.user_id;
				if(id==""){
					if(parent.sflag == 1){
						alert("ゲームをプレイするには、「サービス追加」が必要となります。");
					}else{
						alert("ログインしてからご利用ください。");	
					}
				}else{
					var hashcode = data.hashcode;
					var launcherCode = "artp://?version=2&gameid=driftcity&k0030="+id+"&corp=ncj&launcher=aragamestarternjp&hashcode="+hashcode;
					//alert(launcherCode);
					parent.location.href = launcherCode;	
				}
			}
		});
	}else{
		document.location.href="artp://gameid=driftcity";
	}
}

function activeXLoadError(){
	try{
		valueForm.luncherInstalled.value = "false";	
	}catch(e){
		
	}
}

function dontsee(dontsee){
	if(dontsee == 'Y'){
		if(document.getElementById('dontsee').checked){
				updateByGet('mainViewYN.action', '', 'dontsee=Y');
		}
	} else {
				updateByGetAfterFNbegin('mainViewYN.action', '', 'dontsee=N');
	}
}
function updateByGetAfterFNbegin(url, divName, param){	
	var myAjax = new Ajax.Updater(
		divName, 
		url, 
		{
			method: 'get', 
			parameters: param,
			onComplete: goMainBegin
		}
	);
}

//Line and Contents length Check!
function checkContents(id,wordsCnt, lineCnt){
	var contents = $F(id);
	var linenum = contents.split("\n");
	var retVal = true;
	if(contents.length > wordsCnt || linenum.length > lineCnt){
		alert(lineCnt+"行以内、"+wordsCnt+"文字以内で入力してください。");
		retVal = false;
	}
	return retVal;
}

function alertRestraint(){
	var restraint = $F('restraint');
	alert(restraint + "まで投稿が制限されています。");
}

//KeyPress Cross Browser Version
function keyPress(evt){
	var ieKey = evt.keyCode || evt.which;
	if ( ieKey == 13 ){
		goLogin();
	}
}


//KeyPressSearch Cross Browser Version
function keyPressSearch(evt){
	var ieKey = evt.keyCode || evt.which;
	//alert(ieKey);
	if ( ieKey == 13 ){
		goSearch(1);
	}
}

function alertNoChar(){
	alert("キャラクターを作成してからご利用ください。");
}

//Function for Channeling
function goSearchPwdNId(){
	var cpd = parent.cpd;
	if(cpd=="ncjp"){
		top.location.href = "https://ssl.plaync.jp/login/login.aspx?returl=http://driftcity.plaync.jp";
	}else{
		document.location.href = "http://www.arario.jp/?pn=searchInfo";
	}
} 

//채널링 로그아웃 함수
function channelLogout(){
	if(confirm("ログアウトしますか？")){
		var myAjax = new Ajax.Request('memberLogout.action');
		 top.location.href = "https://ssl.plaync.jp/login/logout/?returl=http://driftcity.plaync.jp"; //"/?cpd=ncjp"	
	}
}

//코인충전페이지 
function goCoinCharge(){
	if(parent.cpd=="ncjp"){
		top.location.href= "http://shop.plaync.jp/gamepayment/paymenthome.nc";
	}else{
		document.location.href = "http://www.arario.jp/home.htmls?pn=charge"; //"goPage.action?pageName=araChargeGuide";
	}
}

function applingChanneling(){
	//channeling
	var cpd = parent.cpd;
	
	if(cpd=="ncjp"){
		//$('rioChargeBanner').style.display = "none"; //리오코인 차지 배너
		//초심자 페이지 
		var beginer = $('beginer');
		beginer.href  = "http://driftcity.plaync.jp/beginner";
		beginer.target = "_top";
		$('rioChargeBanner').innerHTML = '<a href="http://shop.plaync.jp/gamepayment/gamePaymentHome.nc" target="_top" ><img src="img/layout/left_banner_02.gif" /></a>'; //리오코인 차지 배너
	}
	
	//로그아웃 되어있을 경우
	if($('login_box')){
		var login = $('login_box');
		var btnImg = "btn_login.gif";
		var addrLogin = "https://ssl.plaync.jp/login/Cplogin.aspx?cpcode=driftcity&pagestatus=0&returl=http%3A%2F%2Fdriftcity.plaync.jp%2F"; //"http://www.arario.jp/araLogin.htmls?rURL=dc";
		var sflag = parent.sflag;
		if(sflag == "1"){
			btnImg = "btn_serviceAdd.gif";
			addrLogin = "https://ssl.plaync.jp/login/Cplogin.aspx?cpcode=driftcity&pagestatus=1&returl=http%3A%2F%2Fdriftcity.plaync.jp%2F";
		}
		if(cpd == "ncjp"){
			var targetType = "_top";
			var channelLogin = '<table width="158" height="100" border="0" cellpadding="0" cellspacing="0">';
			channelLogin += '<tr><td colspan="2"><a href="'+ addrLogin +'" target="'+targetType+'" title="Login"><img src="img/layout_2008/'+btnImg+'" align="absmiddle" /></a></td></tr>';
			channelLogin += '<tr><td colspan="2" height="7"></td></tr>';
			channelLogin += '<tr><td colspan="2"><img src="img/layout/login_idsearch.gif" vspace="3" onclick="javascript:viewStartRegi();" style="cursor:pointer;" /></td></tr>';
			channelLogin += '<tr><td colspan="2"><img src="img/layout/login_pass_search.gif" onclick="javascript:goSearchPwdNId();" style="cursor:pointer;" /></td></tr>';
			channelLogin += '<tr><td colspan="2" class="mypage"><a href="javascript:alertLogin();"><img src="img/layout/btn_mypage.gif" /></a>'; 
			channelLogin += '<a href="javascript:gotoAllPage(\'DC003036\');"><img src="img/layout/tit_members.gif" /></a></td></tr></table>'
			login.innerHTML = channelLogin ;
		}
	}
	
	//로그인 되어있을 경우
	if($('logoutButton')){
		if(cpd == "ncjp"){
			//쿠키삭제후 플레이엔씨 로그아웃 페이지로 포워딩
			$('logoutButton').href = "javascript:channelLogout();"
		}
	}
}

function eventLink(seq_no){
	if(seq_no == 1){
		window.open("goPage.action?pageName=snowrive");
		//document.location = "goPage.action?pageName=snowrive";
	}else if(seq_no == 2){
		window.open("undercity2.action");
	}
}

function goSpecialCars(cName){
	var eventForm = $('eventForm');
	var pageName = $('pageName');
	var carName=$('carName');
	eventForm.target = "_blank";
	if(parent.cpd =="ncjp"){
		eventForm.action ="http://driftcity.plaync.jp/";
	}else{
		eventForm.action ="goPage.action";
	}
	pageName.value="specialCar";
	carName.value = cName;
	eventForm.submit();
}


/**
 *  2009.02.19 Tournament 
 *  ExtraLogin  
 *  Step 1 -> Restraint Check
 *  Step 2 -> user ID & Pass Check
 *  Step 3 -> Login Process
 */ 

function extraLogin(){
	alert("ログインしてからご利用ください。");
	if(parent.cpd != "ncjp"){
		document.location.href ="goPage.action?pageName=extraLogin&rURL="+encodeURIComponent(document.URL);
	}
} 

function goExtraLogin(){
	var user_id = $('user_id').value;
	var user_pass = $('user_pass').value;
	var rURL = $('rURL').value;
	
//Step1
		var myAjax = new Ajax.Request(
			'checkBeforeLogin.action?user_id='+user_id ,
			{
				onSuccess:function(transport){
					var flag = transport.responseText;
					if(flag=="ok"){	
//Step2		
						new Ajax.Request('userIdPassCheck.action',	{
							method:'POST',
							parameters:"user_id="+$('user_id').value+"&user_pass="+$('user_pass').value,
							onComplete:function(transport){
								var bool = transport.responseText;
								if(bool == "true"){
//Step3
									document.loginForm.submit();
								}else{
									alert("IDまたはパスワードが間違っています。ご確認の上、再度ログインしてください。\nまたIDまたはパスワードを忘れてしまった場合、再発行を行ってください。");
								}
							}
						});
					}else{
						alert(flag);
					}
				}
			}
		);
}


function checkLogin(rURL){
	alert(" ログイン後、申請をお願いします。");
	if(parent.cpd != "ncjp"){
		document.location.href ="goPage.action?pageName=extraLogin&rURL="+rURL;
	}
}

function bookmarksite(title) {
   var url = "http://driftcity.arario.jp";
   if(parent.cpd=="ncjp"){
   		url = "http://driftcity.plaync.jp";
   }
   
   if (window.sidebar) // firefox 
   window.sidebar.addPanel(title, url, ""); 
   else if(window.opera && window.print)

   { // opera 
      var elem = document.createElement('a'); 
      elem.setAttribute('href',url); 
      elem.setAttribute('title',title); 
      elem.setAttribute('rel','sidebar'); 
      elem.click(); 
   } 

  else if(document.all) // ie
   window.external.AddFavorite(url, title);
}


function addIPCount(){
	var cpd = parent.cpd;
	new Ajax.Request("addIpCount.action?cpd="+cpd);
}


function moviePopup(fileName){
	window.open("goPage.action?pageName=goMoviePopup&filename=" + fileName, "ARARIO", "width=325 ,height=242, scrollbars=no");
}

/** 
 * 문자의 바이트수를 세어주는 함수
 * String.bytes() 
 * aaa.bytes() 이런식으로 사용
 */
String.prototype.bytes = function() {
  var str = this;
  var l = 0;
  for (var i=0; i<str.length; i++) l += (str.charCodeAt(i) > 128) ? 2 : 1;
  return l;
}

//replaceAll 追加
String.prototype.replaceAll = function( searchStr, replaceStr ){
 var temp = this;
 while( temp.indexOf( searchStr ) != -1 ) {
  temp = temp.replace( searchStr, replaceStr );
 }
 return temp;
}

/**
 * String trim 
 * Usage : aaa.trim()
 */
String.prototype.trim = function() { 
	return this.replace(/^\s+|\s+$/, ''); 
};

function getCookie(name){
    var search = name + "=";
    
    if (document.cookie.length > 0){
        offset = document.cookie.indexOf(search);
        
        if (offset != -1){
            offset += search.length;
            end = document.cookie.indexOf(";",offset);
        
            if (end == -1) end = document.cookie.length;
            return unescape(document.cookie.substring(offset,end));
        }
        else return false;
    }
    else return false;
}

function yahooCampaign(today){
	if(today>=20090803 && today<20090817){
		var fCode = getCookie("__accpzm");	
		if(fCode=="9VWaGlqYzfjGlpupF5sx")	$('yahoo_pop').show();
	}
}
function ocnNgooCampaign(today){
	if(today>=20090812 && today<20090826){
		var fCode = getCookie("__accpzm");	
		if(fCode=="hnM0yyPhfzhlZFoCtlhL"){			$('ocn_pop').show();
		}else if(fCode=="mcrxyNKlpNi4KqSFzhSg"){	$('goo_pop').show();	}
	}
}
 

function closePop(gbn){
	$(gbn).hide();
//	if(gbn=="yahoo"){			$('yahoo_pop').hide();
//	}else if(gbn=="ocn"){		$('ocn_pop').hide();
//	}else if(gbn=="goo"){		$('goo_pop').hide();		}
}

function loginOpenId(opCode){
	if(opCode == null || opCode == undefined){
		opCode = "YH";
	}
	top.location.href = atongBaseURL + "openIdAuth.htmls?pn=login&opCode="+opCode+"&gn=dc&loginType=araLogin";
}

function openIdAuth(){
	top.location.href = atongBaseURL + "openIdAuth.htmls?pn=whats&gn=dc";
}