if (document.all && document.all.tags && document.all.tags('bgsound')) 
function playBgsound(url) { 
document.all.sound.src = url; 
	}

function playEmbedsound(soundobj) {
  var thissound= eval("document."+soundobj);
  thissound.Play();
  }
  
function playThunder() {	
  if (document.all && document.all.tags && document.all.tags('bgsound')) {
    playBgsound('/thunder_x.wav');
      }
  else if (!(document.all && document.all.tags && document.all.tags('bgsound'))) {
  	playEmbedsound('sound1')
  	 }
  	}

function playChains() {	
  if (document.all && document.all.tags && document.all.tags('bgsound')) {
    playBgsound('/chains.wav');
      }
  else if (!(document.all && document.all.tags && document.all.tags('bgsound'))) {
  	playEmbedsound('sound2')
  	 }
  	}

function playBell() {	
  if (document.all && document.all.tags && document.all.tags('bgsound')) {
    playBgsound('/doorbell.wav');
      }
  else if (!(document.all && document.all.tags && document.all.tags('bgsound'))) {
  	playEmbedsound('sound3')
  	 }
  	}

function playBubbling() {	
  if (document.all && document.all.tags && document.all.tags('bgsound')) {
    playBgsound('/BubblingCauldron.wav');
      }
  else if (!(document.all && document.all.tags && document.all.tags('bgsound'))) {
  	playEmbedsound('sound4')
  	 }
  	}

//-- load and write source of lightning gif
var load = new Image();
load.src = "/books/lightning-ani.gif";

function flashLightning() {
document.getElementById('lightning').style.display = "block";
document['lightningflash'].src = load.src;
setTimeout('playThunder()',4000);
setTimeout("document.getElementById('lightning').style.display = 'none';",10000);
}

//-- on unload
function lastLightning() {
document['lightningflash'].src = load.src;
playThunder();
}

