function getDomain() { var strDomain = ""; var intPos; intPos = document.location.hostname.indexOf('.co.za'); strDomain = (intPos != -1) ? document.location.hostname.substring(document.location.hostname.substring(0, intPos).lastIndexOf('.'), 1000) : strDomain; intPos = document.location.hostname.indexOf('.com'); strDomain = (intPos != -1) ? document.location.hostname.substring(document.location.hostname.substring(0, intPos).lastIndexOf('.'), 1000) : strDomain; intPos = document.location.hostname.indexOf('.net'); strDomain = (intPos != -1) ? document.location.hostname.substring(document.location.hostname.substring(0, intPos).lastIndexOf('.'), 1000) : strDomain; strDomain = (strDomain.length == 0) ? strDomain = document.location.hostname : strDomain; return strDomain; } function GoldControl() { this.RedirectInProgress = false; this.BuyPage = 'http://www.mweb.co.za/errorpage/landlerrorpage.aspx'; this.ProductCode = 'GOLD'; this.GoldUrl = 'http://signmein'+ getDomain() +'/gold.aspx?redir=' + escape(window.top.location.href); this.IsContentSubscriber = GoldControl_IsContentSubscriber; this.Init = GoldControl_Init; this.ForceBuyProcess = GoldControl_ForceBuyProcess; this.Gold = null; this.Pfc = null; } function GoldControl_Init() { this.Gold = getCookie('g'); this.Pfc = getCookie('pfc'); if (this.Gold == null) { this.RedirectInProgress = true; window.top.location.href = this.GoldUrl; } } function GoldControl_IsContentSubscriber(value, forceBuy) { if (this.Gold == '0') { value = (value==null) ? this.ProductCode : value; if (this.Pfc.toUpperCase().indexOf(value.toUpperCase()) != -1) { return true; } else { if (forceBuy) { this.RedirectInProgress = true; window.top.location.href = this.BuyPage; return false; } else { return false; } } } else { return true; } } function GoldControl_ForceBuyProcess() { this.RedirectInProgress = true; window.top.location.href = this.BuyPage; } // Use this function to retrieve a cookie. function getCookieValue(name) { var cname = " " + name + "="; var dc = document.cookie; if (dc.length > 0) { begin = dc.indexOf(cname); if (begin == -1) { cname = name + "="; begin = dc.indexOf(cname); if (begin != 0) { begin = -1; } } if (begin != -1) { begin += cname.length; end = dc.indexOf(";", begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin, end)); } } return null; } if (getCookieValue("smimid") == null) { document.location="http://subscription.food24.com/AccessControl/LoginOrLogout.asp?pkg=6&ref=" + escape(document.location) } else { var gControl = new GoldControl(); gControl.BuyPage = 'http://www.food24.com' //gControl.Init(); //alert (""); if (getCookieValue("g") != null && !(gControl.IsContentSubscriber('KUDU', false))) { if (getCookieValue("food24pay") != "true" && (getCookieValue("EM24CC") == "ZA")) { document.location = "http://www.food24.com/Food24/Components/SignMeIn/TestPaymentCheck/1,,,00.html?redirURL=" + escape(document.location); } } }