
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;
}

var soundEnabled = ((get_cookie('soundEnabled')=='') || (get_cookie('soundEnabled')!=0));

function setSound(new_value) {
  if (typeof(new_value)!='undefined') {
  	soundEnabled = new_value;
    document.cookie = 'soundEnabled='+(soundEnabled?'1':'0')+';';
    movie = MM_findObj('movie', window.top.frames['music']);
    if (/* ((typeof(no_music)=='undefined') || (!no_music)) && */(soundEnabled)) {
	  movie.innerHTML = '<object id="music_movie" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="10" height="10"><param name="movie" value="images/music.swf"><param name="quality" value="high"><embed name="music_movie" src="images/music.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="10" height="10"></embed></object>';
    }
    else {
 	  movie.innerHTML = '';
    }
  }
  if (soundEnabled) MM_findObj('sound_link').innerHTML = 'Music On';
  else MM_findObj('sound_link').innerHTML = 'Music Off';
}

function initSound() {
/*
  movie = MM_findObj('music_movie', window.top.frames['music']);
  if (
	((typeof(no_music)=='undefined') || (!no_music))
	&& ((get_cookie('countMusic')=='') || (get_cookie('countMusic')==0))
	) {
    if (soundEnabled) {
        movie.SetVariable('_global.mu', 1);
    }
    else {
        movie.SetVariable('_global.mu', 0);
    }
  }
  else {
      movie.SetVariable('_global.mu', 0);
  }
  if (soundEnabled) MM_findObj('sound_link').innerHTML = 'Music On';
    else MM_findObj('sound_link').innerHTML = 'Music Off';
*/
}
