function getCookie(key){
	var cookstr="; "+document.cookie+";";
	var startIndex=cookstr.indexOf("; "+key+"=");
	if(startIndex==-1) return "";
	startIndex+=key.length+3;
	cookstr=cookstr.substring(startIndex,cookstr.indexOf(";",startIndex));
	return cookstr;
}
function setCookie(key,value,expDay,path){
	var cookstr=key+"="+value;
	if(expDay){
		var exp=new Date();
		exp.setTime(exp.getTime() + expDay * 86400000);
		cookstr+=";expires="+exp.toGMTString();
	}
	cookstr+=";path="+(path==undefined?'/':path);
	document.cookie=cookstr;
}
function deleteCookie(key){
	var exp=new Date();
	exp.setTime(exp.getTime() - 1);
	document.cookie=key+"=;expires="+ exp.toGMTString();
}