var english='en';var traditionalChinese='zh-tw';var simplifiedChinese='zh-cn';function cfg(sh,th,ab){var uh=0;for(var i=0;i<sh.length;i++){if(sh[i]=='username'){var gg=document.getElementById(th[uh]);if(vh(ab,gg)!=0){gg.select();gg.focus();return false;}
uh++;}
else if(sh[i]=='password'){var password=document.getElementById(th[uh]);var wh=document.getElementById(th[uh+1]);if(xh(ab,password,wh)!=0){password.select();password.focus();return false;}
uh+=2;}
else if(sh[i]=='gender'){var yh=document.getElementById(th[uh]);var zh=document.getElementById(th[uh+1]);if($h(ab,yh,zh)!=0){yh.focus();return false;}
uh=uh+2;}
else if(sh[i]=='preferredName'){var _h=document.getElementById(th[uh]);if(ai(ab,_h)!=0){_h.select();_h.focus();return false;}
uh++;}
else if(sh[i]=='dateOfBirth'){var bi=document.getElementById(th[uh]);var ci=document.getElementById(th[uh+1]);var di=document.getElementById(th[uh+2]);var ei=fi(ab,bi,ci,di);if(ei==1||ei==2||ei==3){bi.select();bi.focus();return false;}
else if(ei==4){ci.focus();return false;}
else if(ei==5){di.focus();return false;}
uh+=3;}
else if(sh[i]=='mobileNumber'){var gi=document.getElementById(th[uh]);if(hi(ab,gi)!=0){gi.select();gi.focus();return false;}
uh++;}
else if(sh[i]=='landlineNumber'){var ii=document.getElementById(th[uh]);var ji=document.getElementById(th[uh+1]);var ei=ki(ab,ii,ji);if(ei==1||ei==2){ji.select();return false;}
else if(ei==3){ii.focus();return false;}
uh+=2;}
else if(sh[i]=='captcha'){var li=document.getElementById(th[uh]);if(mi(ab,li)!=0){li.select();li.focus();return false;}
uh++;}
else if(sh[i]=='currentPassword'){var ni=document.getElementById(th[uh]);if(oi(ab,ni)!=0){ni.select();ni.focus();return false;}
uh++;}
else if(sh[i]=='email'){var pi=document.getElementById(th[uh]);var qi=document.getElementById(th[uh+1]);if(ri(ab,pi,qi)!=0){pi.select();pi.focus();return false;}
uh+=2;}
else if(sh[i]=='role'){var si=document.getElementById(th[uh]);var ti=document.getElementById(th[uh+1]);var ui=document.getElementById(th[uh+2]);var vi=document.getElementById(th[uh+3]);if(wi(ab,si,ti,ui,vi)!=0){si.select();return false;}
uh+=4;}
else if(sh[i]=='location'){var kf=document.getElementById(th[uh+7]);var lf=th[uh+9]==''?null:document.getElementById(th[uh+9]);var ei=xi(th[uh],ab,th[uh+1],document.getElementById(th[uh+2]),document.getElementById(th[uh+3]),document.getElementById(th[uh+4]),document.getElementById(th[uh+5]),th[uh+6],kf,th[uh+8],lf,th[uh+10]);if(ei==1){kf.focus();return false;}
else if(ei==2){lf.focus();return false;}
else if(ei==3||ei==4){kf.focus();return false;}
uh+=11;}
else if(sh[i]=='weekday'){var yi=document.getElementById(th[uh]);var zi=document.getElementById(th[uh+1]);var $i=document.getElementById(th[uh+2]);var _i=document.getElementById(th[uh+3]);var aj=document.getElementById(th[uh+4]);var bj=document.getElementById(th[uh+5]);var cj=document.getElementById(th[uh+6]);if(dj(ab,yi,zi,$i,_i,aj,bj,cj)!=0){yi.select();return false;}
uh+=7;}
else if(sh[i]=='departure'){var bi=document.getElementById(th[uh]);var ci=document.getElementById(th[uh+1]);var di=document.getElementById(th[uh+2]);if(ej(ab,bi,ci,di)!=0){bi.select();return false;}
uh+=3;}
else if(sh[i]=='name'){var name=document.getElementById(th[uh]);if(fj(ab,name)!=0){name.select();name.focus();return false;}
uh++;}
else if(sh[i]=='messageEmail'){var pi=document.getElementById(th[uh]);if(gj(ab,pi)!=0){pi.select();pi.focus();return false;}
uh++;}
else if(sh[i]=='message'){var hj=document.getElementById(th[uh]);if(ij(ab,hj)!=0){hj.select();hj.focus();return false;}
uh++;}
}
return true;}
function vh(ab,gg){if(gg.value==''){jj(ab,'You must have a username to register as a member.','請輸入您的用戶名。','请输入您的用户名。');return 1;}
return 0;}
function xh(ab,password,wh){if(password.value==''&&wh.value==''){jj(ab,'Please enter a password.','請輸入您的密碼。','请输入您的密码。');return 1;}
else if(password.value!=wh.value){jj(ab,'The 2 passwords you have entered did not match.','兩個密碼不同。','两个密码不同。');return 2;}
else if(password.value.length<8){jj(ab,'Your password should be between 8 to 16 characters long.','您的密碼必須在八到十六字符之間。','您的密码必须在八到十六字节之间。');return 3;}
return 0;}
function ai(ab,_h){if(_h.value==''){jj(ab,'Please enter a preferred name.','請輸入您的網路名稱。','请输入您的网路名称。');return 1;}
return 0;}
function $h(ab,yh,zh){if(!yh.checked&&!zh.checked){jj(ab,'Please select gender.','請選擇性別。','请选择性别。');return 1;}
return 0;}
function fi(ab,bi,ci,di){if(bi.value==''&&ci.value==0&&di.value==0){return 0;}
else
{if(bi.value==''){jj(ab,'Please enter year.','請輸入年份。','请输入年份。');return 1;}
else if(bi.value.length!=4){jj(ab,'Year must be 4 digits.','年份必須是四位數。','年份必须是四位数。');return 2;}
else if(!kj(bi.value)){jj(ab,'Year must be a number.','年份必須是數字。','年份必须是数字。');return 3;}
else if(ci.value==0){jj(ab,'Please select month.','請選擇月份。','请选择月份。');return 4;}
else if(di.value==0){jj(ab,'Please select day.','請選擇日。','请选择日。');return 5;}
return 0;}
}
function hi(ab,gi){if(gi.value!=''){if(!kj(gi.value)){jj(ab,'Your cell phone number must contain numbers only.','電話號碼只能有數字。','电话号码只能有数字。');return 1;}
}
return 0;}
function ki(ab,ii,ji){if(ii.value!=0){if(ji.value==''){jj(ab,'You have selected the area code. Please enter the phone number.','您已經選擇了區碼， 請輸入電話號碼。','您已经选择了区码， 请输入电话号码。');return 1;}
else if(!kj(ji.value)){jj(ab,'Your landline number must contain numbers only.','電話號碼只能有數字。','电话号码只能有数字。');return 2;}
}
else
{if(ji.value!=''){jj(ab,'You have entered the landline number. Please select the area code.','您已經輸入了電話號碼，請選擇區碼。','您已经输入了电话号码，请选择区码。');return 3;}
}
return 0;}
function mi(ab,li){if(li.value==''){jj(ab,'Please enter the letters on the security image.','請輸入安全圖片上的字母。','请输入安全图片上的字母。');return 1;}
else if(li.value.length!=4){jj(ab,'There are 4 letters on the image.','圖片上有四個字母。','图片上有四个字母。');return 2;}
else if(!lj(li.value)){jj(ab,'Letter only on the image.','圖片上只有字母。','图片上只有字母。');return 3;}
return 0;}
function oi(ab,password){if(password.value==''){jj(ab,'Please enter your current password.','請輸入您現在的密碼。','请输入您现在的密码。');return 1;}
else if(password.value.length<8){jj(ab,'Your password should be between 8 to 16 characters long.','您的密碼必須在八到十六字符之間。','您的密码必须在八到十六字节之间。');return 2;}
return 0;}
function ri(ab,pi,qi){if(pi.value!=''&&qi.value==''){jj(ab,'Please confirm your email address.','請確認您的電子郵件地址。','请确认您的电子邮件地址。');return 1;}
else if(pi.value!=''&&pi.value!=qi.value){jj(ab,'The 2 email addresses you entered are different.','兩個電子郵件地址不同。','两个电子邮件地址不同。');return 2;}
return 0;}
function wi(ab,si,ti,ui,vi){if(!si.checked&&!ti.checked&&!ui.checked&&!vi.checked){jj(ab,'Please select your role.','請選擇身分。','请选择身份。');return 1;}
return 0;}
function xi(mj,ab,te,we,ze,$e,nj,qf,kf,fe,lf,ge){var ei=0;if(mj||gf(ze.src)=='tick.gif'||gf(ze.src)=='cross.gif'||gf(ze.src)=='multiple.gif'){if(te>=1&&kf.value==0){jj(ab,'Please select '+qf+' '+fe+'.','請選擇'+qf+fe+'。','请选择'+qf+fe+'。');ei=1;}
else if(lf!=null&&te>=2&&lf.value==0){jj(ab,'Please select '+qf+' '+ge+'.','請選擇'+qf+ge+'。','请选择'+qf+ge+'。');ei=2;}
else if(gf(ze.src)=='cross.gif'){if(oj(ab,'Address not found. Click "OK" to correct/remove it or "Cancel" to continue listing the ride.','找不到'+qf+'地址，按"OK"修改或刪除地址或者"Cancel"繼續登記路線。','找不到'+qf+'地址，按"OK"修改或删除地址或者"Cancel"继续发布路程。')){ei=3;}
else
{pj(ab,we,ze,$e,nj);ei=0;}
}
else if(gf(ze.src)=='multiple.gif'){if(oj(ab,'Multiple '+qf+' addresses found. Click "OK" to select one or "Cancel" to continue listing the ride.','多個'+qf+'地址，按"OK"選擇一個地址或者"Cancel"繼續登記路線。','多个'+qf+'地址，按"OK"选择一个地址或者"Cancel"继续发布路程。')){ei=4;}
else
{pj(ab,we,ze,$e,nj);ei=0;}
}
}
return ei;}
function dj(ab,yi,zi,$i,_i,aj,bj,cj){if(!yi.checked&&!zi.checked&&!$i.checked&&!_i.checked&&!aj.checked&&!bj.checked&&!cj.checked){jj(ab,'Please select at least one day.','請至少選擇一天。','请至少选择一天。');return 1;}
return 0;}
function ej(ab,bi,ci,di){if(bi.value==0||ci.value==0||di.value==0){jj(ab,'Please specify your departure date.','請輸入出發日期。','请输入出发日期。');return 1;}
return 0;}
function fj(ab,name){if(name.value==''){jj(ab,'Please enter your name.','請輸入您的名字。','请输入您的名字。');return 1;}
return 0;}
function ij(ab,hj){if(hj.value==''){jj(ab,'Please enter your message.','請輸入您的意見。','请输入您的意见。');return 1;}
return 0;}
function gj(ab,pi){if(pi.value==''){jj(ab,'Please enter your email address.','請輸入您的電子郵件地址。','请输入您的电子邮件地址。');return 1;}
return 0;}
function kj(qj){var rj='0123456789';for(var i=0;i<qj.length;i++){var sj=qj.charAt(i);if(rj.indexOf(sj)==-1){return false;}
}
return true;}
function lj(qj){var tj='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';for(var i=0;i<qj.length;i++){var sj=qj.charAt(i);if(tj.indexOf(sj)==-1){return false;}
}
return true;}
function jj(ab,uj,vj,wj){if(ab==traditionalChinese){alert(vj);}
else if(ab==simplifiedChinese){alert(wj);}
else
{alert(uj);}
}
function oj(ab,uj,vj,wj){if(ab==traditionalChinese){return confirm(vj);}
else if(ab==simplifiedChinese){return confirm(wj);}
else
{return confirm(uj);}
}
function pj(ab,we,ze,$e,nj){nj.value=we.value+(ab==english?'. ':'。')+nj.value;we.value='';ze.className='hidden';ze.src=null;while($e.hasChildNodes()){$e.removeChild($e.lastChild);}
}
