You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
14 KiB
JavaScript
87 lines
14 KiB
JavaScript
|
|
function isIE(){return document.all?true:false}
|
|
function editperson(){$("#pf2").addClass("default-tab current");$("#pf1").removeClass();$("#persontab1").hide();$("#persontab2").show();}
|
|
function displaypro(){$("#pf2").removeClass();$("#pf1").addClass("default-tab current");$("#persontab1").show();$("#persontab2").hide();}
|
|
function displayselect(o){}
|
|
function onSel(o,p,pn){$(".profliephoto li").removeClass();$(o).addClass("active");$("#profilephotoid").val(p);$("#profilephotoname").val(pn);}
|
|
function saveSelProfilePhoto(){_ppn=$("#profilephotoid").val();_rtxt=$.ajax({async:false,type:"GET",url:"/community/profile/updateprofile.asp?action=upicon&ppn="+_ppn}).responseText;if(_rtxt.replace(/\s+/g,"").toLowerCase().substring(0,4)=="true"){$("#customerpic").attr("src","/community/profile/profilephoto/"+$("#profilephotoname").val());}
|
|
generalDivWinClose();}
|
|
function removeMsg(_n){_rtxt=$.ajax({async:false,type:"GET",url:"/community/include/delmessages.asp?m="+_n}).responseText;location.reload();}
|
|
function doWinLogin(_s){_r=location.href;ShowIFrame('','/community/login-win.asp?r='+_r+'&s='+_s,630,350,'bottom');}
|
|
function Keydown(evt,me,pe,se)
|
|
{var keycode=window.event?evt.keyCode:evt.which;if(keycode==13)doLogin(me,pe,se);}
|
|
function doLogin(formsign){var ec,cc,me,pe,se;if(typeof formsign=="string")
|
|
{me="loginmail"+formsign;pe="loginpass"+formsign;se="loginErrTips"+formsign;}
|
|
else
|
|
{me="loginmail";pe="loginpass";se="loginErrTips";}
|
|
ec=RegCkElement(me,"The email or password you've entered is incorrect.","/^(([\\u4E00-\\u9FA5]|[\\uFE30-\\uFEFF]|[\\d]|[a-zA-Z]|[\\_\\-\\.])+[\\@])(((([\\d]|[a-zA-Z]|[\\_\\-]|[\\[\\]\{\\}\>\\<])+[\\.])+)([\\d]|[a-zA-Z\\_\\-])+)$/","Email",se,false);if(!ec)return false;cc=StrIsNullOrEmpty(pe,"The email or password you've entered is incorrect.","",se,false);if(!cc)return false;webLoginAuth($("#"+me).val(),$("#"+pe).val(),$("input[name='s']").val(),se,$("#rememberme").attr("checked"));}
|
|
function doLoginHref(){if(!doLogin())return;}
|
|
function doWinLoginHref(){var ole,olp;ole=document.loginForm.loginmail.value;olp=document.loginForm.loginpass.value;if(ole==""||olp==""||ole.length<6){showLoginErrMsg("The email or password you've entered is incorrect.","loginErrTips");return false;}
|
|
if(!webWinLoginAuth(ole,olp)){showLoginErrMsg("The email or password you've entered is incorrect.","loginErrTips");return false;}
|
|
return true;}
|
|
function getPass(){}
|
|
function webLoginAuth(le,lp,ls,se,rm){$.post("/community/logincheck.asp",{loginmail:le,loginpass:lp,rememberme:rm},function(_sf){if(_sf=="true"){if(typeof ls=="string"){location.href=ls;}else{location.href="/community/customer-center/";}}else{showLoginErrMsg("The email or password you've entered is incorrect.",se);}});}
|
|
function basecommMain(_s){parent.$("#personinfoComment").hide();parent.$("#commentLogin").hide();}
|
|
function qaRightBaseMain(le,lp){parent.$("#personid").hide();parent.$("#qaLogin").hide();parent.$("#qabody").focus();}
|
|
function qawinreplyMain(_n){nArray=_n.split("-");nid=nArray[1];parent.$("#replydivimg"+nid).hide();parent.$("#div"+nid).slideDown(300);}
|
|
function webWinLoginAuth(le,lp){$.post("/community/logincheck.asp",{loginmail:le,loginpass:lp},function(_sf){if(_sf=="true"){sourcediv1=sourcediv;if(sourcediv.indexOf("-")){sourcediv1=sourcediv.split("-")[0];}
|
|
switch(sourcediv1){case"qarightbase":qaRightBaseMain(le,lp);break;case"qawinreply":qawinreplyMain(sourcediv);break;case"basecomm":basecommMain(sourcediv);break;default:}
|
|
parent.Check_Login();for(i=0;i<parent.$(".boxy_bottom").size();i++)parent.Boxy.get(parent.$(".boxy_bottom").eq(i)).hide();return true;}else{return false;}});return false;}
|
|
function showLoginErrMsg(_s,_d){$("#"+_d).html(_s);$("#"+_d).show();}
|
|
function doWinLoginCheck(){var ole,olp;ole=document.winLoginForm.loginmail.value;olp=document.winLoginForm.loginpass.value;if(ole==""||olp==""||ole.length<6){showLoginErrMsg("The email or password you've entered is incorrect.");return false;}
|
|
if(!webLoginAuth(ole,olp)){showLoginErrMsg("The email or password you've entered is incorrect.");return false;}}
|
|
function doCreateAccountHref(){if(!doCreateAccount())return;}
|
|
function doCreateAccount(){var ole,olp;ole=document.createAccountForm.cloginmail.value;olp1=document.createAccountForm.cloginpass1.value;olp2=document.createAccountForm.cloginpass2.value;oln=document.createAccountForm.nickname.value;vcode=document.createAccountForm.verifycode.value;if(document.createAccountForm.termsFlag.checked!=true){showLoginErrMsg("I have read and accept the Terms and conditions?","createAccountErrTips");return false;}
|
|
if(vcode.length<4){showLoginErrMsg("Please enter Verify Code?","createAccountErrTips");return false;}
|
|
ec=RegCkElement("cloginmail","The email you've entered is incorrect.","/^(([\\u4E00-\\u9FA5]|[\\uFE30-\\uFEFF]|[\\d]|[a-zA-Z]|[\\_\\-\\.])+[\\@])(((([\\d]|[a-zA-Z]|[\\_\\-]|[\\[\\]\{\\}\>\\<])+[\\.])+)([\\d]|[a-zA-Z\\_\\-])+)$/","","createAccountErrTips",false);if(!ec)return false;if(olp1!=olp2){showLoginErrMsg("Your password confirmation does not match.","createAccountErrTips");return false;}
|
|
if(olp1.length<6){showLoginErrMsg("Your Password must be more than 6 characters.","createAccountErrTips");return false;}
|
|
rtxt=$.ajax({async:false,type:"POST",url:"/community/save-create-account.asp",data:"cemail="+ole+"&cpass="+olp1+"&cname="+oln+"&vc="+vcode}).responseText;if(rtxt.replace(/\s+/g,"").toLowerCase()=="true"){loginFlag=true;location.href="/community/customer-center/";}
|
|
else if(rtxt.replace(/\s+/g,"").toLowerCase()=="000"){showLoginErrMsg("Please enter the correct Verify Code","createAccountErrTips");return false}
|
|
else{showLoginErrMsg("The email you've entered is not available.","createAccountErrTips");return false;}}
|
|
function webCreateAccount(_u,_p,_n){return false;}
|
|
function isLogin(){var loginFlag;loginFlag=false;rtxt=$.ajax({async:false,type:"GET",url:"/community/islogin.asp?"+Math.random()}).responseText;if(rtxt.replace(/\s+/g,"").toLowerCase()=="true"){loginFlag=true;}
|
|
return loginFlag;}
|
|
function qaReply(n){if(!isLogin()){doWinLogin("qawinreply-"+n);return;}
|
|
$("#replydivimg"+n).hide();$("#div"+n).slideDown(300);$("#reply"+n).focus();}
|
|
function qaSave(_o,n){$("#replydivimg"+n).show();writeQAtoA(_o,n);}
|
|
function qaCancel(n){$("#replydivimg"+n).show();$("#div"+n).slideUp(300);}
|
|
function writeQAtoQ(_o,_n,_e,_mf,_wf,_b){_title=document.title;_h1=isIE()?document.getElementsByTagName("H1")[0].innerText:document.getElementsByTagName("H1")[0].textContent;_url=location.href.replace("http://","");_url=_url.substring(_url.indexOf("/"),_url.length);if(!isLogin()){if(_n==""){alert("please input your name???");return false;}
|
|
if(_e==""){alert("please input your email");return false;}}
|
|
_wf=_wf?0:1;_mf=_mf?1:0;var o={name:_n,email:_e,mailflag:_mf,webflag:_wf,surl:_url,stitle:_title,body:_b};oldsrc=_o.src;_o.disabled="disabled";_o.src="/pic/loading.gif";$.post("/community/include/saveQA.inc.asp?action=q",{qaname:o.name,qaemail:o.email,qamailflag:o.mailflag,qawebflag:o.webflag,qasourceurl:o.surl,qasourcetitle:o.stitle,qabody:o.body,h1:_h1},function(_sf){if(parseInt(_sf)>0){if(parseInt(_wf)!=1){location.href="/forms/thankyou-questions.asp";}else{location.href="/faq/question/"+parseInt(_sf)+"/";}}else{alert("The question must be more than 20 characters long");_o.src=oldsrc;_o.disabled="";}});}
|
|
function saveQAtoQonDiv(_n,_e,_mf,_wf,_b){writeQAtoQ(_n,_e,_mf,_wf,_b);generalDivWinClose();}
|
|
function writeQAtoA(_o,o){oldsrc=_o.src;_o.disabled="disabled";_o.src="/pic/loading.gif";a_body=document.getElementById("reply"+o).value;$.post("/community/include/saveQA.inc.asp?action=a",{qaqid:o,qaabody:a_body},function(_sf){if(parseInt(_sf)>0){location.href="/faq/question/"+o+"/";}else{alert("The answer must be more than 20 characters long");_o.src=oldsrc;_o.disabled="";}});}
|
|
function faqindexTab(_n){$(".qaNav ul li").eq(1).removeClass();$(".qaNav ul li").eq(2).removeClass();$("#lastquestion").hide();$("#Unanswered").hide();if(_n==1){$(".qaNav ul li").eq(1).addClass("active");$("#lastquestion").show();}else{$(".qaNav ul li").eq(2).addClass("active");$("#Unanswered").show();}}
|
|
function updateNewsLetter(){var tmpt;tmpt="";for(i=0;i<document.ul[1].newslettertype.length;i++){if(document.ul[1].newslettertype[i].checked){tmpt=tmpt+document.ul[1].newslettertype[i].value+",";}}
|
|
rtxt=$.ajax({async:false,type:"GET",url:"/community/customer-center/save-newsletter.asp?ntid="+tmpt}).responseText;top.location.reload();generalDivWinClose();}
|
|
function saveComments(_c){_url=location.href.replace("http://","");_url=_url.substring(_url.indexOf("/"),_url.length);_cmmid=document.writeComments.cmmid.value;_cname=document.writeComments.fullname.value;_cemail=document.writeComments.email.value;_cmsg=document.writeComments.commentMsg.value;_intype = document.writeComments.infoType.value;if(!isLogin()){if(_cname.length<2||_cemail.length<6){alert("Please input your name & email");return false;}}
|
|
dt=new Date();$.post("/community/include/save-comments.asp",{surl:_url,cname:_cname,cemail:_cemail,cmsg:_cmsg,cmmid:_cmmid,infoType:_intype},function(_sf){if(_sf.replace(/\s+/g,"").toLowerCase()=="true"){commform = $(".addComment.roundCorner").clone(true);$(".addComment.roundCorner").remove();tmpHtmlStr="<div class=\"publishInfo\"><div class=\"publisher\">"+_cname+"<br />on "+['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'][dt.getMonth()]+"."+dt.getDate()+","+dt.getFullYear()+" said </div>";tmpHtmlStr=tmpHtmlStr+"<div class=\"clear\"></div></div><div class=\"customerReview roundCorner\"><div class=\"say\"></div>";tmpHtmlStr=tmpHtmlStr+_cmsg+"<div class=\"clear\"></div>";tmpHtmlStr=tmpHtmlStr+"<div class=\"clear\"></div></div>"
|
|
$(".commentList.roundCorner").append(tmpHtmlStr);commform.appendTo(".commentList.roundCorner");$("#commentMsg").val("");$("#CommCount").text(parseInt($("#CommCount").text())+1);}else{alert("System error!");}});}
|
|
function generalDivWinClose(){$(document).trigger('close.facebox');}
|
|
function stroyBack(){generalDivWinClose();location.href="index.asp";}
|
|
function smtu(n){if(!isLogin()){alert("Please first login");return false;}
|
|
_divid="sendmessages";_msg=document.getElementById(_divid+"_msg").value;if(_msg.length<10){alert("please input Messages,the message must be more than 10 characters long.");return false;}
|
|
if(_msg.length>500){alert("The message must be less than 500 characters long.");return false;}
|
|
rt=$.ajax({async:false,type:"GET",url:"/community/include/sendmessages.asp?u="+n+"&m="+_msg}).responseText;generalDivWinClose();}
|
|
function hideNewsLetter(){generalDivWinClose();}
|
|
function deleteTravelStory(n){generalDivWinClose();$.post("/community/travel-story/del-story.asp?sid="+n,function(_sf){});$("#trid"+n).fadeOut(300);}
|
|
function deleteTravelNotes(n){generalDivWinClose();$.post("/community/travel-story/save-story.asp?action=delcity&nid="+n,function(_sf){});$("#trid"+n).fadeOut(300);}
|
|
function saveStoryNewCity(_ac){_divid="newItinerary";_cityname=document.getElementById(_divid+"_newcityname").value;if(_cityname.length<2){alert("please input city name");return;}
|
|
_tourdate=document.getElementById(_divid+"_newtourdate").value;if(_tourdate.length<2){alert("please input tour date");return;}
|
|
_days=document.getElementById(_divid+"_tourdays").value;_sid=document.getElementById("sid").value;$.post("/community/travel-story/save-story.asp?action="+_ac,{cityname:_cityname,tourdate:_tourdate,sid:_sid,days:_days},function(_sf){if(parseInt(_sf)>0){generalDivWinClose();location.reload();}else{alert("The content cannot be null");}});}
|
|
function storycheck(){st=document.getElementById("storytitle").value;sb=document.getElementById("storybody").value;sb=CKEDITOR.instances.storybody.getData();if(st==""||st.length>60){document.getElementById("stitleErrTips").style.display='';$("#stitleErrTips").css("opacity","100");$("#stitleErrTips").focus();return false;}
|
|
if(sb==""||sb.length<100){$("#storyBodyErrTips").show();$("#storyBodyErrTips").css("opacity","100");$("#storyBodyErrTips").focus();return false;}
|
|
if(document.addStory.tourdate.length==undefined){if(document.addStory.city.value==""){alert("please input cityname?");return false;}
|
|
if(document.addStory.tourdate.value==""){alert("please input arrival date?");return false;}}else{for(n=0;n<document.addStory.tourdate.length;n++)
|
|
{if(document.addStory.city[n].value==""){alert("please input cityname?");return false;}
|
|
if(document.addStory.tourdate[n].value==""){alert("please input arrival date?");return false;}}}
|
|
return true;}
|
|
function updateStoryCity(_n){_divid="writeJournal"+_n;_cityname=document.getElementById(_divid+"_cityname").value;_tourdate=document.getElementById(_divid+"_tourdate").value;_tourdays=document.getElementById(_divid+"_tourdays").value;$.post("/community/travel-story/save-story.asp?action=updatecity&nid="+_n,{cityname:_cityname,tourdate:_tourdate,tourdays:_tourdays},function(_sf){generalDivWinClose();location.reload();});}
|
|
function addPlace(){tabObj=document.getElementById("placeTable");nnn=tabObj.rows.length;ggg=tabObj.insertRow(tabObj.rows.length);ggg.id="tr"+nnn.toString();ggg.insertCell(0).innerHTML="City "+(tabObj.rows.length-1);ggg.insertCell(1).innerHTML=tabObj.rows[1].cells[1].innerHTML;newTmpHtml=tabObj.rows[1].cells[2].innerHTML.replace(new RegExp("tourdate1","gm"),"tourdate"+(tabObj.rows.length-1));newTmpHtml=newTmpHtml.replace(new RegExp("dateImage1","gm"),"dateImage1"+(tabObj.rows.length-1));ggg.insertCell(2).innerHTML=newTmpHtml;ggg.insertCell(3).innerHTML=tabObj.rows[1].cells[3].innerHTML;ggg.insertCell(4).innerHTML="<a href='javascript:delPlace("+nnn+")'>Delete This Place</a>";if(tabObj.rows.length%2==0)isIE()?ggg.setAttribute("className","alt-row"):ggg.setAttribute("class","alt-row");}
|
|
function delPlace(o){rn=document.getElementById("tr"+o).rowIndex;tabObj=document.getElementById("placeTable");tabObj.deleteRow(rn);for(u=1;u<tabObj.rows.length;u++){tabObj.rows[u].cells[0].innerHTML="City "+u.toString();if(u%2==0){isIE()?tabObj.rows[u].setAttribute("className",""):tabObj.rows[u].setAttribute("class","");}
|
|
else{isIE()?tabObj.rows[u].setAttribute("className","alt-row"):tabObj.rows[u].setAttribute("class","alt-row");}}}
|
|
function qatab(_s){$(".viewOrderLab li").removeClass();if(_s=="q"){$(".viewOrderLab li").eq(0).addClass("current");$("#questionList").show();$("#answerList").hide();}else{$(".viewOrderLab li").eq(1).addClass("current");$("#questionList").hide();$("#answerList").show();}}
|
|
function favgo(s){s="//www.chinahighlights.com"+s;if(isIE()){window.external.addFavorite(s,'Chinahighlights Question & Answer');}else{window.sidebar.addPanel('Chinahighlights Question & Answer',s,'');}}
|
|
function dofav(n){$("#fav"+n).show();}
|
|
function outfav(n){$("#fav"+n).hide();}
|
|
function displayReply(n){$("#replytxtid"+n).css("display")=="none"?$("#replytxtid"+n).slideDown(300):$("#replytxtid"+n).hide();}
|