if(!Stilleye) var Stilleye = {};

Stilleye.Cookie =
{
	set : function(name,value,days,path)
	{
		var ex = "";
		if(days)
		{
			var d = new Date();
			d.setTime(d.getTime()+(days*24*60*60*1000));
			ex = "; expires="+d.toGMTString();
		}
		path = path ? path : "/";
		document.cookie = name + "=" + escape(value) + ex + "; path=" + path;
	},
	
	get : function(name)
	{
		var c = document.cookie.split(';');
		var wh = name + '=';
		for(i=0;(j=c[i]);i++)
		{
			while(j.charAt(0)==' ') j = j.substring(1, j.length);
			if(j.indexOf(wh)==0) return unescape(j.substring(wh.length));
		}
		return null;
	},
	
	setLong : function(name,pairs,days,path)
	{
		var value, i = 0, j, k;
		value = new Array();
		for(i=0; j = pairs[i], k = pairs[i+1]; i+=2)
		{
			value.push(j + "=" + k);
		}
		value = value.join("&");
		Stilleye.Cookie.set(name,value,days,path);
	},
	
	getLong : function(name)
	{
		var unparsed, parsed, pairs = new Array(), i;
		unparsed = Stilleye.Cookie.get(name);
		if(!unparsed) return null;
		parsed = unparsed.split(/&|=/g);
		for(i=0; i<parsed.length; i+=2)
			pairs[parsed[i]] = parsed[i+1];
		return pairs;
	},
	
	kill : function(name) { Stilleye.Cookie.set(name,'',-1); }
}

