// STORE THE PREVIOUS PAGE IN THE COOKIE


// create an instance of the future Date object
var now = new Date();
now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);

var previous = getCookie("previous");
var current = getCookie("current");
var newcurrent = getURL();

// if the cookie wasn't found, this is your first visit
if (!current) {
	current = getURL(); // the value for the new cookie
	setCookie("current", current, now);
} else {
	if ( newcurrent != current ) {
		doit();
	} 
} 

window.status = "Previous page: " + previous;

function getURL() {
	var result;
	result = document.title + "\r<br>\r" + document.location;
	return result;
}

// Shuffle current to previous.
function doit() {
	previous = current;
	current = getURL();
	setCookie("current", current, now);
	setCookie("previous", previous, now);
}