//used on our Splash pages to implement "counting functionality"
function splashForward (cookieName, targetURL, maxCount, redirect, step) { 
	step = step || 1;
	redirect = redirect || false;
	var splashed = parseInt(readCookie(cookieName)) || 0;
	if(redirect) {	if (splashed < maxCount) document.location = targetURL; }
	else { (splashed < maxCount) ? createCookie(cookieName, splashed + step) : document.location = targetURL; }
}
function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}
function createCookie(name,value) {
	setcookie(name,value) //temporary fix used on switcher
}
function setcookie(name,value){
	cookiestring=name+"="+escape(value)+";EXPIRES="+ getexpirydate(365)+";PATH=/";
	document.cookie=cookiestring;
}
function getexpirydate(nodays){
	var UTCstring;
	Today = new Date();
	nomilli=Date.parse(Today);
	Today.setTime(nomilli+nodays*24*60*60*1000);
	UTCstring = Today.toUTCString();
	return UTCstring;
}

