function loadPref() 
{
var allcookies = document.cookie;

if (allcookies == "") return false;

var start = allcookies.indexOf("worddict=", 0);
if (start == -1) return false;
start += 9;
var end = allcookies.indexOf(';', start);
if (end == -1) end = allcookies.length;

var cookieval = allcookies.substring(start, end);

var a = cookieval.split('&'); // break into name/value pairs
var prefhash = new Object();
for (var i=0; i < a.length; i++) { 
  a[i] = a[i].split(':');
  prefhash[a[i][0]] = a[i][1];
}

document.lookup.searchtype.selectedIndex = prefhash["searchtype.selectedIndex"];
document.lookup.where.selectedIndex = prefhash["where.selectedIndex"];
if (prefhash["output.checked"] == "true") {
   document.lookup.output.checked = true;
}
else if (prefhash["output.checked"] == "false") {
   document.lookup.output.checked = false;
}

return true;
}


function savePref() 
{
var cookieval = "";

cookieval = "searchtype.selectedIndex:" + document.lookup.searchtype.selectedIndex + '&';
cookieval += "output.checked:" + document.lookup.output.checked + '&';
cookieval += "where.selectedIndex:" + document.lookup.where.selectedIndex;


var cookie = 'worddict=' + cookieval;
var today = new Date();
var expiry = new Date(today.getTime() + 28 * 24 * 60 * 60 * 1000); // plus 28 days
cookie += "; expires=" + expiry.toGMTString();
cookie += "; path=/";
document.cookie = cookie;

}



