// This function is used to set cookies */
function setCookie(name, value, expires, path, domain, secure) {
document.cookie = name + "=" + escape (value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
}
// This function is used to get cookies */
function getCookie(name) {
var prefix = name + "=";
var start = document.cookie.indexOf(prefix)
if (start == -1) {
	return null;
	}
var end = document.cookie.indexOf(";", start + prefix.length);
if (end == -1) {
	end = document.cookie.length;
	}
var value = document.cookie.substring(start + prefix.length, end);
return unescape(value);
}
// This function is used to delete cookies */
function deleteCookie(name, path, domain) {
if (getCookie(name)) {
	document.cookie = name + "=" + ((path) ? "; path=" + path : "") +
	((domain) ? "; domain=" + domain : "") +
	"; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}
// This function gets the expiration date */
function getExpirationDate(mins) {
var futdate = new Date();
var expdate = futdate.getTime();
expdate += mins * 60 * 1000 ; 
futdate.setTime(expdate);
return futdate;
}
// Check cookie and redirect as necessary */
function checkCookiePreStitial() {
var preAd ="prestitial";
var showprestitial = getCookie(preAd);
// The cookie is not set, so show prestitial
if (showprestitial == null) {
	var loc = window.location.host;
	if (loc.indexOf(".") != -1) {
		loc = loc.substr(loc.indexOf("."));
		}
	// Set value in cookie to show prestitial every 60 minutes.
	setCookie(preAd, "1", getExpirationDate(60), "/");
	setCookie(preAd, "1", getExpirationDate(60), "/", loc);
	}
// Don't show the prestitial
else {
	window.location = "http://" + window.location.host + "/do/home";
	}
}
checkCookiePreStitial();

// This function does nothing.  It exists to accomodate UGO code.
// Call James Boyaca for details
function returnToRequestedPage(){
 // do nothing
}
 


