

function pageVisit(clientID)
{
	this.pagesource = location.href;	
	this.clientid = clientID;
	this.track = null;
	
	//alert(location.href);
	
	this.initTrack = function () {
		recordVisit(this.pagesource, this.clientid, this.track);
	};
}

function recordVisit(url,clientID, sessionTrack)
{
	
	//var formaturl = url;
	//formaturl.replace("&","{AMP}")
	//formaturl.replace("-","{MINUS}")
	//formaturl.replace("+","{PLUS}")
	//formaturl.replace("=","{EQUALS}")
	//formaturl.replace("_","{UNDERSCORE}")
	//formaturl.replace(",","{COMMA}")
	//formaturl.replace("?","{QUESTIONMARK}")
	//formaturl.replace("/","{FORWARDSLASH}")
	//formaturl.replace(":","{SEMICOLON}")
	//formaturl.replace(".","{FULLSTOP}")
	
	if (window.XMLHttpRequest)
	{
		// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else
	{
		// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			//alert(xmlhttp.responseText);
		}

	}

	xmlhttp.open("POST","http://www.cottrillsreward.com/tracker/track.asp",true);
	xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	xmlhttp.send("pageUrl='" + url + "&client=" + clientID + "&tracker=" + sessionTrack);
	
	//alert(url);
	//alert(clientID);
	//alert(sessionTrack);

}
