function getCookie(name){ var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)"); if(arr=document.cookie.match(reg)) return unescape(arr[2]); else return null; } function setCookie(name,value){ var Days = 30; var exp = new Date(); exp.setTime(exp.getTime() + Days*24*60*60*1000); document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString()+";path=/;domain=.trackingmore.com"; } function langCookie(){ var urlParameter = window.location.pathname; var url = window.location.href; var langString = urlParameter.substring(urlParameter.indexOf("index.html")+1,urlParameter.indexOf(".")); if(langString == 'index.html'){ var urlLang = 'en'; }else{ var urlLang = langString; } if(getCookie("cookieLang")){ var cookieLang = getCookie("cookieLang"); }else{ var cookieLang = ''; } if(url == 'http://www.trackingmore.com/' || url == 'https://www.trackingmore.com/' || url == 'http://trackingmore.com/' || url == 'https://trackingmore.com/' || url == 'http://my.trackingmore.com/' || url == 'https://my.trackingmore.com/' || url == 'http://m.trackingmore.com/' || url == 'https://m.trackingmore.com/' ){ if(cookieLang != ''){ }else{ var type=navigator.appName if (type=="Netscape"){ var lang = navigator.language } else{ var lang = navigator.userLanguage } if (lang == "zh-CN" || lang == "zh-CHS"){ setCookie('cookieLang','cn'); window.location.href= url+"cn.html"; }else if(lang == "zh-HK" || lang == "zh-MO" || lang == "zh-SG" || lang == "zh-TW" || lang == "zh-CHT"){ setCookie('cookieLang','tw'); window.location.href= url+"tw.html"; }else{ setCookie('cookieLang','en'); window.location.href= url; } } if(urlLang != cookieLang){ if(urlLang == 'index'){ }else{ var cookieLang = getCookie("cookieLang"); window.location.href= url+cookieLang+".html"; } } }else{ if(urlLang != cookieLang){ if(urlLang.length == 2){ setCookie('cookieLang',urlLang); }else{ } } } }