function makeCookie(Name,Value,Expiry,Path,Domain,Secure) {
   //Bunch of arguments

 if (Expiry != null && !isNaN(Expiry)) {
   //if you want to save the cookie

  var datenow = new Date();
   //get a date

  datenow.setTime(datenow.getTime() + Math.round(86400000*Expiry));
   //mutiply the number to make it represent days

  Expiry = datenow.toGMTString();
   //convert to GMT time

 }
   //ends that. And now...

 Expiry = (Expiry) ? '; expires='+Expiry : '';
   //has an expiration?

 Path = (Path)?'; path='+Path:'';
   //has a path?

 Domain = (Domain) ? '; domain='+Domain : '';
   //has a domain?

 Secure = (Secure) ? '; secure' : '';
   //Secure?

 document.cookie = Name + '=' + escape(Value) + Expiry + Path + Domain + Secure;
   //Make the cookie!
}

function readCookie(Name) {
   //Your name goes here!

 var cookies = ' ' + document.cookie;
   //Copy your cookies

 if (cookies.indexOf(' ' + Name + '=') == -1) return null;
   //Whoops, no cookie!

 var start = cookies.indexOf(' ' + Name + '=') + (Name.length + 2);
   //Jump to start of cookie

 var finish = cookies.substring(start,cookies.length);
   //Get a count from the cookies

 finish = (finish.indexOf(';') == -1) ? cookies.length : start + finish.indexOf(';');
   //Find end of cookie

 return unescape(cookies.substring(start,finish));
   //Here's your cookie! ( Sorry, no chocolate chips. :-)

}

