var mobileSiteDomain = "http://m.discoverhongkong.com"; var redirectionJSP = "redirection.jsp"; var mobileSiteMappingArray = []; mobileSiteMappingArray.splice(0, 0, ["/my/jsp/desk-mobile-mapping-list.jsp", "/seasia/jsp/desk-mobile-mapping-list.jsp"]);mobileSiteMappingArray.splice(1, 0, ["/my/index.jsp", "/seasia/index.jsp"]);mobileSiteMappingArray.splice(2, 0, ["/my/dine-drink/what-to-eat/halal-and-vegetarian.jsp", "/seasia/muslim-friendly/halal-and-vegetarian.jsp"]);mobileSiteMappingArray.splice(3, 0, ["/my/see-do/culture-heritage/other-places-of-worship/mosques-in-hong-kong.jsp", "/seasia/muslim-friendly/mosques-in-hong-kong.jsp"]);mobileSiteMappingArray.splice(4, 0, ["/my/plan-your-trip/traveller-info/communications/phrase-sheet.jsp", "/seasia/muslim-friendly/phrase-sheet.jsp"]);mobileSiteMappingArray.splice(5, 0, ["/my/plan-your-trip/traveller-info/prayer-rooms.jsp", "/seasia/muslim-friendly/prayer-rooms.jsp"]); var GetGETParam = function(name){ var start=location.search.indexOf("?"+name+"="); if (start<0) start=location.search.indexOf("&"+name+"="); if (start<0) return ''; start += name.length+2; var end=location.search.indexOf("&",start)-1; if (end<0) end=location.search.length; var result=location.search.substring(start,end); var result=''; for(var i=start;i<=end;i++) { var c=location.search.charAt(i); result=result+(c=='+'?' ':c); } return unescape(result); } var getCookie = function(cname) { var name = cname + "="; var ca = document.cookie.split(';'); for(var i=0; i -1) || (requestURL.indexOf("/latest-promotion/") > -1)) { var supportedMarket = false; if (market == "eng" || market == "tc" || market == "china" || market == "jp" || market == "kr" || market == "seasia" || market == "us" || market == "au" || market == "ca" || market == "uk" || market == "in") { supportedMarket = true; } // ignore redirection by mapping-list. if (supportedMarket) { window.location = mobileSiteDomain+requestURL+requestParameter; return; } } else { for (var i = 0; i = 0) { anchor = value.substring(value.indexOf("#")); value = value.substring(0,value.indexOf("#")); requestParameter += anchor; } //alert("Debug:matched mobile urlmatch = "+mobileSiteDomain+value); // window.location.replace(mobileSiteDomain+value+requestParameter); window.location = mobileSiteDomain+value+requestParameter; return; } } else { // match url with GET parameter if (requestParameter === "") { if (key === requestURL) { // strip anchor and put it to the end of requestParameter var anchor = ""; if (value.indexOf("#") >= 0) { anchor = value.substring(value.indexOf("#")); value = value.substring(0,value.indexOf("#")); requestParameter += anchor; } //alert("Debug:matched mobile urlmatch = "+mobileSiteDomain+value); // window.location.replace(mobileSiteDomain+value+requestParameter); window.location = mobileSiteDomain+value+requestParameter; return; } } else { if (requestParameter.indexOf("page=") >= 0) // only check parameters with "page=" { if (key.indexOf("?") >= 0) // Special handling for mapping key URL with parameters { var para = requestParameter.substring(1); // remove the "?" at the beginning of parameter var paraList = para.split("&"); for (var p=0;p 1) { rp = "?"; var countRP = 0; for (var r=0;r 0) { rp += "&"; } rp += paraList[r]; countRP++; } } } requestParameter = rp; // strip anchor and put it to the end of requestParameter var anchor = ""; if (value.indexOf("#") >= 0) { anchor = value.substring(value.indexOf("#")); value = value.substring(0,value.indexOf("#")); requestParameter += anchor; } // window.location.replace(mobileSiteDomain+value+requestParameter); window.location = mobileSiteDomain+value+requestParameter; return; } } } } else { if (key === requestURL) { // strip anchor and put it to the end of requestParameter var anchor = ""; if (value.indexOf("#") >= 0) { anchor = value.substring(value.indexOf("#")); value = value.substring(0,value.indexOf("#")); requestParameter += anchor; } // window.location.replace(mobileSiteDomain+value+requestParameter); window.location = mobileSiteDomain+value+requestParameter; return; } } } } } } } else { //alert("Debug:Testing - I'm Tablet"); } } else { //alert("Debug:Testing - I'm PC"); } } } else { //alert("Debug:Testing - redirect disabled"); } }; var requestTempURL = window.location.pathname; if ((requestTempURL.indexOf("/vacation-packages/") > -1) || (requestTempURL.indexOf("/latest-promotion/") > -1)) { /*if (requestTempURL.indexOf("/vacation-packages/") > -1) {*/ } else { mobileSiteRedirect("seasia"); } /* use the following code after seasia mobile site VP and LP sections are deployed. mobileSiteRedirect("seasia"); */