/********************************************************************************************************/
/***                     version 1.0 updated by Michael Ratliff January 23, 2001                      ***/
/********************************************************************************************************/

/********************************************************************************************************/
/***                                           cookie functions                                       ***/
/********************************************************************************************************/
function cookieEnabled(){
	document.cookie="cookie=yes"
	if (document.cookie==""){
		return false
	}else{
		document.cookie="cookie=yes;expires=Fri,13-Apr-1970 00:00:00 GMT"
		return true
	}
}

function putCookie(name,value,expire){
	// The following block of code gets the default path (current directory)
	// and explicitly sets it in the cookie.  This fixes a MSIE 5.0 MacOS bug
	var pathName = location.pathname
	var end = pathName.lastIndexOf('/')
	if(end != -1) pathName=pathName.substr(0,end)
	
	document.cookie = name+"="+escape(value)+((expire==null) ? "" : (";expires="+expire.toCookieDate()))+";path="+pathName	
}

function getCookie(name){
	var firstChar, lastChar
  	var theCookie=document.cookie
  	if (theCookie.length>0){												// if there are any cookies
		firstChar=theCookie.indexOf(name+"=")								// find name in cookie
		if (firstChar != -1){												// if name is in cookie
			if (firstChar==0 || theCookie.charAt(firstChar-1)==" "){		// if name is cookie name
				firstChar+=name.length+1  									// beginning of named cookie
				lastChar=theCookie.indexOf(";",firstChar) 					// end of named cookie
				if (lastChar==-1){lastChar=theCookie.length}
				return unescape(theCookie.substring(firstChar,lastChar))	// return cookie value
			}			
		}
	}
}

function deleteCookie(name){
	var cookie=this.getCookie(name)
	if (cookie!=null){
		document.cookie=name+"="+escape(cookie)+";expires=Fri, 13-Apr-1970 00:00:00 GMT"
	}
}
