
// ****************************************************************
// ** Copyright 2007 Northern Rhode Island Animal Hospital - All Rights Reserved.	
// ****************************************************************


// set the cookie across directories
function setCookie(cookieName, value) 
{
	var the_cookie = cookieName + "=" + escape(value) + ";" ;
	var the_cookie = the_cookie + "path=/;";
	document.cookie = the_cookie;
}



// set the cookie with expiration (not across directorys)
function setCookie(cookieName, value, expireminutes) {
	if ((cookieName.length>0) && (value.length>0)) {
		var ExpireDate = new Date ();
  		ExpireDate.setTime(ExpireDate.getTime() + (expireminutes * 60 * 1000));
  		document.cookie = cookieName + "=" + escape(value) + ((expireminutes == null) ? "" : "; expires=" + ExpireDate.toGMTString());
	} else {
		return "";  
	}
}



// get the cookie
function getCookie(cookieName)  {
	if (document.cookie.length > 0) { 
	    begin = document.cookie.indexOf(cookieName+"="); 
    	if (begin != -1)  { 
			begin += cookieName.length+1; 
      		end = document.cookie.indexOf(";", begin);
      		if (end == -1) end = document.cookie.length;
      			return unescape(document.cookie.substring(begin, end));       
		} 
	} else {
		return "";  
	}
} 

// wipe out cookie, if not found show a message
function delCookie(cookieName) {
	document.cookie = cookieName + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}