// JavaScript Document

/*flash*/
<!--
function Createflash(w, h, movie, ids, params){
	//document.write(w+"<br>");
	//document.write(ids+"<br>");
	//document.write(movie);
	var strflash = "<OBJECT id="+ids+" codeBase=https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0 width="+w+" height="+h+" align=middle classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000>";
	strflash = strflash + "<PARAM NAME='_cx' VALUE='25400'>";
	strflash = strflash + "<PARAM NAME='_cy' VALUE='9260'>";
	strflash = strflash + "<PARAM NAME='Movie' VALUE='"+ movie +"?defaultMenu=" + params + "'>";
	strflash = strflash + "<PARAM NAME='Src' VALUE='" + movie + "?defaultMenu=" + params + "'>";
	strflash = strflash + "<PARAM NAME='WMode' VALUE='Transparent'>";
	strflash = strflash + "<PARAM NAME='Play' VALUE='-1'>";
	strflash = strflash + "<PARAM NAME='Loop' VALUE='-1'>";
	strflash = strflash + "<PARAM NAME='Quality' VALUE='High'>";
	strflash = strflash + "<PARAM NAME='SAlign' VALUE=''>";
	strflash = strflash + "<PARAM NAME='Menu' VALUE='-1'>";
	strflash = strflash + "<PARAM NAME='Base' VALUE=''>";
	strflash = strflash + "<PARAM NAME='AllowScriptAccess' VALUE=''>";
	strflash = strflash + "<PARAM NAME='Scale' VALUE='ShowAll'>";
	strflash = strflash + "<PARAM NAME='DeviceFont' VALUE='0'>";
	strflash = strflash + "<PARAM NAME='EmbedMovie' VALUE='0'>";
	strflash = strflash + "<PARAM NAME='BGColor' VALUE=''>";
	strflash = strflash + "<PARAM NAME='SWRemote' VALUE=''>";
	strflash = strflash + "<PARAM NAME='MovieData' VALUE=''>";
	strflash = strflash + "<PARAM NAME='SeamlessTabbing' VALUE='1'>";
	strflash = strflash + "<PARAM NAME='Profile' VALUE='0'>";
	strflash = strflash + "<PARAM NAME='ProfileAddress' VALUE=''>";
	strflash = strflash + "<PARAM NAME='ProfilePort' VALUE='0'>";
	//strflash = strflash + "<PARAM NAME='FlashVars' VALUE='"+flashvars+"'>";
	strflash = strflash + "<embed src='"+ movie +"?defaultMenu=" + params + "' quality='high' wmode='transparent' width='"+w+"' height='"+h+"' name='"+ids+"' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='https://www.macromedia.com/go/getflashplayer' />";
	strflash = strflash + "</OBJECT>";
	document.write(strflash);
}



/*main*/
function index(num){
	switch(num){		
	    case 1: location.href="../index.jsp"; break;		
		case 2: location.href="./about/adiclubis.jsp"; break;
		case 3: location.href="./my/myadidas.jsp"; break;
		case 4: location.href="./campaign/campaign.jsp"; break;
		case 5: location.href="./member/login.jsp"; break;
		case 6: location.href="./member/faq.jsp"; break;
		case 7: location.href="./sitemap/sitemap.jsp"; break;
		case 8: location.href="./campaign/sanlitun"; break;
		case 9: location.href="./member/legal_page.jsp"; break;
		case 10: location.href="./campaign/notice.jsp"; break;
		case 11: location.href="./member/person_page.jsp"; break;
		case 12: location.href="./index.jsp"; break;
		case 13: location.href="./campaign/campaign1.jsp"; break;
		case 14: location.href="./campaign/campaign2.jsp"; break;
		case 15: location.href="./about/contact.jsp"; break;
		// changes start
		//case 16: location.href="../member/join_web.jsp"; break; 
		case 16: location.href="./member/legal_web.jsp"; break;
		//changes end
	}
}
 

 /*ABOUT */
function about(num){
	switch(num){
		case 1: location.href="../about/adiclubis.jsp"; break;
		case 2: location.href="../about/mileage.jsp"; break;
		case 3: location.href="../about/mobile.jsp"; break;
		//changes start
		//case 4: location.href="../about/about_seoul.jsp"; break;
		//case 4: window.open("http://www.adidas.com/kr/application/contact_adidas/store_finder1/store_main.asp?Fsort=First", "", "scrollbars=no,popup");break;
		case 4: location.href="../about/about_beijing.jsp"; break;
		//changes end
	    case 6: location.href="../about/about_gyeonggi.jsp"; break;
		case 7: location.href="../about/about_shanghai.jsp"; break;
		case 10: location.href="../about/about_beijing.jsp"; break;
		//changes start
		//case 12: location.href="../about/about_seoul.jsp"; break;
		//case 12: window.open("http://www.adidas.com/kr/application/contact_adidas/store_finder1/store_main.asp?Fsort=First", "", "scrollbars=no,popup");break;
		case 12: location.href="../about/about_beijing.jsp"; break;
		//changes end
	}
}

 /*MY ADI*/
function my(num){
	switch(num){
		case 1: location.href="../my/modify.jsp"; break;
		case 2: location.href="../my/mypoint.jsp"; break;
		case 3: location.href="../my/mycoupon.jsp"; break;
		case 4: location.href="../my/myadidas.jsp"; break;
		case 5: location.href="../my/mycoupon_02.jsp"; break;
		case 6: location.href="../my/withdrawal.jsp"; break;
	}
}

 /*CAMPAIGN */
function cam(num){
	switch(num){
		case 1: location.href="../campaign/campaign.jsp"; break;
		case 2: location.href="../campaign/notice.jsp"; break;
	
		case 4: location.href="../campaign/campaign2.jsp"; break;
		case 5: location.href="../campaign/campaign3.jsp"; break;
	}
}
 /*MEMBER*/
function member(num){
	//added on 19 Oct 2010
	var strParameter = "";
	if (member.arguments.length >=3) {
		strParameter = "?user_id=" + escape(member.arguments[1]) + "&session_id=" + escape(member.arguments[2]);
	}
	//added on 19 Oct 2010
	switch(num){
		case 1: location.href="../member/login.jsp"; break;	
		case 2: location.href="../member/idpw_search.jsp"; break;	
		case 3: location.href="../member/login_realname_01.jsp"; break;
		case 4: location.href="../member/login_realname_02.jsp"; break;
		case 5: location.href="../member/login_realname_03.jsp"; break;
		case 6: location.href="../member/login_realname_04.jsp"; break;
		case 7: location.href="../member/login_realname_05.jsp"; break;
		case 8: location.href="../member/faq.jsp"; break;
		case 9: location.href="../member/legal.jsp"; break;
		case 10: location.href="../member/join.jsp"; break;
		case 11: location.href="../member/qna.jsp"; break;
		case 12: location.href="../member/member_id.jsp"; break;
		case 13: location.href="../member/password.jsp"; break;
		case 14: location.href="../member/legal_page.jsp"; break;
		case 15: location.href="../member/person_page.jsp"; break;
		// changes start
		//changed on 19 Oct 2010
		//case 16: location.href="../member/join.jsp"; break; 
		case 16: location.href="../member/join.jsp"+strParameter; break; 
		//changed on 19 Oct 2010
		//changes end
		// changes start
		//case 17: location.href="../member/join_web.jsp"; break; 
		case 17: location.href="../member/legal_web.jsp"; break;
		case 18: location.href="../member/join_web.jsp"; break; 
		//changes end
	}
}

 /*san*/
function san(num){
	switch(num){
		case 1:window.open('http://www.adi-club.cn/sanlitun/ch','san_popup'); 
		break;
	}
}

 /*eman*/
function eman(num){
	switch(num){
		case 1: location.href="../emagazine/emagazine.jsp"; break;
	}
}

/*POP*/
function pop(num){
	switch(num){
	   case 1: window.open('./popup/id_popup.jsp','id_popup','scrollbars=yes,popup,width=400,height=280'); break
		case 2: window.open('../popup/post_popup.jsp','post_popup','scrollbars=yes,popup,width=400,height=385'); break
		case 3:
			var strParameter = "";
			if (pop.arguments.length >=2) {
				strParameter = "?CheckedUserId=" + escape(pop.arguments[1]);
			}
			window.open('../popup/id_popup02.jsp' + strParameter ,'id_popup2','scrollbars=yes,popup,width=400,height=280'); break
		//changes start
		//case 4: window.open('http://www.adidas.com/kr/application/contact_adidas/store_finder1/store_main.asp?Fsort=First','','scrollbars=no,popup,width=800,height=600'); break
		case 4: location.href="../about/about_beijing.jsp"; break;
		//changes end
		case 5: window.open('../popup/store_popup01.jsp','store_popup01','scrollbars=yes,popup,width=500,height=400'); break
		//active member
		case 6: window.open('../member/active_popup.jsp','active_member','scrollbars=yes,popup,width=583,height=389'); break
	}
}

/*real name center*/
function realname(num){
	switch(num){
		case 1: window.open('../popup/realname_check.jsp','','scrollbars=no,popup,width=540,height=500'); break
	    case 2: window.open('http://www.namecheck.co.kr/per/p00.asp'); break;
	}
}

/*sitemap*/
function sitemap(num){
	switch(num){
	    case 1: location.href="../sitemap/sitemap.jsp"; break;
	}
}

/*contact*/
function contact(num){
	switch(num){
	    case 1: location.href="../about/contact.jsp"; break;
	}
}

function login(frmLogin){
	
	 // This function requires a js file named cookie.js
	
	 var Today = new Date();
	 var TodayYear = (Today.getYear() * 1) < 1000 ? (1900 + (Today.getYear() * 1)) : (Today.getYear() * 1);
    var Tomorrow = new Date(TodayYear, Today.getMonth(), Today.getDate()+1);
    var dkYears = new Date(TodayYear+1000, Today.getMonth(), 1);
	
	 trimAllTextBox(frmLogin);
	
    u=frmLogin.input_mem.value;
    p=frmLogin.input_password.value;
    bIDcheck = frmLogin.IDCheck.checked;
    
    if (bIDcheck) {
    	Set_Cookie("loginID",u,dkYears,null,null,null);
    } else {
    	Delete_Cookie("loginID",null,null);
    }
    
    if(u.length == 0)
    {
     alert("请输入您的用户名");
     //alert("酒捞叼甫 涝仿秦 林技夸");
     return false;
    }
    if(p.length == 0)
    {
     alert("请输入您的密码");
     //alert("厚剐锅龋甫 涝仿秦 林技夸");
     return false;
    }

    
    //Check Login Attempt			    
    var FailLoginTime = Get_Cookie("loginIDTimes" + escape(u));
    			
    if (FailLoginTime == null || /^\d+$/.test(FailLoginTime) == false ) {
    	FailLoginTime = 1;
    //}else {
    //	FailLoginTime++;
    }
    			
    if (FailLoginTime >= 3) {
    	alert("如果您3次试图登陆未成功，您今天将不能再进入您的个人区域!");
    	//alert("涝仿坷幅 3雀甫 檬苞窍看栏骨肺 坷疵篮 殿废捞 阂啊瓷 钦聪促");
   	return false;
    }
    
    Set_Cookie("LASTTIMELOGIN",u,Tomorrow,"/",null,null);	
	//Set_Cookie("loginIDTimes" + u,FailLoginTime,Tomorrow,"/",null,null);

    return true;
}

function trimAllTextBox(formObj) {
	for (i=0;i<formObj.elements.length;i++) {
		objCurrentObj = formObj.elements[i];
		if (objCurrentObj.type == "text" || objCurrentObj.type == "password" || objCurrentObj.type == "textarea" ) {
			objCurrentObj.value = objCurrentObj.value.replace(/^\s+|\s+$/g,"");
		}
	}
}

/*switch language*/
function switchlang(){
	path = document.location.pathname;
	if (path.indexOf("/en/") != -1) {
		newpath = (path.indexOf("/ALPWeb/") != -1)?path.substring(0,7) + path.substring(10):path.substring(3);
	} else {
		newpath = (path.indexOf("/ALPWeb/") != -1)?path.substring(0,7) + "/en" + path.substring(7):"/en" + path;
	}
	document.location.href = document.location.protocol + "//" + document.location.host + newpath;
}
