CT=new ChannelTrack;function ChannelTrack(){this.window=window;this.hostname="www.channeltrack.co.uk";this.ftypes="pdf,doc,xls,txt,csv,zip,exe";this.CookieName="ChannelTrack_TC";this.cookieDomain=window.location.hostname.replace("www","");this.eventTracking=this.enabled=true;this.CTS={};this.CTU={};this.ST={};this.trackers=[];this.trackingIndex=0;this.leaving=false}
ChannelTrack.prototype.init=function(){if(this.enabled&&document.cookie.indexOf(this.CTPrefix+"=")==-1)document.write("<script type='text/javascript' src='http"+(window.location.protocol.indexOf("https:")==0?"s":"")+"://"+this.hostname+"/channeltrackid.js'><\/script>")};
ChannelTrack.prototype.getSession=function(){var a=new Date,c=this.ST,b=this.CTS;try{b.visitorID=CTSVID;b.ClientID=ClientID}catch(d){b.visitorID="";b.ClientID=""}b.userAgent=navigator.userAgent;if(document.all)b.windowsSize=document.body?document.body.offsetWidth+"x"+document.body.offsetHeight:"undefined";else b.windowSize=window.innerWidth+"x"+window.innerHeight;if(document.body&&document.body.addBehaviour)try{document.body.addBehaviour("#default#clientCaps");b.connection=document.body.connectionType||
"undefined";document.body.addBehaviour("#default#homePage");b.HomePage=document.body.isHomePage?"1":"0"}catch(e){}if(typeof screen=="object"){b.resolution=screen.width+"x"+screen.height;b.colourDepth=navigator.appName=="Netscape"?screen.pixelDepth:screen.colorDepth}b.javaEnabled=typeof navigator.javaEnabled()=="boolean"?navigator.javaEnabled()?"1":"0":"undefined";b.javascriptEnabled="1";b.FlashVersion=this.getFlashVersion();b.FlashEnabled=b.FlashVersion=="undefined"?"0":"1";b.SilverlightVersion=this.getSilverlightVersion();
b.SilverlightEnabled=b.SilverlightVersion=="undefined"?"0":"1";b.language=navigator.appName=="Netscape"?navigator.language:navigator.userLanguage;b.characterEncoding=typeof document.defaultCharset=="string"?document.defaultCharset:typeof document.characterSet=="string"?document.characterSet:"undefined";b.timezone=parseInt(a.getTimezoneOffset()/60*-1)||"0";b.ssl=window.location.protocol.indexOf("https:")==0?"1":"0";var f=this.GetCookie(this.CookieName);c.sessiondate=f?parseInt(this.GetValue(f,"sd",
"|")):a.getTime();c.ip=window.location.hostname;c.uri=window.location.pathname;c.date=a.getTime();b.url=c.ip+c.uri;b.title=document.title?document.title:b.url;if(window.location.search)c.Query=window.location.search;if(window.document.referrer!=""&&window.document.referrer!="-")c.referrer=window.document.referrer};
ChannelTrack.prototype.getMeta=function(){var a;if(document.all)a=document.all.tags("meta");else if(document.documentElement)a=document.getElementsByTagName("meta");if(typeof a!="undefined")for(var c=a.length,b=0;b<c;b++){var d=a.item(b).name,e=a.item(b).content;a.item(b);if(d.length>0)if(d.indexOf("CTS_")==0)this.CTS[d.substring(4)]=e;else if(d.indexOf("CTU_")==0)this.CTU[d.substring(4)]=e}};
ChannelTrack.prototype.getFlashVersion=function(){var a;if(window.ActiveXObject)for(var c=1;c<=10;c++)try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+c);var b=a.GetVariable("$version");return b=b.split(" ")[1].replace(/,/g,".")}catch(d){}else if(navigator.plugins&&navigator.plugins.length)if(a=navigator.plugins["Shockwave Flash"])return a.description.replace("Shockwave Flash ","").split(" ")[0];return"undefined"};
ChannelTrack.prototype.getSilverlightVersion=function(){try{var a=null;try{a=new ActiveXObject("AgControl.AgControl");var c="",b=Array(1,0,0,0);this.SLloopMatch(a,b,0,1);this.SLloopMatch(a,b,1,1);this.SLloopMatch(a,b,2,1E4);this.SLloopMatch(a,b,2,1E3);this.SLloopMatch(a,b,2,100);this.SLloopMatch(a,b,2,10);this.SLloopMatch(a,b,2,1);this.SLloopMatch(a,b,3,1);return c=b.join(".")}catch(d){var e=navigator.plugins["Silverlight Plug-In"];if(e){var f=e.description;if(f==="1.0.30226.2")f="2.0.30226.2";return f}}}catch(g){}return"undefined"};
ChannelTrack.prototype.IsDownloadFile=function(a){a=a.substring(a.lastIndexOf(".")+1,a.length);for(var c in this.ftypes.split(","))if(c.toLowerCase()==a.toLowerCase())return true;return false};ChannelTrack.prototype.BindEvent=function(a,c){if(typeof c=="function"&&document.body)if(document.body.addEventListener)document.body.addEventListener(a,c.bindEvent(this),true);else document.body.attachEvent&&document.body.attachEvent("on"+a,c.bindEvent(this))};ChannelTrack.prototype.Unload=function(a){alert(a)};
ChannelTrack.prototype.BindWindowEvent=function(a,c){if(typeof c=="function")if(window.addEventListener)window.addEventListener(a,c.bindEvent(this),true);else window.attachEvent&&window.attachEvent("on"+a,c.bindEvent(this))};
ChannelTrack.prototype.EventTracker=function(){var a=navigator.appVersion.indexOf("MSIE")!=-1?"click":"mousedown";this.BindEvent(a,this.DownloadEvent);this.BindEvent(a,this.LeaveSiteEvent);this.BindEvent(a,this.FormEvent);this.BindEvent("contextmenu",this.ContextMenuEvent);this.BindWindowEvent("beforeunload",this.LeaveSiteEvent)};ChannelTrack.prototype.GetElement=function(a,c){var b=a.target||a.srcElement;if(b!=undefined)for(;b.tagName&&b.tagName!=c;)b=b.parentElement||b.parentNode;return b};
ChannelTrack.prototype.AddTrackingTags=function(){var a=this.AddTrackingTags.arguments?this.AddTrackingTags.arguments:arguments;if(a.length%2==0){for(var c=0;c<a.length;c+=2){var b=a[c],d=a[c+1];if(b=="fdata")for(var e in d)this.CTU[e]=d[e];else if(b.indexOf("CTS_")==0)this.CTS[b.substring(4)]=d;else if(b.indexOf("CTU_")==0)this.CTU[b.substring(4)]=d;else if(b.indexOf("ST_")==0)this.ST[b.substring(3)]=d}this.CTS.sdate=(new Date).getTime();this.CreateCookie();this.AddTag()}};
ChannelTrack.prototype.CreateCookie=function(){var a=this.CTS,c=this.CookieName,b=new Date,d=new Date(b.getTime()+31536E7),e=new Date(b.getTime());a.visitorID="";if(document.cookie.indexOf(c)==-1)a.visitorID=typeof CTSVID!="undefined"&&CTSVID!=""?CTSVID:"";else{var f=this.GetCookie(c),g=this.GetValue(f,"vid","|");a.visitorID=g;parseInt(this.GetValue(f,"cd","|"));f=parseInt(this.GetValue(f,"sd","|"));e.setTime(f);if(g==null||g=="null"||isNaN(g)||isNaN(f))return;a.visitorID=g}a="vid="+a.visitorID+"|cd="+
b.getTime().toString()+"|sd="+e.getTime().toString();d="; expires="+d.toUTCString();document.cookie=c+"="+a+d+"; path=/"+(this.cookieDomain!=""?"; domain="+this.cookieDomain:"")};
ChannelTrack.prototype.GetCookie=function(a){var c=document.cookie.split("; "),b=[],d=0,e=0,f=a.length,g=c.length;for(e=0;e<g;e++){var i=c[e];if(i.substring(0,f+1)==a+"=")b[d++]=i}c=b.length;if(c>0){d=0;if(c>1&&a==this.CookieName){a=new Date(0);for(e=0;e<c;e++){g=parseInt(this.GetValue(b[e],"cd"));g=new Date(g);if(g>a){a.setTime(g.getTime());d=e}}}return unescape(b[d].substring(f+1))}else return null};
ChannelTrack.prototype.GetValue=function(a,c,b){a=a.split(b);for(b=0;b<a.length;b++){var d=a[b].split("=")[0],e=a[b].split("=")[1];if(c==d)return e}return null};
ChannelTrack.prototype.AddTag=function(){var a=this.CTS,c=this.CTU,b=this.ST,d="http"+(window.location.protocol.indexOf("https:")==0?"s":"")+"://"+this.hostname+(a.ClientID==""?"":"/"+a.ClientID)+"/CT.gif?";for(var e in a)if(a[e]&&typeof a[e]!="function")d+=this.AppendQueryString(e,a[e]);for(e in c)if(c[e]&&typeof c[e]!="function")d+=this.AppendQueryString("CTU_"+e,c[e]);for(e in b)if(b[e]&&typeof b[e]!="function")d+=this.AppendQueryString(e,b[e]);this.AddTracking(d)};
ChannelTrack.prototype.AddTracking=function(a){if(document.images){this.trackers[this.trackingIndex]=new Image;this.trackers[this.trackingIndex].src=a;this.trackingIndex++}else document.write("<img alt='' border='0' name='ChannelTrackIMG' width='1' height='1' src='"+a+"'/>")};
ChannelTrack.prototype.AppendQueryString=function(a,c){if(typeof c!="number"&&c.indexOf("&")!=-1){for(var b=c.substring(1).split("&"),d="",e=0;e<b.length;e++){var f=b[e],g=f.substring(0,f.indexOf("="));f=f.substring(f.indexOf("=")+1);if(e!=0)d+="&";d+=g+"="+this.URLEncode(f)}c=c.substring(0,1)+d}return"&"+a+"="+this.URLEncode(c)};ChannelTrack.prototype.URLEncode=function(a){return typeof encodeURIComponent=="function"?encodeURIComponent(a):escape(a)};
ChannelTrack.prototype.DownloadEvent=function(a){if((a=a||window.event)&&(typeof a.which!="number"||a.which==1)){var c=this.GetElement(a,"A");if(a.href){var b=c.hostname?c.hostname.split(":")[0]:"";if(this.OnSite(b)&&this.IsDownloadFile(c.pathname)){var d=c.search?c.search.substring(c.search.indexOf("?")+1,c.search.length):"",e=c.pathname?c.pathname.indexOf("/")!=0?"/"+c.pathname:c.pathname:"/",f="";a=this.GetElement(a,"IMG");if(a.alt)f=a.alt;else if(text)f=text;else if(c.innerHTML)f=c.innerHTML;
this.AddTrackingTags("ST_ip",b,"ST_uri",e,"ST_Query",d,"CTS_title","Download:"+f);this.ST.ip=this.ST.uri=this.ST.Query=this.CTS.title=""}}}};
ChannelTrack.prototype.FormEvent=function(a){if((a=a||window.event)&&(typeof a.which!="number"||a.which==1))for(var c=["INPUT","BUTTON"],b=0;b<c.length;b++){var d=this.GetElement(a,c[b]);if(d.type&&(d.type=="submit"||d.type=="image"||d.type=="button"||d.type=="reset"||d.type=="text"&&(d.which==13||d.keyCode==13))){var e;if(d.form){a=d.form.action||window.location.pathname;c=d.form.id||d.form.name||d.form.className||"Undefined";e={};try{var f=d.form.elements;for(b=0;b<f.length;b++){d=false;try{for(var g in ffExclude)if(ffExclude[g].toLowerCase()==
f[b].name.toLowerCase()){d=true;break}}catch(i){}if(!d){var h="FF_"+f[b].name;if(f[b].nodeName=="SELECT"){e[h]="";for(d=0;d<f[b].options.length;d++)if(f[b].options[d].selected){e[h]+=f[b].options[d].value+";#";e[h]+=f[b].options[d].text+"||"}}else if(f[b].type=="radio"||f[b].type=="checkbox"){if(f[b].checked)e[h]=f[b].value}else e[h]=f[b].value}}}catch(j){}}else{a=window.location.pathname;c=d.name||d.id||"Undefined"}this.AddTrackingTags("ST_uri",a,"CTS_title","Form:"+c,"fdata",e);this.ST.ip=this.ST.uri=
this.ST.Query=this.CTS.title="";break}}};
ChannelTrack.prototype.LeaveSiteEvent=function(a){if((a=a||window.event)&&(typeof a.which!="number"||a.which==1)&&this.leaving==false){a=this.GetElement(a,"A");var c="",b="",d=b="",e=new Date;if(a!=undefined&&a.href){this.leaving=true;c=a.hostname?a.hostname.split(":")[0]:"";b=a.protocol||"";if(c.length>0&&b.indexOf("http")==0){if(this.OnSite(c)){d=window.location.pathname;b="";if(window.location.search)b=window.location.search;this.AddTrackingTags("ST_ip",window.location.hostname,"ST_uri",d,"ST_Query",
b,"CTS_title",document.title,"CTS_edate",e.getTime())}else{b=a.search?a.search.substring(a.search.indexOf("?")+1,a.search.length):"";d=a.pathname?a.pathname.indexOf("/")!=0?"/"+a.pathname:a.pathname:"/";this.AddTrackingTags("ST_ip",c,"ST_uri",d,"ST_Query",b,"CTS_title","OffSite:"+c+d+b,"ST_SessionEnd",e.getTime(),"CTS_edate",e.getTime())}this.ST.ip=this.ST.uri=this.ST.Query=this.CTS.title=this.ST.SessionEnd=""}}}};
ChannelTrack.prototype.ContextMenuEvent=function(a){if(a=a||window.event)if((a.which||a.button)!=1||navigator.userAgent.indexOf("Safari")!=1){var c=this.GetElement(a,"A");if(typeof c.href!="undefined"&&a.href)if(typeof c.protocol!="undefined"&&c.protocol&&c.protocol.indexOf("http")!=-1)if(typeof c.pathname!="undefined"&&c.pathname&&this.IsDownloadFile(c.pathname)){a=c.hostname?c.hostname.split(":")[0]:"";c=c.pathname?c.pathname.indexOf("/")!=0?"/"+c.pathname:c.pathname:"/";this.AddTrackingTags("ST_ip",
a,"ST_uri",c,"ST_Query","","CTS_title","ContextMenu:"+c);this.ST.ip=this.ST.uri=this.ST.Query=this.CTS.title=""}}};ChannelTrack.prototype.OnSite=function(a){if(a.length>0){a=a.toLowerCase();if(a==window.location.hostname.toLowerCase())return true;if(ClientDomains.length>0)for(var c in ClientDomains.split(","))if(a==c)return true}return false};
ChannelTrack.prototype.bindEvents=function(){if(this.enabled&&this.eventTracking&&typeof this.EventTracker=="function")if(window.addEventListener)window.addEventListener("load",this.EventTracker.bindEvent(this),false);else window.attachEvent&&window.attachEvent("onload",this.EventTracker.bindEvent(this));this.CreateCookie()};ChannelTrack.prototype.SLloopMatch=function(a,c,b,d){for(;this.SLIsSupported(a,c);)c[b]+=d;c[b]-=d};
ChannelTrack.prototype.SLIsSupported=function(a,c){return a.isVersionSupported(c[0]+"."+c[1]+"."+c[2]+"."+c[3])};ChannelTrack.prototype.Collect=function(){if(this.enabled){this.getSession();this.getMeta();this.bindEvents();this.AddTag()}};
ChannelTrack.prototype.Debug=function(){for(var a="",c=0;c<this.trackers.length;c++){var b=this.trackers[c];a+="Tracking Image:"+(c+1)+"<br/>";b=b.src.substring(b.src.indexOf("?")).split("&");for(var d=0;d<b.length;d++)a+=b[d].replace("="," : ")+"<br/>";a+="<br><b>Cookies</b><br><code>"+document.cookie.replace(/\;/g,"<br>")+"</code>";a+="<br/><br/>"}this.win=window.open("","ChannelTrackDebug","width=640,height=800,scollbars=yes,resizeable=yes");this.win.document.write(a);this.win.focus()};
Function.prototype.bindEvent=function(a){var c=this;return function(){return c.apply(a,arguments)}};