function GenTime(n) {
	var today = new Date(); 
	today.setTime( today.getTime() ); 
	n = n * 1000 * 60 * 60 * 24;  
	return new Date( today.getTime() + (n) ); 
}

function GetCookie (Name) {
    var CookName = Name + "=" ;
    var DocCook  = document.cookie ;
      if (DocCook.length > 0) {
        Start = DocCook.indexOf(CookName) ;
        if (Start != -1) {
           Start += CookName.length ;
           End = DocCook.indexOf(";",Start) ;
           if (End == -1) End = DocCook.length ;
           return unescape(DocCook.substring(Start, End)) ;
        }
     }
    return null;
}

function SetCookie (name, value) {
    var argv = SetCookie.arguments;
    var argc = SetCookie.arguments.length;
    var expires = (argc > 2) ? argv[2] : null;
    var path = (argc > 3) ? argv[3] : null;
    var domain = (argc > 4) ? argv[4] : null;
    var secure = (argc > 5) ? argv[5] : false;
    document.cookie = name + "=" + escape (value) +
    ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
    ((path == null) ? "" : ("; path=" + path)) +
    ((domain == null) ? "" : ("; domain=" + domain)) +
    ((secure == true) ? "; secure" : "");
}

function DelCookie (name, path,domain) {
    if (GetCookie(name) == null) return;
    document.cookie = name+"="+";expires=Thu,01-Jan-70 00:00:01 GMT"+
    ((path)? ";path="+path:"")+
    ((domain)?";domain="+domain:"")
}