<!--

// 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
var expdate = new Date ();
// set days to number of days to keep cookie
var days = 1;
expdate.setTime (expdate.getTime() + (1000 * 60 * 60 * 24 * days));
expdate = "discard";

function consent() {

  var approve = getCookie("consent");
  if (approve == null) {
    giveWarning();
  }

}







playerStatus = new Array();
playerStatus[0] = "Stopped";
playerStatus[1] = "Contacting";
playerStatus[2] = "Buffering Audio";
playerStatus[3] = "Playing";
playerStatus[4] = "Paused";
playerStatus[5] = "Seeking";

message = null;

function play(playit) {

  if (playit == "clip") {
    document.AudioClip.DoPlayPause();
  }
  else {
    var play = getCookie(playit);
    if (play == null) {
      document.AudioClip.DoPlay();
      setCookie (playit, "no", expdate);
    }
  }

  winMsg();

}

function winMsg() {

  playState = document.AudioClip.GetPlayState();

  if (playState == 0) {
    window.status = " ";
    clearTimeout(message);
  }
  else {
    window.status = playerStatus[playState] + "...";
    message = setTimeout("winMsg()", 10);
  }


}

function musicPlayer() {

 player = open('/holidays/christmas/xmas.html', 'Initialize', 'menubar=no,toolbar=no,location=no,directories=no,scrollbars=no,status=no,width=288,height=335');
}



var img = "/images/gif/nebula.gif";
var imgAlt = "Cat\'s Eye Nebula";
var url = window.location.href.toLowerCase();

if ( url.indexOf("meditation/") != -1 ) {
  img = "/images/gif/sun.gif";
  imgAlt = "The Sun";
}
else if ( url.indexOf("philosophy/") != -1 ) {
  img = "/images/gif/sunflower.gif";
  imgAlt = "A Sunflower";
}
else if ( url.indexOf("potpourri/") != -1 ) {
  if ( url.indexOf("miracles/") != -1 ) {
    img = "/images/gif/sun.gif";
    imgAlt = "The Sun";
  }
  else {
    img = "/images/gif/sunflower.gif";
    imgAlt = "A Sunflower";
  }
}
else if ( url.indexOf("pyramid/") != -1 ) {
  img = "/images/gif/great_pyramid.gif";
  imgAlt = "Great Pyramid";
}
else if ( url.indexOf("sexecs/") != -1 ) {
  img = "/images/gif/lovers.gif";
  imgAlt = "Spiritual Lovers";
}

function upperLeftImage() {

  var myImage = "";

//  myImage  = '<applet codebase="/applets/pool/" code="PoolMenu.class" width="131" height="98">';
//  myImage += '<param name="image" value="' + img + '" />';
  myImage += '<img src="' + img + '" width="131" height="98" alt="' + imgAlt + '" /><br />';
//  myImage += '</applet>';

  document.write(myImage);

}



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 popUp() {

  // don't do popup if on search results page
  if ( window.location.href.indexOf("search.atomz.com") >=0 ) return;

  var what = "natGeo";
  var doit = getCookie(what);

  if (doit != "done") {
    popUpWindow(what);
    setCookie (what, "done", "discard");
  }

}

function popUpWindow(which) {

  if (which == "valentine") {
    var winPopup = window.open('/popups/valentines/valentine.html', 'Valentine', 'menubar=no,toolbar=no,location=no,directories=no,scrollbars=no,status=no,width=450,height=200');
  }

  if (which == "president") {
    var winPopup = window.open('/popups/presidentsday/president.html', 'President', 'menubar=no,toolbar=no,location=no,directories=no,scrollbars=no,status=no,width=423,height=388');
  }

  if (which == "symbol") {
    var winPopup = window.open('/popups/symbol/symbol.html', 'Symbol', 'menubar=no,toolbar=no,location=no,directories=no,scrollbars=no,status=no,width=450,height=150');
  }

  if (which == "natGeo") {
    var winPopup = window.open('/popups/natgeo/show.html', 'NatGeo', 'menubar=no,toolbar=no,location=no,directories=no,scrollbars=no,status=no,width=300,height=185');
  }


}


// window.onload = popUp;

// -->

