/*
 * wspTrack - Cache WSP landing page details, which are retrieved by contact forms.
 *
 * Created: 21 Jun 07 - Ward Clark
 * Modified:
 *   10 Jul 07 - Ward - Fix "source" argument.
 */
var cookie = new CJL_CookieUtil("visitordata", 60*24*365, "/");  // 1 year

function wspTrack() {
	var args = getArgs();  // Parse args from URL
	var pages = parseInt(cookie.getSubValue("pages") || 0);
	
	// Update the landing page tracking if a source is specified.
	if ( args.source ) {
		cookie.setSubValue("source", args.source);
		cookie.setSubValue("landing", location.pathname);
	}
	
	// Count the pages the visitor has seen.
	cookie.setSubValue("pages", pages+1);
}

function wspReport() {
	document.write('<input type="hidden" name="Source" value="' + cookie.getSubValue("source") + '">');
	document.write('<input type="hidden" name="Landing_page" value="' + cookie.getSubValue("landing") + '">');
	document.write('<input type="hidden" name="Pages_visited" value="' + cookie.getSubValue("pages") + '">');
}