function Cookie(name, path)
{
	var value = "";
	var thisObject = this;
	
	if(document.cookie)
	{
		var cookies = document.cookie.split(";");
		for(var i = 0; i < cookies.length; i++)
		{
			var cookiemeta = cookies[i].split("=");
			if(cookiemeta[0].trim() == name)
				value = cookiemeta[1];
		}
	}
	
	this.setValue = function(pvalue)
	{
		document.cookie = name + "=" + pvalue + "; path=" + path;
	}
	
	this.setValues = function(values)
	{
			var tmp = "";
			for(var i=0; i < values.length; i++)
			{
				if(tmp.length == 0)
					tmp += values[i];
				else
					tmp += "$" + values[i];
			}

			thisObject.setValue(tmp);
	}
	
	this.addValue = function(pvalue)
	{
		if(value != null && value.length > 0)
			document.cookie = name + "=" +value + "$" + pvalue + "; path=" + path;
		else
			document.cookie = name + "=" + pvalue + "; path=" + path;
	}
	
	this.addValueOnce = function(pvalue)
	{
		if(value.indexOf(pvalue) < 0)
		{
			thisObject.addValue(pvalue);
			return true;
		}
		else
			return false;
	}
	
	this.replaceValue = function(oldvalue, newvalue)
	{
		if(thisObject.containsValue(oldvalue))
		{
			value = value.replace(oldvalue, newvalue);
			thisObject.setValue(value);
		}
	}
	
	this.getValue = function()
	{
		return value;
	}
	
	this.getValues = function()
	{
		return value.split("$");
	}
	
	this.containsValue = function(pvalue)
	{
		var values = thisObject.getValues();
		
		for(var i=0; i < values.length; i++)
		{
			if(values[i] == pvalue)
				return true;
		}
		
		return false;
	}
	
	this.containsValueRegex = function(regexstr)
	{
		var regex = new RegExp(regexstr);
		var values = thisObject.getValues();
		
		for(var i=0; i < values.length; i++)
		{
			if(values[i].match(regex))
				return true;
		}
		
		return false;
	}
	
	this.deleteValue = function(pvalue)
	{
		value = value.replace(pvalue, "");
		value = value.replace("$$", "$");
		
		if(value.indexOf("$") == 0)
			value = value.substring(1);
		
		if(value.lastIndexOf("$") == (value.length - 1))
			value = value.substring(0, value.length - 1);
		
		thisObject.setValue(value);
	}
}