


function GetMemoLength(){
	var MemoCookie = GetCookie('Memo');
	if(MemoCookie){
		var CurrentList = MemoCookie.split(';');
		document.write(CurrentList.length);
	} else {
		document.write(0);
	}
}


function SetMemoLength(){
	var MemoLength = document.getElementById('MemoLengthContainer');
	var MemoCookie = GetCookie('Memo');
	var Length = 0;
	if(MemoCookie){
		var CurrentList = MemoCookie.split(';');
		Length = CurrentList.length;
	}
	if(MemoLength){
		if(Length == '') { Length = 0 }
		MemoLength.innerHTML = Length;
	}
}


function AddMemoItem(Path){	
		var MemoCookie = GetCookie('Memo');				
		SetCookie('Memo', Path, SetDate(), false);		
	}	
 	
 	function GetMemoPath(){
 	   var MemoCookie = GetCookie('Memo');	
		return MemoCookie;
	}


function SetCookie(name, value, expires, isSecure) {
	var CurrentCookie = name + '=' + escape(value) + '; path=/' +
	((expires) ? '; expires=' + expires.toGMTString() : '') +
	((isSecure) ? '; secure' : '');
	document.cookie = CurrentCookie;
}

function GetCookie(name) {
	var Cookie = document.cookie;
	var Prefix = name + '=';
	var Begin = Cookie.indexOf('; ' + Prefix);
	if (Begin == -1) {
		Begin = Cookie.indexOf(Prefix);
		if (Begin != 0) return null;
	} else {
		Begin += 2;
	}
	var End = document.cookie.indexOf(';', Begin);
	if (End == -1)
		End = Cookie.length;
	return unescape(Cookie.substring(Begin + Prefix.length, End));
}

function DeleteCookie(name) {
	if (GetCookie(name)) {
		document.cookie = name + '=' + 
		'; expires=Thu, 01-Jan-70 00:00:01 GMT';
	}
}
	
function SetDate(){
	var CurrentDate = new Date();
	RepairDate(CurrentDate);
	return new Date((CurrentDate.getTime() + 365*1000*60*60*24));
}

function RepairDate(date) {
	var Base = new Date(0);
	var Skew = Base.getTime();
	if (Skew > 0)
		date.setTime(date.getTime() - Skew);
}
