function setChoice( choice ) {
  //sets cookie with yes or no value
  //should be moved as not needed on non-preference setting pages
  var today = new Date()
  life = 10;
  if (choice == 'clear') life = -1; // delete cookie
  var expiry = new Date(today.getTime() + life * 24*60*60*1000)
  if (choice != null && choice != ""){
    var cookieString = 'musicChoice' + "=" + escape(choice)
    if(life){ cookieString += "; expires=" + expiry.toGMTString()}
 	document.cookie = cookieString
  }
}
function getChoice() {
  // read cookie and return its value
  var index = document.cookie.indexOf("musicChoice" + "=")
  if (index == -1) { return null}
  index = document.cookie.indexOf("=", index) + 1
  var end_string = document.cookie.indexOf(";", index)
  if (end_string == -1) { end_string = document.cookie.length }
  return unescape(document.cookie.substring(index, end_string))
}
var preference = getChoice();
function playThis(file) {
  // dont play sound file if cookie value a no
  // should be duplicate in <noscript> tags else scripting required for playback
  // needs work for correctness for playing audio files (may be better way)
  // simply cut-n-paste as of now...
  if (preference != 'no'){
    document.write('<object ID="Player" width="0" height="0"');
    document.write('CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">');
    document.write('<param name="URL" value="' + file + '">');
    document.write('<param name="autoStart" value="True">');
    document.write('<param name="volume" value="100">');
    document.write('<param name="playCount" value="999">');
    document.write('<embed src="' + file + '" align="baseline" border="0" width="0" height="0" loop="true" autostart="true">');
    document.write('</object>');
  }
}

