function checkEMail(mailStr) { var reg = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; var result = true; if (!mailStr.match(reg)){ result = false; } return result; } function checkInteger(intStr) { var reg = /^[0-9]*$/; var result = true; if (!intStr.match(reg)){ result = false; } return result; } function resetForm(){ var frm = document.forms["contactus"]; frm.reset(); } function CheckSubmit(){ var frm = document.forms["contactus"]; var msg=""; if(frm.enquiry.value==""){ msg+="請選擇查詢類別 \n"; } if(frm.username.value==""){ msg+="請選擇姓名 \n"; } if(frm.email.value==""){ msg+="請選擇電郵地址 \n"; }else if(!verifyEmail(frm.email.value)){ msg += "電郵地址不正確.\n"; } if(frm.tel.value != ""){ if(!checkInteger(frm.tel.value)){ msg += "聯絡電話不正確.\n"; } } if (msg!=""){ alert(msg); }else{ frm.submit(); } } function emptyEmailField(obj){ if(obj.value=="請輸入您的電郵地址"){ obj.value = ""; } } function verifyEmail(email){ var status = false; var chk_email = email; var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i; if (chk_email.search(emailRegEx) == -1) { status = false; } else { status = true; } return status; } function submit_subscription(){ var email = document.getElementById("email").value; if (verifyEmail(email) == true) { url = "/travel/tch/enewsletter/check_email.jsp?email="+email; //window.open(url,'','scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no,status=no'); if (typeof XMLHttpRequest != "undefined") { //alert("chkp1"); xmlhttp = new XMLHttpRequest(); } else { //alert("chkp2"); xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("GET", url, false); xmlhttp.send(null); //alert(xmlhttp.status); if (xmlhttp.status != 200) alert("There was a problem saving your changes."); else var result = xmlhttp.responseText; alert (result); }else{ alert("電郵地址格式錯誤,請再次輸入! "); } document.getElementById("email").value = ""; } /* function regionIdChange(obj){ document.getElementById("placeName").style.display="none"; for (i = document.getElementById("placeName").length;i>=0;i--){ document.getElementById("placeName").options[i] = null; } if (typeof XMLHttpRequest != "undefined") { xmlhttp = new XMLHttpRequest(); } else { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } url = "/travel/tch/tour/getcountry.jsp?rid="+obj.options[obj.selectedIndex].value; xmlhttp.open("GET", url, false); xmlhttp.send(null); if (xmlhttp.status != 200){ alert("There was a problem saving your changes."); }else{ for (i = document.getElementById("countryId").length;i>=0;i--){ document.getElementById("countryId").options[i] = null; } if(obj.selectedIndex ==0){ document.getElementById("countryId").options[document.getElementById("countryId").length] = new Option("所有國家",""); }else{ document.getElementById("countryId").options[document.getElementById("countryId").length] = new Option("所有地區",""); } var result = xmlhttp.responseText; ary = result.split(";"); for (i = 0; i < ary.length-1; i++) { value = ary[i].split(","); document.getElementById("countryId").options[document.getElementById("countryId").length] = new Option(value[1],value[0]); } } } function countryChange(obj){ if(document.getElementById("regionId").selectedIndex > 0){ document.getElementById("placeName").style.display="block"; if (typeof XMLHttpRequest != "undefined") { xmlhttp = new XMLHttpRequest(); } else { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } url = "/travel/tch/tour/getplace.jsp?cid="+obj.options[obj.selectedIndex].value; xmlhttp.open("GET", url, false); xmlhttp.send(null); if (xmlhttp.status != 200){ alert("There was a problem saving your changes."); }else{ for (i = document.getElementById("placeName").length;i>=0;i--){ document.getElementById("placeName").options[i] = null; } document.getElementById("placeName").options[document.getElementById("placeName").length] = new Option("所有地方",""); var result = xmlhttp.responseText; ary = result.split(";"); for (i = 0; i < ary.length-1; i++) { value = ary[i].split(","); document.getElementById("placeName").options[document.getElementById("placeName").length] = new Option(value[1],value[0]); } } } } */ function searchTour(){ n = document.getElementById("regionId").options[document.getElementById("regionId").selectedIndex].value ; switch(n) { case "1": link = "/travel/tch/tour/southeast/index.jsp#result"; break; case "2": link = "/travel/tch/tour/china/index.jsp#result"; break; case "3": link = "/travel/tch/tour/japan/index.jsp#result"; break; case "4": link = "/travel/tch/tour/southeast/index.jsp#result"; break; case "5": link = "/travel/tch/tour/long_trip/index.jsp#result"; break; case "6": link = "/travel/tch/tour/health/index.jsp#result"; break; case "7": link = "/travel/tch/tour/study/index.jsp#result"; break; case "8": link = "/travel/tch/tour/guangdong/index.jsp#result"; break; default: link = "/travel/tch/tour/japan/index.jsp#result"; } var frm = document.forms["TourSearchForm"]; frm.action = link; frm.submit(); } function gup(name){ name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^&#]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return ""; else return results[1]; } function urlEecode(string) { string = string.replace(/\r\n/g,"\n"); var utftext = ""; for (var n = 0; n < string.length; n++) { var c = string.charCodeAt(n); if (c < 128) { utftext += String.fromCharCode(c); } else if((c > 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128); } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); } } return utftext; } function urlDecode(utftext) { var string = ""; var i = 0; var c = c1 = c2 = 0; while ( i < utftext.length ) { c = utftext.charCodeAt(i); if (c < 128) { string += String.fromCharCode(c); i++; } else if((c > 191) && (c < 224)) { c2 = utftext.charCodeAt(i+1); string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); i += 2; } else { c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2); string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); i += 3; } } return string; } var pee = 0; var drec = 20; var speed = 20; var direction=1; var l = pee; function showSearchBox(){ l += drec; document.getElementById('SearchBoxLayer').style.width = (35+l) + 'px'; if (l < 350) setTimeout('showSearchBox()', speed); else{ document.getElementById('SearchBoxLayer').style.width = 380 + 'px'; direction=-1; //document.getElementById('searchBoxLink').onclick = hideSearchBox; } } function hideSearchBox(){ l -= drec; document.getElementById('SearchBoxLayer').style.width = (35+l) + 'px'; if (l > 0) setTimeout('hideSearchBox()', speed); else{ document.getElementById('SearchBoxLayer').style.width = 35 + 'px'; direction=1; } } function searchBoxClickEvent(){ if (direction==1){ showSearchBox(); }else{ hideSearchBox(); } } function searchIframTour(in_region , in_country , in_place, in_keyword ,in_codePrefix,in_mapRegion){ var display_name = ""; search_url = window.location.href; if( search_url.indexOf("#") >0 ){ search_url = search_url.substring(1,search_url.indexOf("#")); } if(search_url.indexOf("/macau/") > 0){ search_url = "../tour/search_tour.jsp?regionId=" + in_region + "&countryId=" + in_country ; }else{ search_url = "../search_tour.jsp?regionId=" + in_region + "&countryId=" + in_country ; } if (in_place.length >= 1) { search_url = search_url + "&placeName=" + in_place; } if (in_keyword.length >= 1) { search_url = search_url + "&keyword=" + in_keyword; } if (in_mapRegion) { search_url = search_url + "&mapRegion=" + in_mapRegion; } if(in_codePrefix){ if (in_codePrefix.length > 0) { search_url = search_url + "&codePrefix=" + in_codePrefix; } } display_name = getSearchDisplyName(in_region,in_country,in_place); document.getElementById('SearchPlaceName').innerHTML = display_name ; iframename = 'TourResultIFrame'; if (document.getElementById) pTar = document.getElementById(iframename); else eval('pTar = ' + iframename + ';'); pTar.src = search_url; //document.TourResultIFrame.location.href=search_url; jumpToAnchor('result'); } function getSearchDisplyName(RegionID, CountryCode, PlaceName,codePrefix){ var jsonRegion, GroupLIst; result = ""; url = window.location.href; if(PlaceName && PlaceName != "null" ){ result = PlaceName; }else if(CountryCode != "null" && CountryCode!=""){ jsonRegion = allCountryJson[RegionID]; if(jsonRegion){ for(x=0;x 0){ result = "廣東省/本地遊"; } if(url.indexOf("/long_trip/") > 0){ result = "長線"; } if(url.indexOf("/southeast/") > 0){ result = " 東南亞"; } if(url.indexOf("/japan/") > 0){ result = "日本"; } if(url.indexOf("/china/") > 0){ result = "中國 "; } if(url.indexOf("/macau/") > 0){ result = "澳門出發 "; } } return result; } function jumpToAnchor(anchor) { window.location = String(window.location).replace(/#.*$/, "") + "#" + anchor; }