<script>
function parseCookie() {
var cookieList = document.cookie.split("; ");
var cookieArray = new Array();
for (var i = 0; i < cookieList.length; i++) {
var name = cookieList[i].split("=");
cookieArray[unescape(name[0])] = unescape(name[1]);
}
return cookieArray;
}
function setCookie(visits) {
var expireDate = new Date();
var today = new Date();
expireDate.setDate(1 + expireDate.getDate());
document.cookie = "Visits=" + visits + "; expires=" +
expireDate.toGMTString() + ";";
}
function setGo(vis) {
if (vis == 2) document.location.href="index2.html";
if (vis >= 3) document.location.href="index3.html";
if (vis >= 4) document.location.href="index4.html";
}
var cookies = parseCookie();
if (cookies.Visits) {
cookies.Visits++
setCookie(cookies.Visits);
setGo(cookies.Visits);
} else {
setCookie(1);
}
</script>