<!--

// functions.js

function setCookie (name, value, expires) {
  if (!expires) expires = new Date();
  if (expires == "discard") {
    document.cookie = name + "=" + escape (value) + "\; discard\; path=/";
  }
  else {
    document.cookie = name + "=" + escape (value) + "\; expires=" + expires.toGMTString() +  "\; path=/";
  }
}                                                       



function getCookie (name) {
  var dcookie = document.cookie;
  if (dcookie == null) return null;
  var cname = name + "=";
  var clen = dcookie.length;
  var cbegin = 0;
  while (cbegin < clen) {
    var vbegin = cbegin + cname.length;
    if (dcookie.substring(cbegin, vbegin) == cname) { 
      var vend = dcookie.indexOf (";", vbegin);
      if (vend == -1) vend = clen;
      return unescape(dcookie.substring(vbegin, vend));
    }
    cbegin = dcookie.indexOf(" ", cbegin) + 1;
    if (cbegin == 0) break;
  }
}


// give expdate a date to persist or assign "discard" to value to kill it after browser session
function setExpDate(days) {
 var expdate = new Date ();
 // set days to number of days to keep cookie
 // set days to 0 for discard
 if (! days) {
  expdate = "discard";
 }
 else {
  expdate.setTime (expdate.getTime() + (1000 * 60 * 60 * 24 * days));
 }

 return expdate;

}


function doReload() {

 // handle NS4 bug of calling a resize event upon reloading
 if(document.layers) {
   setTimeout('window.location.reload()', 1000);
 }
 else {
  window.location.reload();
 }

}


function closeWindow() {

 if (window.opener) window.opener.focus();
 window.close();

}


function mImages() {

 window.open('/mummification/images/splash.php', 'Images', 'menubar=no,toolbar=no,location=no,directories=no,scrollbars=no,status=no,top=0,left=0,resizable=yes');

}


function showImage(t, i, w, h) {

 if ( !(typeof(pic) == "undefined") && !pic.closed ) {
  pic.close();
 }

 pic = window.open('', 'Picture', 'menubar=no,toolbar=no,location=no,directories=no,scrollbars=no,status=no,width=' + w + ',height=' + h + ',resizable=yes');

 pic.focus();

 pic.document.open();
 with (pic.document) {
   write('<html><head><title>' + t + '</title></head>');
   write('<body bgcolor="#000000" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">');
   write('<img src="' + i + '" width="' + w + '" height="' + h + '" alt="" /><br />');
   write('</body></html>');
 }
 pic.document.close();

}

// -->
