/**
	$Id:$
*/

function cookieControl() {

	this.name = "";
	this.value = "";
	this.dir = "";
	this.expires = "";

	this.setName = setName;
	this.setValue = setValue;
	this.setDirectory = setDirectory;
	this.setExpires = setExpires;
	this.setCookie = setCookie;
	this.getCookie = getCookie;
	this.deleteCookie = deleteCookie;

	function setName() {
		this.name = arguments[0];
	}
	function setValue() {
		this.value = arguments[0];
	}
	function setDirectory() {
		this.dir = arguments[0];
	}
	function setExpires() {
		this.expires = arguments[0];
	}

	function setCookie() {
		this.exp = new Date();
		if (this.expires != "") this.exp.setTime( this.exp.getTime() + (1000*60*60*24*this.expires) );
		document.cookie = this.name + "=" + escape(this.value) + ";path=" + this.dir + ( (this.expires == "") ? "" : (";expires=" + this.exp.toGMTString()) );
	}
	function getCookie() {
		this.cname = this.name + "=";
		if ( document.cookie.length > 0 ) {
			this.start = document.cookie.indexOf(this.cname);
			if ( this.start != -1 ) {
				this.start += this.cname.length;
				this.terminus = document.cookie.indexOf(";",this.start);
				if ( this.terminus == -1 ) this.terminus = document.cookie.length;
				return unescape( document.cookie.substring(this.start,this.terminus) );
			}
		} else {
			return false;
		}
	}
	function deleteCookie() {
		document.cookie = this.name + "=;expires=Thu,01-Jan-70 00:00:01 GTM";
	}
}
