var _crmq = _crmq || []; function readCookie(cookieName) { var theCookie = "" + document.cookie; var ind= theCookie.indexOf(cookieName); if(ind == -1 || cookieName == "") return null; var ind1 = theCookie.indexOf(';', ind); if(ind1 == -1) ind1 = theCookie.length; return unescape(theCookie.substring(ind + cookieName.length + 1, ind1)); } var PdCrm = { track: function(data) { var _crmx = readCookie('_crmx'); if(_crmx == null || typeof(_crmx) == "undefined") { data && _crmq.push(data); var a = []; var d = []; for(var i=0; i<_crmq.length; i++) { var r = _crmq[i]; _crmq.splice(i, 1); if(r.length > 0) { a.push(r[0]); var _d = []; for(j=1; j<6; j++) { _d.push(typeof(r[j]) != "undefined" ? r[j] : ""); } d.push(_d.join("#")); } } if(a.length) { var img = document.createElement("img"); var devType = 'DESKTOP'; if(windowManager.isTablet()) { devType = 'TABLET'; } else if(windowManager.isMobile()) { devType = 'MOBILE'; } img.src= windowManager.getBaseUrl() + "/webcrm/img?a=" + encodeURIComponent(a) + "&d=" + encodeURIComponent(d) + "&r=" + Math.random() + "&dt=" + encodeURIComponent(devType); img.width="1"; img.height="1"; img.style.display="none"; var root = document.getElementById("crm-root"); var imgs = root.getElementsByTagName("img"); for(var i=0; i