var PROBANCE_browser_detect=null,probance_ajax=null,PROBANCE_encoder=null,PROBANCE_utils=null,PROBANCE_urlUtils=null,PROBANCE_idManager=null;if(!String.prototype.trim){String.prototype.trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"")}}if(!String.prototype.endsWith){String.prototype.endsWith=function(a){return this.indexOf(a,this.length-a.length)!==-1}}if(typeof JSON!=="object"){JSON={};function quote(a){escapable.lastIndex=0;return escapable.test(a)?'"'+a.replace(escapable,function(c){var b=meta[c];return typeof b==="string"?b:"\\u"+("0000"+c.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function str(g,k){var d,b,f,l,c=gap,j,h=k[g];if(h&&typeof h==="object"&&typeof h.toJSON==="function"){h=h.toJSON(g)}if(typeof rep==="function"){h=rep.call(k,g,h)}switch(typeof h){case"string":return quote(h);case"number":return isFinite(h)?String(h):"null";case"boolean":case"null":return String(h);case"object":if(!h){return"null"}gap+=indent;j=[];if(Object.prototype.toString.apply(h)==="[object Array]"){l=h.length; for(d=0;d0){if(a.indexOf("?")==-1){a+="?"+e}else{a+="&"+e}e="" }if("XDomainRequest" in window&&window.XDomainRequest!==null){c=new XDomainRequest();c.onprogress=function(){};if(f){c.onload=f}if(i){c.onerror=i}c.open((d?"GET":"POST"),a);c.send(e);return}if(window.XMLHttpRequest){c=new XMLHttpRequest()}else{if(window.ActiveXObject){c=new ActiveXObject("Microsoft.XMLHTTP")}}if(c===null){return}c.onload=f;c.onerror=i;if(g){var h=b;c.onreadystatechange=function(){probance_logger.writeDebug(h+" readyState="+this.readyState)}}c.open((d?"GET":"POST"),a,g);if(!d){c.setRequestHeader("Content-type","application/json")}c.send(e)},callScript:function(e,c,a,f){var b=document.createElement("script"),d=null;if(c){b.async=true;b.defer=true}if(b.addEventListener){if(a!==null&&a!==undefined){b.addEventListener("load",function(){a()},false)}if(f!==null&&f!==undefined){b.addEventListener("error",function(){f()},false)}}else{if((a!==null&&a!==undefined)||(f!==null&&f!==undefined)){b.onreadystatechange=function(){var g=b.readyState;if(g==="loaded"){if(g.status==200){if(a!==null&&a!==undefined){a() }}else{if(f!==null&&f!==undefined){f()}}}}}}b.src=e;d=document.getElementsByTagName("script")[0];d.parentNode.insertBefore(b,d)},callImage:function(f,h,a,g){var d=document.createElement("img"),b=null;try{d.style.visibility="hidden"}catch(c){}try{d.style.display="none"}catch(c){}if(d.addEventListener){if(a!==null&&a!==undefined){d.addEventListener("load",function(){a()},false)}if(g!==null&&g!==undefined){d.addEventListener("error",function(){g()},false)}}else{if((a!==null&&a!==undefined)||(g!==null&&g!==undefined)){d.onreadystatechange=function(){var e=d.readyState;if(e==="loaded"){if(e.status==200){if(a!==null&&a!==undefined){a()}}else{if(g!==null&&g!==undefined){g()}}}}}}if(h!==null&&h!==undefined){d.id=h}d.src=f;b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(d,b)}};function probanceCookies(b,a,c){this.name=b;this.delay=a;this.encode=true;if(c!==null&&c!==undefined){if(!c){this.encode=false}else{this.encode=true}}}probanceCookies.prototype.readFromCookie=function(){var b="",a=0,d=0,c=""; b=document.cookie+"";a=b.indexOf(this.name+"=");if(a>=0){a+=this.name.length+1;d=b.indexOf(";",a);if(d<0){d=b.length}if(a===d){return null}c=b.substring(a,d);if(this.encode){c=PROBANCE_encoder.decode(c)}return decodeURIComponent(c)}return null};probanceCookies.prototype.cookieExists=function(){var b="",a=0;b=document.cookie+"";a=b.indexOf(this.name+"=");if(a>=0){return true}return false};probanceCookies.prototype.saveCookie=function(d){var a="",c=null,b="";if(this.delay){c=new Date();c.setTime(c.getTime()+(this.delay*24*60*60*1000));a="; expires="+c.toGMTString()}if(d===null||d===undefined){b=""}b=encodeURIComponent(d);if(this.encode){b=PROBANCE_encoder.encode(b)}document.cookie=this.name+"="+b+a+"; path=/"};probanceCookies.prototype.deleteCookie=function(){document.cookie=this.name+"=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/"};PROBANCE_browser_detect={alreadyDone:false,init:function(){if(this.alreadyDone){return}this.browser=this.searchString(this.dataBrowser)||"UNKNOWN";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"UNKNOWN"; this.OS=this.searchString(this.dataOS)||"UNKNOWN";this.isMobile=this.isMobile(navigator.userAgent);this.alreadyDone=true},isMobile:function(a){if(a==null){return false}return/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(a)},searchString:function(d){if(d==null){return}var a=0,b=null,c=null;for(a=0;a>2;g=((k&3)<<4)|(h>>4);e=((h&15)<<2)|(f>>6);d=f&63;if(isNaN(h)){e=d=64}else{if(isNaN(f)){d=64}}a=a+PROBANCE_encoder._keyStr.charAt(j)+PROBANCE_encoder._keyStr.charAt(g)+PROBANCE_encoder._keyStr.charAt(e)+PROBANCE_encoder._keyStr.charAt(d)}return a},decode:function(c){if(c==null||c===undefined||c==""){return""}var a="",k,h,f,j,g,e,d,b=0;c=c.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(b>4);h=((g&15)<<4)|(e>>2);f=((e&3)<<6)|d;a=a+String.fromCharCode(k); if(e!=64){a=a+String.fromCharCode(h)}if(d!=64){a=a+String.fromCharCode(f)}}a=PROBANCE_encoder._utf8_decode(a);return a},_utf8_encode:function(b){if(b===null||b===undefined||b===""){return""}var a="",e=null,d=0;b=b.replace(/\r\n/g,"\n");for(d=0;d127)&&(e<2048)){a+=String.fromCharCode((e>>6)|192);a+=String.fromCharCode((e&63)|128)}else{a+=String.fromCharCode((e>>12)|224);a+=String.fromCharCode(((e>>6)&63)|128);a+=String.fromCharCode((e&63)|128)}}}return a},_utf8_decode:function(a){if(a===null||a===undefined||a===""){return""}var b="",d=0,e=c2=0;while(d191)&&(e<224)){c2=a.charCodeAt(d+1);b+=String.fromCharCode(((e&31)<<6)|(c2&63));d+=2}else{c2=a.charCodeAt(d+1);c3=a.charCodeAt(d+2);b+=String.fromCharCode(((e&15)<<12)|((c2&63)<<6)|(c3&63));d+=3}}}return b}};PROBANCE_utils={getRandomString:function(){return String((new Date()).getTime()).replace(/\D/gi,"") },generateId:function(b){if(b<1){b=1}var a=0,c="";for(a=0;a0){b=c.split("#")[1]}f=(c.split("?")[1].split("#")[0]).split("&");e=0;for(d=0;d0){a+="#"+b}return a},normalize:function(a){if(a===null||a===undefined){return null }a=a.trim();if(!a.endsWith("/")){a+="/"}return a},getProtocol:function(a){if(a===null||a===undefined){return"http"}var b=a.split(":")[0];if(b===null||b===""){b="http"}return b}};PROBANCE_idManager={getVisitorId:function(a){return a},getCustomerId:function(a){if(a===null||a===undefined){return null}if(a.indexOf("_")==-1){return a}return a.split("_").pop()}};probance_logger={enabled:null,getHourTime:function(c){if(c==null){return""}var f="";var e=c.getHours();var a=c.getMinutes();var d=c.getSeconds();var b=c.getMilliseconds();if(e<10){f+="0"}f+=e+":";if(a<10){f+="0"}f+=a+":";if(d<10){f+="0"}f+=d+".";if(b<=0){f+="000"}else{if(b<10){f+="00"}else{if(b<100){f+="0"}}}f+=b;return f},writeDebug:function(e,a,c){if(!this.enabled||typeof console==="undefined"){return}var d="\t";var b=new Date();var f="";if(a!=null){if(a){d+=" --> start "}else{d+=" <-- end ";if(c!=null){f=" in "+(b.getTime()-c)+" ms"}}}if(console.debug){console.debug(this.getHourTime(b)+d+e+f)}else{if(console.info){console.info(this.getHourTime(b)+d+e+f) }else{console.log(this.getHourTime(b)+d+e+f)}}},writeLog:function(e,a,c){if(!this.enabled||typeof console==="undefined"){return}var d="\t";var b=new Date();var f="";if(a!=null){if(a){d+=" --> start "}else{d+=" <-- end ";if(c!=null){f=" in "+(b.getTime()-c)+" ms"}}}console.log(this.getHourTime(b)+d+e+f)},writeWarning:function(e,a,c){if(!this.enabled||typeof console==="undefined"){return}var d="\t";var b=new Date();var f="";if(a!=null){if(a){d+=" --> start "}else{d+=" <-- end ";if(c!=null){f=" in "+(b.getTime()-c)+" ms"}}}console.warn(this.getHourTime(b)+d+e+f)},writeError:function(e,a,c){if(!this.enabled||typeof console==="undefined"){return}var d="\t";var b=new Date();var f="";if(a!=null){if(a){d+=" --> start "}else{d+=" <-- end ";if(c!=null){f=" in "+(b.getTime()-c)+" ms"}}}console.error(this.getHourTime(b)+d+e+f)}};function PROBANCE_abstractTracker(c,d,b,a){this.siteid=c;this.cookie=new probanceCookies((d?d:"probance"),b);PROBANCE_browser_detect.init();if(a===undefined||a===null){this.webtraxUrl=null }else{a=PROBANCE_urlUtils.normalize(a);this.webtraxUrl=PROBANCE_urlUtils.getProtocol(document.location+"")+"://"+a+"listener.action"}this.request="";this.customs=[];this.trackingId=null;this.customerIdentifier=null;this.tagger=null;this.initialized=false;this.trackerType=null;if(this.siteid===undefined){this.siteid=null}this.getTagsAsync=false;this.autoTrackOnInit=true;this.onIdentify=null;this.onTagsLoaded=null;this.probanceDelayedTrack=[]}PROBANCE_abstractTracker.prototype.init=function(b,d){if(this.initialized){return}if(this.siteid===null){this.initialized=true;return}if(this.customerIdentifier===null){this.customerIdentifier=this.getCustomerIdentifier();if(this.customerIdentifier===null){this.initialized=true;return}}var c=this.getUrl();this.customerIdentifier.init(b,this,c);if("getUrl" in this.customerIdentifier){c=this.customerIdentifier.getUrl(c)}if(this.autoTrackOnInit){this.probanceDelayedTrack.push(new probanceDelayedTrackItem(c,false,null))}var a=this;setTimeout(function(){a.executeDelayedTrack() },4);if(this.tagger!=null&&!this.customerIdentifier.isNew()&&this.trackingId!=null){this.tagger.taggerType=this.trackerType;this.tagger.useAsyncCall=this.getTagsAsync;this.tagger.init(this.trackingId,this.trackingTypeId,function(){if(d){setTimeout(function(){d()},100)}setTimeout(function(){a.executeDelayedTrack()},4)})}else{if(d){setTimeout(function(){d()},100)}setTimeout(function(){a.executeDelayedTrack()},4)}};PROBANCE_abstractTracker.prototype.afterIdentify=function(){if(this.onIdentify!=null&&this.trackingId!=null){this.onIdentify(this.trackingId,this.trackingTypeId,this.tracking_mode)}if(this.customerIdentifier!=null&&!this.customerIdentifier.isNew()){if(this.tagger!=null){if(!this.tagger.loaded){this.tagger.useAsyncCall=this.getTagsAsync;this.tagger.init(this.trackingId,this.trackingTypeId,this.onTagsLoaded)}}}};PROBANCE_abstractTracker.prototype.initTagger=function(c,b,a){this.tagger=new PROBANCE_taggerValue(this.trackerType,this.siteid,c,b,a);this.tagger.useAsyncCall=this.getTagsAsync };PROBANCE_abstractTracker.prototype.getTag=function(b,a){if(b===null){return null}if(this.tagger===null){return null}return this.tagger.getTag(b,a)};PROBANCE_abstractTracker.prototype.getTags=function(){if(this.tagger===null){return null}return this.tagger.getTags()};PROBANCE_abstractTracker.prototype.printTags=function(d){if(this.tagger===null||this.tagger.getTags()===null){return""}var a=this.tagger.getTags(),c="",e=true;for(var b=0;b0){a=this.probanceDelayedTrack.pop(); if(a==null){continue}if(a.isEvent){this.trackEvent(a.url,a.custAttr)}else{this.track(a.url,a.custAttr)}}};PROBANCE_abstractTracker.prototype._getTrackRequest=function(a,l,j){if(this.siteid===null||this.webtraxUrl==null){return null}if(!this.initialized){this.probanceDelayedTrack.push(new probanceDelayedTrackItem(a,l,j));return null}var f=null,c="",d="",b=[],k=[],h=null,g=null,e=0;if(this.customerIdentifier===null){this.customerIdentifier=this.getCustomerIdentifier();if(this.customerIdentifier===null){return null}}f=this.customerIdentifier.getTrackingMode();if(this.trackingId===null||this.trackingId===undefined){return null}if(a===null||a===undefined){a=this.getUrl();if("getUrl" in this.customerIdentifier){a=this.customerIdentifier.getUrl(a)}}c="";if(j!==null&&j!==undefined&&j.length>0){for(e=0;e0){for(e=0;e0){c=b.join("&")}var d=this.webtraxUrl+"?";if(this.trackingTypeId!=null&&this.trackingTypeId!=undefined&&this.trackingTypeId.trim().length>0){d+="typeId="+encodeURIComponent(this.trackingTypeId)+"&"}d+="id="+encodeURIComponent(this.trackingId)+"&"+"purl="+encodeURIComponent(PROBANCE_encoder.encode(a))+"&"+"site="+encodeURIComponent(this.siteid)+"&"+"os="+encodeURIComponent(PROBANCE_browser_detect.OS)+"&"+"br="+encodeURIComponent(PROBANCE_browser_detect.browser)+"&"+"ver="+encodeURIComponent(PROBANCE_browser_detect.version)+"&"+"mod="+encodeURIComponent(f)+"&"+"customParams="+encodeURIComponent(c)+"&"+"referrer="+encodeURIComponent(PROBANCE_encoder.encode(this.getReferrer()))+"&"+"version="+encodeURIComponent(PROBANCE_infos.version)+"&"; if(l!=null&&l!=undefined&&l){d+="event=1&"}if(probance_logger.enabled){probance_logger.writeLog("tracker "+(this.trackerType!=null?"["+this.trackerType+"] ":"")+(l!=null&&l!=undefined&&l?"event ":"visit ")+"for '"+this.trackingId+"' "+"on url '"+a+"' "+"with customParams : '"+c+"'")}return d};PROBANCE_abstractTracker.prototype.track=function(a,b){var c=this._getTrackRequest(a,false,b);if(c!=null){probance_ajax.callImage(c)}};PROBANCE_abstractTracker.prototype.trackEvent=function(a,b){var c=this._getTrackRequest(a,true,b);if(c!=null){probance_ajax.callImage(c)}};function PROBANCE_CRM_trackingMode(a){this.tracking_param=a;this.tracking_mode=1}var cookieSep="\ntype=";PROBANCE_CRM_trackingMode.prototype.init=function(g,f,c){var h=null,e=null,b=null,a=null,d=null;h=PROBANCE_urlUtils.getParams(c);e=h[this.tracking_param];if(e!==null&&e!==undefined){f.cookie.saveCookie(e);f.tracking_mode=0;f.trackingId=e;f.trackingTypeId=null;if(f.afterIdentify!=null){f.afterIdentify()}}else{e=f.cookie.readFromCookie(); if(e!==null&&e!==undefined){b=e.split(cookieSep);if(b.length>0){a=b[0];d=b[1]}}if(a!==null&&a!==undefined){f.trackingId=a;if(d!==null&&d!==undefined&&d.trim().length>0){f.trackingTypeId=d.trim()}else{f.trackingTypeId=null}if(f.afterIdentify!=null){f.afterIdentify()}e=f.trackingId;if(f.trackingTypeId!=null){e+=cookieSep+f.trackingTypeId}f.cookie.saveCookie(e)}}f.initialized=true};PROBANCE_CRM_trackingMode.prototype.getTrackingMode=function(){return this.tracking_mode};PROBANCE_CRM_trackingMode.prototype.getUrl=function(a){return PROBANCE_urlUtils.deleteParam(a,this.tracking_param)};PROBANCE_CRM_trackingMode.prototype.isNew=function(){return false};var PROBANCE_CRMTracker=(function(g,h,d,b,a,f,c){var e=function(n,o,l,j,i,m,k){PROBANCE_abstractTracker.call(this,n,o,l,j);this.trackerType="CRM";this.trackingTypeId=null;this.customerIdentifier=new PROBANCE_CRM_trackingMode(i);if(m!==null&&m!==undefined){this.initTagger(m,PROBANCE_idManager.getCustomerId,k)}};e.prototype=new PROBANCE_abstractTracker(g,h,d,b); e.prototype.constructor=e;e.trackingTypeId=null;e.prototype.track=function(i,j){PROBANCE_abstractTracker.prototype.track.call(this,i,j)};e.prototype.setCustomer=function(j,i){if(j==null||j==""){return}var k=null;if(this.trackingId!==j||this.trackingTypeId!==i){if(this.tagger!=null){this.tagger.clear()}}this.trackingId=j;if(i!==null&&i!==undefined){this.trackingTypeId=i}if(this.afterIdentify!=null){this.afterIdentify()}k=this.trackingId;if(this.trackingTypeId!=null){k+=cookieSep+this.trackingTypeId}this.cookie.saveCookie(k)};e.prototype.getTrackingTypeId=function(){if(this.trackingTypeId!==null&&this.trackingTypeId!==undefined){return this.trackingTypeId}if(this.cookie===null||this.cookie===undefined){return null}this.trackingTypeId=null;this.trackingId=null;var l=this.cookie.readFromCookie();if(l!==null&&l!==undefined){var j=l.split(cookieSep);var i=j[0];var k=j[1];if(i!==null&&i!==undefined){this.trackingId=i;if(k!==null&&k!==undefined&&k.trim().length>0){this.trackingTypeId=k.trim()}else{this.trackingTypeId=null }}}return this.trackingTypeId};return e}());function PROBANCE_VRM_trackingMode(b,a){this.isNewVisitor=false;if(b.trim().length>0){b=PROBANCE_urlUtils.normalize(b);this.probanceGenerator=PROBANCE_urlUtils.getProtocol(document.location+"")+"://"+b+"VisitorIdGenerator";this.probanceIdentifier=PROBANCE_urlUtils.getProtocol(document.location+"")+"://"+b+"Identifier"}this.visitorCreationCallback=a;this.createdVisitorSentToTagger=false}PROBANCE_VRM_trackingMode.prototype.init=function(i,h){var e=null,d=null,a=null,f=null,g=0,j=this,c=null;if(h.trackingId===null||h.trackingId===undefined){h.trackingId=h.cookie.readFromCookie();if(!this.isVisitorIdValid(h.trackingId)){h.trackingId=null}}if(h.trackingId!==null){h.initialized=true;this.isNewVisitor=false;probance_logger.writeLog("tracker VRM: read visitor id");h.cookie.saveCookie(h.trackingId);if(h.afterIdentify!=null){h.afterIdentify()}probance_ajax.callScript(this.probanceGenerator+"/"+h.trackingId,true,null,null);return}if("origin" in document.location&&document.location.origin!==undefined&&document.location.origin!==null){c=document.location.origin }else{c=document.location.protocol+"//"+document.domain}probance_logger.writeLog("tracker VRM: get visitor id from Probance");var b=function(o){h.initialized=true;var l=false,n=null,k=null;if(o===undefined||o===null){return null}n=o.split("_");if(n.length>0){o=n[0];if(n.length>=1){k=n[1]}if(k!=null&&((new Date()).getTime()-(0+k))<1000){l=true}}if(!j.isVisitorIdValid(o)){probance_logger.writeWarning("received visitorId is not valid, ignore");return null}j.isNewVisitor=l;h.trackingId=o;h.cookie.saveCookie(o);if(h.afterIdentify!=null){h.afterIdentify()}if(h.autoTrackOnInit){h.track()}if(l&&!j.createdVisitorSentToTagger){probance_logger.writeLog("tracker VRM: get '"+o+"' visitor id from Probance");if(h.tagger){probance_logger.writeLog("send created VRM visitor '"+o+"' to tagger");try{probance_ajax.sendAjax("tagger "+(h.taggerType!==null?"["+h.tagger.taggerType+"] ":""),h.tagger.taggerVisitorCreatorUrl+o,false,"",true,function(){j.createdVisitorSentToTagger=true})}catch(m){probance_logger.writeWarning("error sending created VRM visitor '"+o+"' to tagger\n"+m) }}else{probance_logger.writeLog("tagger is disabled, could not sent created VRM visitor")}if(j.visitorCreationCallback!=null){try{j.visitorCreationCallback(o)}catch(m){probance_logger.writeWarning("tracker VRM: fail to sent created visitor\n"+m)}}}return o};probance_ajax.callScript(this.probanceIdentifier,true,function(){if(generatedProbanceVisitorId==null){var k=1*PROBANCE_utils.generateId(12);probance_logger.writeWarning("tracker VRM: fail to get visitor id from Probance, generate one: '"+k+"'");b(""+k);return}probance_logger.writeLog("tracker VRM: get visitor id from Probance: '"+generatedProbanceVisitorId+"'");var k=b(""+generatedProbanceVisitorId);if(k!=null){probance_ajax.callScript(j.probanceGenerator+"/"+k,true,null,null)}return},function(){var k=1*PROBANCE_utils.generateId(12);probance_logger.writeWarning("tracker VRM: fail to get visitor id from Probance, generate one: '"+k+"'");b(""+k)})};PROBANCE_VRM_trackingMode.prototype.isVisitorIdValid=function(a){if(a==null||a==undefined){return false }if(a.trim().length==0){return false}if(isNaN){return !isNaN(a)}if(Object.prototype.toString.call(a)!="[object String]"){return false}return true};PROBANCE_VRM_trackingMode.prototype.getTrackingMode=function(){return 1};PROBANCE_VRM_trackingMode.prototype.isNew=function(){return this.isNewVisitor};var PROBANCE_VRMTracker=(function(g,h,d,a,b,f,c){var e=function(n,o,l,i,j,m,k){PROBANCE_abstractTracker.call(this,n,o,l,i);this.trackerType="VRM";this.visitorCreationCallback=j;this.customerIdentifier=new PROBANCE_VRM_trackingMode(i,j);if(m!==null&&m!==undefined){this.initTagger(m,PROBANCE_idManager.getVisitorId,k)}};e.prototype=new PROBANCE_abstractTracker(g,h,d,a);e.prototype.constructor=e;e.prototype.track=function(i,j){PROBANCE_abstractTracker.prototype.track.call(this,i,j)};return e}());function PROBANCE_tags(){this.trackingId=null;this.trackingTypeId=null;this.generationDate=null;this.nextVerification=null;this.tags=new Array()}PROBANCE_tags.prototype.addTag=function(a,b,d,c){if(d===null||d===undefined){d=c }if(c!==null&&c!==undefined){if(b=="d"||b=="t"){c=new Date(c)}}this.tags.push(new PROBANCE_tag(a,b,d,c))};PROBANCE_tags.prototype.exportAsJson=function(){if(this.tags===null){return""}var b=null,c=null,a=0;for(a=0;a0){c=PROBANCE_urlUtils.normalize(c);this.taggerGetTagsUrl=PROBANCE_urlUtils.getProtocol(document.location+"")+"://"+c+"api/tags/"+d+"/";this.taggerImportTagsUrl=PROBANCE_urlUtils.getProtocol(document.location+"")+"://"+c+"api/importTags/"+d+"/";this.taggerVisitorCreatorUrl=PROBANCE_urlUtils.getProtocol(document.location+"")+"://"+c+"api/visitor/"+d+"/"}this.storagePrefixName=a;this.storageName=null;this.idFunction=b;this.taggerType=e;this.loaded=false;this.tagValue=null;this.callbackAfterLoad=null;this.useAsyncCall=false;this.tagsChanged=false;this.initialized=false}PROBANCE_taggerValue.prototype.clear=function(){this.loaded=false;this.tagValue=null;this.initialized=false};PROBANCE_taggerValue.prototype.getTagsTime=function(){if(this.tagValue!==null){return this.tagValue.expires}return null};PROBANCE_taggerValue.prototype.getLocalTags=function(){try{if(!localStorage){return null }}catch(b){return null}var a=localStorage.getItem(this.storageName);return PROBANCE_encoder.decode(a)};PROBANCE_taggerValue.prototype.removeLocalTags=function(){try{if(!localStorage){return}localStorage.removeItem(this.storageName)}catch(a){return null}};PROBANCE_taggerValue.prototype.saveLocalTags=function(a){try{if(!localStorage){return}localStorage.setItem(this.storageName,a)}catch(b){return null}};PROBANCE_taggerValue.prototype.init=function(c,e,h){if(this.initialized){if(h!=null){h()}return}this.initialized=true;if(this.storageName==null){if(this.storagePrefixName!=null&&this.storagePrefixName!=undefined){this.storageName=this.storagePrefixName+"_"}else{this.storageName=""}this.storageName+=this.taggerType+"_tags"}if(c===null){this.tagValue=null;if(h!=null){h()}return}if(this.tagValue!==null){if(h!=null){h()}return}if(e!==null&&e!==undefined&&e.trim().length>0){e=e.trim()}else{e=null}var f=null,d=null,b=null,g="tagger "+(this.taggerType!==null?"["+this.taggerType+"] ":"");f=this.getLocalTags(); if(f!==null){this.tagValue=new PROBANCE_tags().readFromString(f);if(this.tagValue!=null){if(this.tagValue.trackingId!==c||this.tagValue.trackingTypeId!==e){probance_logger.writeLog(g+"local tags are not for this customer");this.removeLocalTags();this.tagValue=null}}else{if(this.tagValue!=null){this.removeLocalTags();this.tagValue=null}}}d=this;if(this.tagValue!==null){if(this.tagValue.nextVerification&&this.tagValue.nextVerification.getTime()>new Date().getTime()){this.loaded=true;if(h!=null){h()}return}}probance_logger.writeLog(g+"get tags from server",true);var a=new Date();b=null;if(d.idFunction!==null&&e==null){b=d.idFunction(c)}if(b===null){b=c}d.getTagsFromServer(g+"get tags from server",b,e,d.useAsyncCall,function(j){probance_logger.writeLog(g+"get tags from server",false,a);var i="";if(d.tagValue!==null){d.tagValue.trackingId=b;d.tagValue.trackingTypeId=e;i=JSON.stringify(d.tagValue)}d.saveLocalTags(PROBANCE_encoder.encode(i));probance_logger.writeLog(g+"save tag into local storage"); if(h){h()}d.tagsChanged=j;if(j&&d.callbackAfterLoad){setTimeout(d.callbackAfterLoad,100)}})};PROBANCE_taggerValue.prototype.getTags=function(){return this.tagValue};PROBANCE_taggerValue.prototype.getTag=function(c,a){if(c===null){return null}var b=null,d=null;b=this.getTags();if(b==null){return a}d=b.getTagValue(c);if(d==null){return a}return d};PROBANCE_taggerValue.prototype.getTagsFromServer=function(h,f,d,e,g){var b=this;var a=(this.tagValue&&this.tagValue.nextVerification?"ifModifiedSince="+this.tagValue.nextVerification.getTime():"");if(d!==null&&d!==undefined&&d.trim().length>0){d=d.trim()}else{d=null}var c=this.taggerGetTagsUrl;if(d!==null){c+=d+"/"}c+=f;probance_ajax.sendAjax(h,c,true,a,e,function(){var m=null,q=null,o=null,j=null,s=null,l=null,r=null,p=0,n=false;if(!b.tagValue){b.tagValue=new PROBANCE_tags()}if("status" in this&&this.status!==undefined&&this.status!==null){m=Math.floor(this.status/100);if(m===2){q=this.responseText}}else{if("XDomainRequest" in window&&window.XDomainRequest!==null){q=this.responseText }}if(q===null){probance_logger.writeWarning(h+": not content (http "+this.status+")")}else{if(this.responseText.trim().length==0){probance_logger.writeLog(h+": unchanged")}else{try{o=JSON.parse(q)}catch(k){probance_logger.writeWarning(h+": fail to parse"+q)}if(o!==null){if("tags" in o&&o.tags){probance_logger.writeLog(h+": changed");n=true;b.tagValue=new PROBANCE_tags();b.tagValue.trackingId=f;b.tagValue.trackingTypeId=d;b.tagValue.generationDate=new Date(o.generationDate);for(p=0;p