function getCookie (sName) {
	var sRE="(?:;)?"+sName+"=([^;]*);?";
	var oRE=new RegExp(sRE);
	if (oRE.test(document.cookie)){
		return decodeURIComponent(RegExp["$1"]);
	}else{
		return null;
	};
}
function setCookie(sName,sValue,nDays,sPath,sDomain,bSecure) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) {nDays=1;}
 expire.setTime(today.getTime() + 3600000*24*nDays);
 var sCookie=encodeURIComponent(sName)+"="+encodeURIComponent(sValue);
 if(expire){sCookie+=";expires="+expire.toGMTString();}
 if(sPath){sCookie+=";path="+sPath;}
 if(sDomain){sCookie+=";domain="+sDomain;}
 if(bSecure){sCookie+=";secure";}
 document.cookie=sCookie;
}