function getTPPCookie()
{
	var c_name = 'tppcheck';
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
}

function setTPPCookie()
{
	
document.cookie = "tppcheck=checked;expires=01/01/2023 00:00:00";
}

function checkTPPcookie()
{
var varAlert;
cookieCheck=getTPPCookie();
if (cookieCheck!=null && cookieCheck!="")
  {
	return true;
  }
  else 
  {
	varAlert = confirm("If this is your first time using the appointments booking system or the Repeat prescription system, you will need a Username and Password issued by the practice. \n\nIf you have a Username / Password then click OK to continue. \n\nIf you do not then click CANCEL and contact the practice to be registered for this service.")
	if (varAlert){
        setTPPCookie();
		return true;
	}
	else{
		return false;
	}
  }
}
