var jSINGmobile={readCookie:function(name){var nameEQ=name+"=";var ca=document.cookie.split(";");for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==" "){c=c.substring(1,c.length)}if(c.indexOf(nameEQ)==0){return c.substring(nameEQ.length,c.length)}}return null},writeCookie:function(name,value,expireDays){var expireDate=new Date();expireDate.setDate(expireDate.getDate()+expireDays);document.cookie=name+"="+escape(value)+((expireDays==null)?"":";expires="+expireDate.toGMTString())},getUrlAttr:function(key){key=key.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var regexS="[\\?&]"+key+"=([^&#]*)",regex=new RegExp(regexS),results=regex.exec(window.location.href);
if(results==null){return""}else{return results[1]}},getBrowserWidth:function(){if(window.innerWidth){return window.innerWidth}else{if(document.documentElement&&document.documentElement.clientWidth!=0){return document.documentElement.clientWidth}else{if(document.body){return document.body.clientWidth}else{if(screen.availWidth){return screen.availWidth}}}}return 0},getMobileURL:function(){var re=/(dev|stage|www)/,href=window.location.href;return href.replace(re,"$1.m").replace("www.","")},redirectIfNarrow:function(){var width=this.getBrowserWidth()||null;if(width&&width>0&&width<=600){window.location=this.getMobileURL()
}},determineMobileRedirect:function(){if(this.getUrlAttr("preventMobileRedirect")){this.writeCookie("preventMobileRedirect","1",365)}else{if(!this.readCookie("preventMobileRedirect")){this.redirectIfNarrow()}}},init:function(){this.determineMobileRedirect()}};jSINGmobile.init();
