function cookthem(chapt,thm){
var i=parseInt(thm)+1
var cook=chapt+"themes"
if (!get_cookie(cook)) {
document.cookie= cook + "=OONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNO" + "; path=/";
}
var chaptthemestring=get_cookie(cook)
var value=chaptthemestring.slice(i,i+1)
if (value=="N") {
var newstring=chaptthemestring.slice(0,i) + "Y" + chaptthemestring.slice(i+1)
document.cookie= cook + "=" + newstring+ "; path=/";
}
}


function cookans(chapt,ans){
var i=parseInt(ans)+1
var cook=chapt+"ans"
if (!get_cookie(cook)) {
document.cookie= cook + "=OONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNO" + "; path=/";
}
var chaptansstring=get_cookie(cook)
var value=chaptansstring.slice(i,i+1)
if (value=="N") {
var newstring=chaptansstring.slice(0,i) + "Y" + chaptansstring.slice(i+1)
document.cookie= cook + "=" + newstring+ "; path=/";

}
}

//Get cookie routine by Shelley Powers 
function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    // if cookie exists
    if (offset != -1) { 
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1) end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}

