	var hp_ctDir = 'hp'; // set this to the name of the PHP counter directory
	var hp_intSecs = 30; // set this to time interval in seconds
	var hp_maxTime = 500; // set this to maximum tracking time in seconds
    if (typeof(hp_PageName) == 'undefined') {
        var hp_PageName = window.location.href.split('?').shift().split('/').pop(); // or set to explicit page name for more accuracy
    }
	var hp_intervalID;
	
	var hp_intCurr = 0;
	var hp_ajaxReq;

	function hp_ajaxLogInt(jCurrTime) {
		hp_ajaxReq.open("GET", hp_ctDir + '/waider.php?li0=intElapsed&vi0=' + jCurrTime + '&lt0=page&vt0=' + hp_PageName, true);
		hp_ajaxReq.send(null);
		return true;
	}
	function hp_logInterval() {
		var jCurrTime = hp_intCurr * hp_intSecs;
		try{
			// Opera 8.0+, Firefox, Safari
			hp_ajaxReq = new XMLHttpRequest();
			hp_ajaxLogInt(jCurrTime);
		} catch (e){
			try{
				// everyone else, look for image named hp_logIntImg
				// if hp_logIntImg is not present, add it to the body using DOM
				if (document.images.hp_logIntImg == undefined) {
					var jimg = document.createElement('img');
					jimg.setAttribute('name','hp_logIntImg');
					jimg.setAttribute('src',hp_ctDir + '/spacer.gif');
					jimg.setAttribute('width','1');
					jimg.setAttribute('height','1');
					document.appendChild(jimg);
				}
				document.images.hp_logIntImg.src = hp_ctDir + '/waider.php?tuniq='  + new Date().getTime() + '&return_image=1&li0=intElapsed&vi0=' + jCurrTime + '&lt0=page&vt0=' + hp_PageName;
			} catch (e){
				// img is not present and can't be added, so try IE activeX objects
				try{
					hp_ajaxReq = new ActiveXObject("Msxml2.XMLHTTP");
					hp_ajaxLogInt(jCurrTime);
				} catch (e) {
					try{
						hp_ajaxReq = new ActiveXObject("Microsoft.XMLHTTP");
						hp_ajaxLogInt(jCurrTime);
					} catch (e){
						// all have failed, so give up
						return false;
					}
				}
			}
		}
		if (jCurrTime >= hp_maxTime) { clearInterval(hp_intervalID); }
		hp_intCurr++;
	}
	
	hp_intervalID = setInterval('hp_logInterval()', hp_intSecs * 1000); 
	hp_logInterval(); // log the first one = 0
