// Function 
//	
function SetCookie(name, value, expires)
{
	var c = name + "=" + value + "";

	var d;
	
	if(typeof(expires) == "number")
	{
		d = new Date();
		d.setTime(d.getTime() + 1000*60*60*24 * expires)
	}
	else if (typeof(expires) == "date")
		d = expires;
		
	if(d)
		c = c + "; expires=" + d.toGMTString();
		
	c = c + "; path=/"
	
	document.cookie = c;	
}

// Function 
//	
function GetCookie(name, defaultValue, create, days)
{
	var value = ((typeof(defaultValue) == "undefined")? null : defaultValue);
	
	var ac, c,p;
	var found = false;
	
	ac = document.cookie.split(';');
	
	for(var i=0; i<ac.length; i++)
	{
		c = ac[i];
		
		while(c.substr(0,1) == ' ')
			c = c.substr(1);
		
		p = c.indexOf('=');
		
		if(p != -1 && c.substr(0,p) == name)
		{
			value = c.substr(p+1);
			found = true;
			
			break;	
		}
	}
	
	if(!found && typeof(defaultValue) != "undefined" && create)
		SetCookie(name, defaultValue, days);
		
	return value;	
}


