//Copyright 2003-2008 VisiStat, Inc., All Rights Reserved.

function VisiStat() {

var vurl=document.URL;
// ECL modification starts
if (window.location.hash) {
	// Strip any hash value from the URL and append it as the value for the pmc argument
	vurl=vurl.replace(window.location.hash, '');
	if (vurl.indexOf('?') == -1) {
		vurl=vurl+'?pmc='+((window.location.hash).replace('#', '')); 
	} else {
		vurl=vurl.split('?');
		vurl[1]='pmc='+((window.location.hash).replace('#', ''))+'&'+vurl[1];
		vurl=vurl.join('?');
	}
}
// ECL modification ends
var vs="DID="+DID;
	vs+="&MyPage="+MyPageName;
	vs+="&MyID="+MyID;
	vs+="&TitleTag="+document.title;
    vs+="&Page="+window.location.pathname.substring(window.location.pathname.lastIndexOf('\\') + 1); 
	vs+="&Hst="+document.domain;
    vs+="&width="+screen.width;
	vs+="&height="+screen.height;
	vs+="&ColDep="+screen.colorDepth;
	vs+="&Lang="+navigator.language;
	vs+="&Cook="+navigator.cookieEnabled;
	
	var vsr;
	try {
		vsr="Reff="+escape(parent==self?window.document.referrer:parent.document.referrer);
	}
	catch(e) {
		vsr="Reff="+escape(window.document.referrer);
	}
	
	vsr = vsr.replace(/&/g, "AND");

	var	vsd="FullPage="+vurl;
	vsd = vsd.replace(/&/g, "AND");
	
	var purl = "PMCD="+vurl;
	
	var flaver='';
	var n=navigator;
	if (n.plugins && n.plugins.length) {
		for (var i=0;i<n.plugins.length;i++) {
			if (n.plugins[i].name.indexOf('Shockwave Flash')!=-1) { flaver=n.plugins[i].description.split('Shockwave Flash ')[1]; break; }
		}
	}
	else if (window.ActiveXObject) {
		for (var i=10;i>=2;i--) {
			try {
				var fl=eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+i+"');");
				if (fl) { flaver=i; break; }
		   }
		   catch(e) {}
	  }
	}
	
	var rand = Math.random();
	sniffer = new Image(); 
	sniffer.src = 'https:\/\/sniff.visistat.com\/index.php?'+vs+'&'+vsr+'&'+vsd+'&'+purl+'&Fla='+flaver+'&r='+rand;

}

function VSLT(LinkName) {
	var random = Math.random();
	sniff = new Image(); 
	sniff.src= 'https:\/\/sniff.visistat.com\/index.php?DID='+DID+'&LinkName='+LinkName+'&r='+random;
}

function msrec(e) {

	if (navigator.appName == "Netscape") { msx = e.pageX; msy = e.pageY; }
	else { msx = event.clientX+document.body.scrollLeft; msy = event.clientY+document.body.scrollTop; }

	var rand = Math.random();
	var pw = screen.width;
	var ph = document.body.scrollHeight;
	msxy = new Image();
	
	msxy.src= 'https:\/\/sniff.visistat.com\/tm.php?r='+rand+'&DID='+DID+'&pw='+pw+'&ph='+ph+'&msx='+msx+'&msy='+msy+'&mspage='+window.location.pathname.substring(window.location.pathname.lastIndexOf('\\') + 1);
}


window.document.onmousedown = msrec;

var msx = 0;
var msy = 0;
var MyPageName = '';
var MyID = '';
VisiStat();

/** sniff ends, conversion starts **/

var ConvName = '';
var ConvDesc = '';
var ConvSubTotal = '';
var ConvTax = '';
var ConvTotal = '';
var ConvMisc1 = '';
var ConvMisc2 = '';
var ConvMisc3 = '';
var ConvMisc4 = '';
var ConvMisc5 = '';

function VisiStatConv() {
	
	ConvSubTotal = ConvSubTotal.replace("$", "");
	ConvTax = ConvTax.replace("$", "");
	ConvTotal = ConvTotal.replace("$", "");
	
	var rand = Math.random();
	sniffer = new Image(); 
	sniffer.src = 'http:\/\/stats.visistat.com\/conversion.php?DID='+DID+'&ConvName='+ConvName+'&MyID='+MyID+'&ConvDesc='+ConvDesc+'&ConvSubTotal='+ConvSubTotal+'&ConvTax='+ConvTax+'&ConvTotal='+ConvTotal+'&ConvMisc1='+ConvMisc1+'&ConvMisc2='+ConvMisc2+'&ConvMisc3='+ConvMisc3+'&ConvMisc4='+ConvMisc4+'&ConvMisc5='+ConvMisc5+'&r='+rand;

}

function eclVisiStatConv(name, vehicle_id, first, last)
{
	ConvName = name;
	ConvMisc1 = vehicle_id;
	ConvMisc1 = first+' '+last;
	VisiStatConv();
}