<!--
// do not remove this section of oCookie since it will widely use across the site
// index.cfm, login.cfm, login.html
oCookie = {};
if (document.cookie && document.cookie !=""){
	
	var whole_cookie = unescape(document.cookie);
	var each_cookie = whole_cookie.split("; ");
	
	var myCookie = "";
	for (i=0; i<each_cookie.length; i=i+1) {
		myCookie = each_cookie[i].split("=");
		oCookie[myCookie[0]] = myCookie[1];
	}
}

// name - name of the cookie
// value - value of the cookie
// [expires] - expiration date of the cookie (defaults to end of current session)
// [path] - path for which the cookie is valid (defaults to path of calling document)
// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds
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";
  }
}



//
//  Function to correct for 2.x Mac date bug.  Call this function to
//  fix a date object prior to passing it to SetCookie.
//  IMPORTANT:  This function should only be called *once* for
//  any given date object!  See example at the end of this document.
//
function fixCookieDate (date) {
	var base = new Date(0);
	var skew = base.getTime(); // dawn of (Unix) time - should be 0
	if (skew > 0)  // Except on the Mac - ahead of its time
		date.setTime (date.getTime() - skew);
}

// cookiename = name of the cookie
// purpose: set the cookie value to NEVER_DISPLAY, use with pop-up ads and allow user to select not to show again
function neverShowCookie (cookiename, domain, winclose) {
	// get the current date
	var expdate = new Date();
	// Correct for Mac date bug - call only once for given Date object!			
	fixCookieDate (expdate); 
	// set the date to 365 days from now.
	expdate.setTime (expdate.getTime() + (365 * 24 * 60 * 60 * 1000)); 
	// Set the cookie to never display ever again.  
	// "/" = path
	// "/" = domain
	// It's important that the domain be the same for this cookie in all the places that we set it.			
	setCookie(cookiename, "NEVER_DISPLAY", expdate, "/", domain);
	
	if (winclose)	window.close();
}

// -->