<!--
// WEBABACUS CLIENT INFO VERSION 2.06, (c)2007 Foviance Ltd ALL RIGHTS RESERVED. 
// Version to be used as a JS include
// See accompanying clientinfo-include-notes.txt for change history, or contact helpdesk@foviance.com

// User variables: Change these values to set global settings
var server = "http://tag1.webabacus.com";   			// Set to another server (e.g. http://192.168.1.250) to send tag request to that server (not local)
var secureserver = "https://tag1.webabacus.com"; 	// Enter the address of the server to which secure tag requests should be sent (include https:// part)
var site = "mrgum";															//  - (Recommended) Enter the name of this site
var cookieLife = 730;  										// No. of days that the cookie is valid for (default is 730 - two years)
var cookieDomain = ".egmont.co.uk"; 										//  - (Optional) Domain for the cookie (must start with and include at least two full stops - e.g. .webabacus.com or .webabacus.co.uk)	
var perfinfo = 0; 												// Flag to indicate whether this script will be used to gather full performance data - set to 1 if it will be
var sourceparamname = ""; 								//  - (Optional) Name of the parameter in the query string which indicates a source value
var checkFlash = false;								// Boolean to determine installed plugins, with the results written into the custom fields. Note that Internet Explorer requires an ActiveX object to be created with requires end user confirmation.
var ThirdPartyCookie = false;							// Boolean to control whether to set a third party cookie based on the 'server' variable above. Note the 'clientinfo.asp' file MUST present on the relevatn 'server'.
// End of user variables

// set timer
var fromt = new Date();
var elapsedt = fromt.getTime();
var pet = "";
var SRT = "0";
var OET = "0";
var UET = "0";

var civersion="2.06";
var js = "-";
var sc = 0;
var sw = 0;
var sh = 0;
var ww = 0;
var wh = 0;
var je = "-";
var lg = "-";
var dn = "-";
var bt="";
var st="-";
var tz=0;
var vl="-";
var t=0;
var sr="-";
var res="-";
var ref="-";
var res2="-";
var pt="-";
var fs=0;
var is=0;
var id="-";
var idparm="";
var nu="-";
var wr="-";
var base="";
var reqsrc="";
var now="";
var tt=0;
keys = new Array();
values = new Array();
var source = "";
var src = "-";
var clifems = cookieLife * 86400000;
ccrt = new Date(fromt.getTime());
cexp = new Date(fromt.getTime() + clifems);
var srctime=0;
var customfields="";
var optout="";
var trioid="-";

var key1 = '';
var key2 = '';
var charArray = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z');


var rn="";
for (i = 0; i < 4; i++){
		rn += charArray[Math.floor(Math.random() * charArray.length)];
	}
var tmp1=new Date();
var tmp2=tmp1.getTime();
var tmp3=Math.floor(tmp2/200000);
var tmp4=Math.floor(tmp3*200000);
var rn2 = rn + (Math.floor(tmp2-tmp4));


function logclientdata(n,r) {
	thispet = n;
		if(r)
		res2=r;
	// Calculate time differentials
	if (thispet=="01") {
	  now = new Date();
	  tt = now.getTime();
	  SRT = (tt - elapsedt);
	  trioid = rn2;
	  }
	else if (thispet=="02") {
	  now = new Date();
	  tt = now.getTime();
	  OET = (tt - elapsedt);
	  trioid = rn2;
	  }
	else if (thispet=="03") {
	  now = new Date();
	  tt = now.getTime();
	  UET = (tt - elapsedt);
	  trioid = rn2;
	  }
	else if (thispet=="0") {
		var tmp5=new Date();
		var tmp6=tmp5.getTime();
		var tmp7=Math.floor(tmp6/200000);
		var tmp8=Math.floor(tmp7*200000);
		var rn3 = rn + (Math.floor(tmp6-tmp8));
	  SRT = 0;
	  OET = 0;
	  UET = 0;
	  trioid = rn3;
	}
	else  {
	  SRT = 0;
	  OET = 0;
	  UET = 0;
	  trioid = rn2;
	  thispet = "-";
	  }
	
	if (navigator.appName == 'Netscape') bt = "NS";
	else {
	if (navigator.appName == 'Microsoft Internet Explorer') bt = "IE";
	else bt="OT";
	}
	
	je = navigator.javaEnabled() ? "Y" : "N";
	dn = document.domain;
	lg = bt=="NS" ? navigator.language : navigator.browserLanguage;
	sc = Math.pow(2, screen.colorDepth);
	sp = screen.pixelDepth;
	sw = screen.width;
	sh = screen.height;
	now = new Date();
	
	st = escape(site);
	if (st==null || st=="") st = "-";
	tz = now.getTimezoneOffset();
	vl = history.length;
	t = now.getTime();
	sr = sw + "x" + sh;
	
	res = escape(document.URL);
	ref = escape(document.referrer);
	if (ref==null || ref=="") ref = "-";
	pt = escape(document.title);
	if (pt==null || pt=="") pt = "-";
	
	if((navigator.appName == 'Netscape')&&(parseInt(navigator.appVersion)<5)){
		fs = "-";
	  is = "-";
	  wr = "-";
	  customfields = "-";
	}
	else {
		if (thispet != "01"){
	  	// Capture size of document and related graphics
	  	is = 0;
	  	try {
	  		fs = document.fileSize * 1;  
	  		var iMap = new Object();
	    	for (i = 0; i < document.images.length; i++) {
	      	  if (!iMap[document.images[i].src]) {
	        	    is += parseInt(document.images[i].fileSize);
	          	  iMap[document.images[i].src] = true;
	        	}
	    	}
	  	} catch (e) {fs = 0; is = 0;}
	  
	  	if (bt == 'IE') {
	    	 if (document.documentElement && document.documentElement.clientWidth) {
	      	  ww = document.documentElement.clientWidth;
	        	wh = document.documentElement.clientHeight;
	     	}
	     	else if (document.body){
	      	  ww = document.body.clientWidth;
	        	wh = document.body.clientHeight;
	     	}
	  	}
	  	else {
	    	try {
	      	ww = window.outerWidth; wh = window.outerHeight;
	    	} catch (e) {ww = 0; wh = 0;}
	  	}
	  	var wr = ww + "x" + wh;
	  
		}
		else {
	  	fs = "-";
	  	is = "-";
	  	wr = "-";
		}
	}
	
	// Capture the values of the custom fields
	if (typeof(wacustomvarnames) != "undefined") {
  	customfields = "";
  	for (i = 0; i < wacustomvarnames.length; i++) {
  	  customfields = customfields + escape(wacustomvarnames[i]) + "~" + escape(wacustomvarvalues[i]);
    	if (i != wacustomvarnames.length-1) customfields = customfields + "~";
  	}
	} else
  		customfields = "-"; 
  
	if(checkFlash)
		{
		if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;
		var version = deconcept.SWFObjectUtil.getPlayerVersion();
		if(customfields == "-")
			customfields = ""
		customfields += "~fl~" + version['major'] +"."+ version['minor'] +"."+ version['rev'];
		

		}
  	
	parseQS();
	
	
function gen_id(int2) {
	var key1="";
	var key2="";
	for (i = 0; i < int2; i++){
		key1 += charArray[Math.floor(Math.random() * charArray.length)];
	}
	for (i = 0; i < key1.length; i++){
		key2 += key1.charCodeAt(i).toString(16);
	}
	var curDate = new Date();
	var curMonth = curDate.getMonth()+1;
	var curYear = curDate.getYear();
	var curDay = curDate.getDate();
	
	//Create Date, Time, and GMT offset String
	if(curDay<10) curDay = "0" + curDay;
	if(curMonth<10) curMonth = "0" + curMonth;
	if(curYear<1000) curYear+=1900;
	     
	var CreationDate = curYear.toString() + curMonth.toString()+ curDay.toString();
	var curDateTime = new Date();
	var curHour = curDateTime.getHours() + curDateTime.getTimezoneOffset()/60;

	if (curHour > 24)  curHour -= 24;
	if (curHour < 0) curHour += 24;

	var curMin = curDateTime.getMinutes();
	var curSec = curDateTime.getSeconds();
	var curTime = ((curHour < 10) ? "0" : "") + curHour + ((curMin < 10) ? "0" : "") + curMin + ((curSec < 10) ? "0" : "") + curSec;
	var CreationTime = curTime + "-GMT" + (curDateTime.getTimezoneOffset()/60);

	var CreatedAt = "d" + CreationDate + "_t" + CreationTime;

	//Create WebAbacus ID (ID) from two random strings, and the date/time/offset string             
	var id = key1 + key2 + "-1-" + CreatedAt;
	return(id);
}
	
	// Check for and issue cookie - will use the value of a "webabacus_id" parameter by preference
	optout = getCookie("nocookie");
	
	if (optout != "1") {
	  idparm = getQSParam("webabacus_id");
	  if (idparm == null || idparm == "") {
	    id = getCookie("webabacus_id");
	  } else {
	    id = idparm;
	  }
	  if (id == null || id == "-1") {
	    //id = now.getTime()+"-1";
	    id = gen_id(5);
	    nu="1" // New user (they've not been issued a cookie before)
	  } else {
	    nu="0"
	  }
	  document.cookie = "webabacus_id="+escape(id)+"; expires=" + cexp.toUTCString() + "; path=/" + (cookieDomain == "" ? "" : "; domain=" + cookieDomain);
	  // Check that cookie has been set. If not set the webabacus id value to null.
	   if(document.cookie.indexOf(escape(id))<0){
	  	var id = null;
	  	var nu = null;
	  }
	 	
	} else {
	  id = "nocookie";
	  nu = "-1";
	}
	// Get query string info & parse out required parameters
	source=getQSParam(sourceparamname);
	// If a particular parameter is non-null, set that value in the "click source" cookie
	if (source != null) {
	  src = escape(source);
	  srctime=fromt.getTime();
	  if (optout != "1") {
	    document.cookie = "wa_last_source="+escape(source)+"; expires=" + cexp.toUTCString() + "; path=/" + (cookieDomain == "" ? "" : "; domain=" + cookieDomain);
	    document.cookie = "wa_last_source_date="+srctime+"; expires=" + cexp.toUTCString() + "; path=/" + (cookieDomain == "" ? "" : "; domain=" + cookieDomain);
	  }
	} else {
	  if (optout != "1") {
	    src = getCookie("wa_last_source");
	    srctime = getCookie("wa_last_source_date");
	  }
	  if (src == null) src = "-";
	  if (srctime == null) srctime = 0;
	}
	  
	// decide which tag request (secure vs non-secure) to use
	if(ThirdPartyCookie)
		extType = ".asp";
	else
		extType = ".gif";
	
	if (res.substring(0,5) == "https"){
	  base = secureserver + "/clientinfo" + extType + "?" + civersion + "&" + t + "&";
	}
	else{
	  base = server + "/clientinfo" + extType + "?" + civersion + "&" + t + "&";
	}
	
	// Checks if a custom event call has been made (res2)  
	if(res2!="-"){
		var res = escape('http://') + dn + '/' + escape(res2.replace('http://',''));
		var ref = escape(document.URL);
	}
	
	reqsrc = st + "&" + tz + "&" +id + "&" +nu + "&" + sc + "&" +sr + "&" + wr + "&" + js + "&" + je + "&" + lg + "&" + dn + "&" + res + "&" + ref + "&" + pt + "&" + fs + "&" + is + "&" + trioid + "&" + thispet + "&" + SRT + "&" + OET + "&" + UET + "&" + src + "&" + srctime + "&" + customfields;
	var maxlen = 4000;  // max request size
	var reqlen = reqsrc.length;
	if (reqlen>maxlen) reqsrc = reqsrc.substring(0,maxlen);
	  
	var request = new Image();
	request.src = base + reqsrc + "&-";
	
	if((document.URL.indexOf('wa_debug=true')>-1)|(document.cookie.indexOf("webabacus_debug=true")>-1)){
		alert("WebAbacus Debug Infomation\n\nnote: to remove add 'wa_debug=false' to the URL\n\nSite name (st): " + st +"\nTime zone offset (tz): "+tz+"\nWebabacus ID (id): "+id+"\nNew user flag (nu): "+nu+"\nVisitor Screen Colour Depth (sc): "+sc+"\nVisitor Screen resolution (sr): "+sr+"\nVisitor Window resolution (wr): "+wr+"\nJavascript version (js): "+js+"\nJava Enablement (je): "+je+"\nBrowser Language (lg): "+lg+"\nServer name (dn): "+dn+"\nResource (res): "+res+"\nReferrer (ref): "+ref+"\nPage Title (pt): "+pt+"\nfs: "+fs+"\nis: "+is+"\ntrioid: "+trioid+"\nthispet: "+thispet+"\nSRT: "+SRT+"\nOET: "+OET+"\nUET: "+UET+"\nsrc: "+src+"\nsrctime: "+srctime+"\ncustomfields: "+customfields + "\n\nMain Tag: "+ base + reqsrc + "&-");
		document.cookie="webabacus_debug=true; expires="+cexp.toUTCString()+"; path=/"+(cookieDomain==""?"":"; domain="+cookieDomain);
	}
	
	if(document.URL.indexOf('wa_debug=false')>-1){
		document.cookie="webabacus_debug=false; expires="+cexp.toUTCString()+"; path=/"+(cookieDomain==""?"":"; domain="+cookieDomain);
	}
}

function getCookie (name) {
var dc = document.cookie;
var cname = name + "=";
var clen = dc.length;
var cbegin = 0;
while (cbegin < clen) { 
var vbegin = cbegin + cname.length;
  if (dc.substring(cbegin, vbegin) == cname) { 
    var vend = dc.indexOf (";", vbegin);
    if (vend == -1) vend = clen;
    return unescape(dc.substring(vbegin, vend));
    }
  cbegin = dc.indexOf(" ", cbegin) + 1;
  if (cbegin== 0) break;
  }
return null;
}

function getQSParam(key)
{
	var value = null;
	for (var i=0;i<keys.length;i++)
	{
		if (keys[i]==key)
		{
			value = values[i];
			break;
		}
	}
	return value;
}

function parseQS()
{
	var query = "";
	try {
	  query = top.window.location.search.substring(1);
	} catch (e) {}
	var query1 = query.toLowerCase();
	var pairs = query1.split("&");
	
	for (var i=0;i<pairs.length;i++)
	{
		var pos = pairs[i].indexOf('=');
		if (pos >= 0)
		{
			keys[keys.length] = pairs[i].substring(0,pos);
			values[values.length] = pairs[i].substring(pos+1);		
		}
	}
}

// This code executes when the script is first parsed
if (perfinfo == 1) {
  logclientdata("01");
} else {
  logclientdata("");
}

//-->

