var iolMobileURL="http://m.iol.co.za";var brMobileURL="http://m.br.co.za";var sportMobileURL="http://m.iolsport.co.za";var motoringMobileURL="http://m.motoring.co.za";var tonightMobileURL="http://m.tonight.co.za";var lifestyleMobileURL="http://m.iollifestyle.co.za";var scitechMobileURL="http://m.iolscitech.co.za";var capetimesMobileURL="http://m.capetimes.co.za";var deviceIphone="iphone";var deviceIpod="ipod";var deviceS60="series60";var deviceSymbian="symbian";var engineWebKit="webkit";var deviceAndroid="android";var deviceWinMob="windows ce";var deviceBB="blackberry";var devicePalm="palm";var uagent=navigator.userAgent.toLowerCase();function directToMobileSite(){if(checkCookieValue()){if(detectMobile()){var site=checkSite();if(site=='business')document.location=brMobileURL+checkArticle();else if(site=='sport')document.location=sportMobileURL+checkArticle();else if(site=='motoring')document.location=motoringMobileURL+checkArticle();else if(site=='tonight')document.location=tonightMobileURL+checkArticle();else if(site=='lifestyle')document.location=lifestyleMobileURL+checkArticle();else if(site=='scitech')document.location=scitechMobileURL+checkArticle();else if(site=='capetimes')document.location=capetimesMobileURL+checkArticle();else document.location=iolMobileURL+checkArticle()}}}function checkCookieValue(){var i,x,y,ARRcookies=document.cookie.split(";");for(i=0;i<ARRcookies.length;i++){x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);x=x.replace(/^\s+|\s+$/g,"");if(x=="fullsite"&&unescape(y)=="true"){return false}}if(wantsFullSite()){document.cookie="fullsite=true";return false}return true}function detectMobile(){if(uagent.search(deviceIphone)>-1)return true;else if(uagent.search(deviceIpod)>-1)return true;else if(uagent.search(engineWebKit)>-1)if((uagent.search(deviceS60)>-1||uagent.search(deviceSymbian)>-1))return true;else if(uagent.search(deviceAndroid)>-1)return true;else if(uagent.search(deviceWinMob)>-1)return true;else if(uagent.search(deviceBB)>-1)return true;else if(uagent.search(devicePalm)>-1)return true;else return false}function wantsFullSite(){var urlHalves=String(document.location).split('?');if(urlHalves[1]){var urlVars=urlHalves[1].split('&');for(var i=0;i<=(urlVars.length);i++){if(urlVars[i]){var urlVarPair=urlVars[i].split('=');if(urlVarPair[0]=="site"&&urlVarPair[1]=="full")return true}}}return false}function checkSite(){var urlHalves=String(document.location).split('/');return urlHalves[3]}function checkArticle(){var urlHalves=String(document.location).split('?');var tempURL=String(urlHalves[0]).split('-');if(tempURL[(tempURL.length-1)]){return'/article/view/e/'+tempURL[(tempURL.length-1)]}return''}
