//create the cookie

function createCookie(name, value, expiredays)	{
  var todayDate = new Date();
  todayDate.setDate(todayDate.getDate() + expiredays);
  document.cookie = name + "=" + value + "; expires=" + todayDate.toGMTString() + ";"
}

//read the cookie and get the varnavpopup value

function ReadCookie(cookiename)	{
  var numOfCookies = document.cookie.length;
  var nameOfCookie = cookiename + "=";
  var cookieLen = nameOfCookie.length;
  var x = 0;
  while (x <= numOfCookies) {
	var y = (x + cookieLen);
	if (document.cookie.substring(x, y) == nameOfCookie)
	   return(extractCookieValue(y));
	x = document.cookie.indexOf(" ", x) + 1;
	if (x == 0)
	   break;
  }
  return "Yes";
}

function extractCookieValue(val) {
  if ((endOfCookie = document.cookie.indexOf(";", val)) == -1) {
     endOfCookie = document.cookie.length;
  }
  return unescape(document.cookie.substring(val, endOfCookie));
}

//open the popup
function returnvalue() {
  varpopup = ReadCookie("NavPopUp");
  if (varpopup == "Yes") {
     popupwindow('../policies/copyright.html','copyright','width=300,height=200, location=no, toolbar=no, menubar=no, scrollbars=no, resizable=yes');
  }
}

//delete the cookie

function deleteCookie(name)	{
  var todayDate = new Date();
  todayDate.setDate(todayDate.getDate() - 1);
  document.cookie = name + "=" + "; expires=" + todayDate.toGMTString() + ";"
}
