var CMGlobal = function(siteType, brandType, category, clientId, domain) { var self = this; self.GetCookie = function(name) { if (document.cookie.length > 0) { var cookieStart = document.cookie.indexOf(name + "="); if (cookieStart != -1) { cookieStart = cookieStart + name.length + 1; var cookieEnd = document.cookie.indexOf(";", cookieStart); if (cookieEnd == -1) cookieEnd = document.cookie.length; return unescape(document.cookie.substring(cookieStart, cookieEnd)); } } return null; }; /** * Contains Country of origin results COOResults. * Utility method for getting a request parameter from a URL. * @param URL to be parsed * @member GetURLParam * @returns value of request parameter * @link http://www.netlobo.com/url_query_string_javascript.html */ self.GetURLParam = function(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regexS = "[\?&]" + name + "=([^&#]*)"; var regex = new RegExp(regexS); var results = regex.exec(window.location.href.toLowerCase()); if (results === null) { return ""; } else { return results[1]; } }; self.RenameCategory = function(pageCategoryId) //Needs to be deprecated { return pageCategoryId; }; self.SetClientId = function(clientId) { }; self.category = category; self.siteType = siteType; // BRAND or SHOP self.brandType = brandType; // Originals, Styles self.clientId = clientId; self.domain = domain; }; var globalHelper = new CMGlobal(); var adidasGlobal = new CMGlobal("","","CA","90297136;90320940;90297331;90297344;90297201","shop.adidas.ca"); if (typeof console != "undefined") { console.log("Current client id: " + adidasGlobal.clientId); }