/*
 *
 */
function Cookie_put(name, value, lifeMilliseconds, lifePath)
{
	var cookieCode = name + "=" + value;
	
	if (lifeMilliseconds != null)
	{
		var date = new Date();
		date.setTime(date.getTime()+lifeMilliseconds);
		cookieCode += "; expires=" + date.toGMTString();
	}
	
	if ((lifePath != null) && (lifePath.length > 0))
		cookieCode += "; path=" + lifePath;

	document.cookie = cookieCode; 
}

/*
 *
 */
function Cookie_get(name)
{
	var tmp, index ;
	
	var nameValuePairs = document.cookie.split(';');
	
	for(var i=0; i<nameValuePairs.length; i++)
	{
		var tmp = nameValuePairs[i];
		index = tmp.indexOf("=");
		if (index >= 0)
		{
			var str=tmp.substring(0,index)
			str = str.replace(/^\s*|\s*$/g,"");
 			if (str == name)
			{
				if (index < tmp.length-1)
					return tmp.substring(index+1);
				else
					return null;
			}
		}
	}
	
	return null;
}

/* 
 *
 */
function Cookie_delete(name)
{
	Cookie_put(name, "", -1);
}