/* 
 * SmallCookieLib
 */ 

function setCookie(key, value, exp_in_days) {
	var expires = "";
	var d = new Date();
	d.setTime(d.getTime() + (exp_in_days * 24 * 60 * 60 * 1000));
	expires = "expires=" + d.toGMTString();
	document.cookie = key + "=" + value + "; " + expires +"; path=/";
}

function getCookie(key) {
	var re = new RegExp("(\;|^)[^;]*(" + key + ")\=([^;]*)(;|$)");
	var c = document.cookie;
	if(c) {
		var match = re.exec(c);
		if(match != null) {
			//if(debugPlayCount) alert("getCookie: 1:'" + match[1] + "' 2:'" + match[2] + "' 3:'" + match[3] + "' cookie:'"+ document.cookie + "'");
			return match[3];
		}
	}
	return null;
}

function clearCookie(key) {
	setCookie(key, '', -1);
}
