//aup2.jar:
//Plays the second sound - When the applet is visible, this has the same effect as selecting "plong" in the drop down menu and pressing the play button in the applet. document.applets[0].startPlay(1); 
//Stops all sounds. document.applets[0].stopAllSounds(); 
//Sets the third sound to loop document.applets[0].setLoop(2,true); 
//Adds a new sound file to the list of available sounds document.applets[0].loadSound('wrong.au'); 
//Hides the applet document.applets[0].hideControls(); 
//Shows the applet document.applets[0].showControls(); 
//Stops the third sound only (if playing) document.applets[0].stopSound(2); 

//ClipControl.class http://www.cs.indiana.edu/~kinzler/fun/shr_sounds/index.html



if (document.images) {
	b0= new Image (125,20);
	b0.src= "images/b.gif";

	monon= new Image (60,45);
	monon.src= "images/monon.gif";
	monoff= new Image (60,45);
	monoff.src= "images/monoff.gif";

	for (i=1; i<=9; i++){
		eval('b'+i+'o= new Image (125,20)');
		eval('b'+i+'o.src= "images/b'+i+'o.gif"');
		eval('mon'+i+'= new Image (60,45)');
		eval('mon'+i+'.src= "images/mon'+i+'.gif"');
	}
}

var curSound='';
var ActivateOn=false;
var ClickOn=false;
var SoundOn=false;
ActivateTimeout=	setTimeout('',0);
ButtonOn=			setTimeout('',0);
ClickTimeout=		setTimeout('',0);
NavBlink=			setInterval('',1000);	clearInterval(NavBlink);
NavFlash=			setInterval('',1000);	clearInterval(NavFlash);
ClickTimeout=		setTimeout('',0);
MonitorOn=			setTimeout('',0);
mOverTimeout=		setTimeout('',0);
BlinkOn=			setTimeout('',0);

function clearTimeouts(){
	clearTimeout(ActivateTimeout);
	clearTimeout(ButtonOn);
//	clearTimeout(ClickTimeout);
	clearTimeout(MonitorOn);
	clearInterval(NavBlink);
	clearInterval(BlinkOn);
	clearInterval(NavFlash);
	clearTimeout(mOverTimeout);
}

var mimetype='audio/wav';
//if (navigator.appName == "Microsoft Internet Explorer" || (navigator.appName == "Netscape" && navigator.plugins["LiveAudio"]["audio/wav"].enabledPlugin==navigator.plugins["LiveAudio"]     && navigator.plugins["LiveAudio"]["audio/wav"])){
if (navigator.appName == "Microsoft Internet Explorer"){
//	SoundOn=true;
	//document.write('<embed src="clicksound.wav"		hidden=true loop=false autostart=false name="clicksound"	mastersound>');
	//document.write('<embed src="activatesound.wav"		hidden=true loop=false autostart=false name="activatesound"		mastersound>');
	//document.write('<embed src="activesound.wav"	hidden=true loop=false autostart=false name="activesound"	mastersound>');
}

function changeImg(imgid,newimg){
	if (document.images) {
		document.images[imgid].src=eval(newimg+".src");
	}
}

function blinkImg(imgid,offtime){
	if (!ActivateOn && !ClickOn){
		if (SoundOn){
			document.applets[0].stopAllSounds();	//stopSound();
			document.applets[0].startPlay(1);		//playSound('activesound');
		}
	}
	eval('changeImg("b'+imgid+'","b0")');
	eval('BlinkOn=setTimeout(\'eval("changeImg(\\\'b'+imgid+'\\\',\\\'b'+imgid+'o\\\')")\','+offtime+')');
	eval('changeImg("mon","mon'+imgid+'")');
}

function flashImg(imgid,offtime){
	eval('changeImg("b'+imgid+'","b'+imgid+'o")');
	eval('FlashOn=setTimeout(\'eval("changeImg(\\\'b'+imgid+'\\\',\\\'b0\\\')")\','+offtime+')');
}

function mOver(imgid){
	if (!ClickOn){
		eval('mOverTimeout=setTimeout("activateButton(\''+imgid+'\')",300)');
	}
}

function activateButton(imgid){
	if (!ClickOn){
		if (SoundOn){
			document.applets[0].stopAllSounds();	//stopSound();
		}
		ActivateOn=true;
		clearTimeouts();
		eval('NavFlash=setInterval("flashImg('+imgid+',50,true)",100)');
		setTimeout("clearInterval(NavFlash);",500);
		ButtonOn=setTimeout("changeImg('b"+imgid+"','b"+imgid+"o');",600);
//		eval('changeImg("b'+imgid+'","b'+imgid+'o")');
		changeImg("mon","monon");
		eval('MonitorOn=setTimeout(\'eval("changeImg(\\\'mon\\\',\\\'mon'+imgid+'\\\')");	NavBlink=setInterval("blinkImg('+imgid+',100,true)",600)		\',700)');
		if (SoundOn){
			document.applets[0].startPlay(0);		//playSound("activesound");
		}
		ActivateTimeout=setTimeout('ActivateOn=false',700);
	}
}

function mOut(imgid){
	if (!ClickOn){
		clearTimeouts();
		clearInterval(NavFlash);
		changeImg("mon","monoff");
		if (SoundOn){
			document.applets[0].stopAllSounds();	//stopSound();
		}
		eval('changeImg("b'+imgid+'","b0")');
	}
}

function mClick(imgid,url){
	ClickOn=true;
	clearTimeouts();
	eval('NavFlash=setInterval("flashImg('+imgid+',50,true)",100)');
	setTimeout("clearInterval(NavFlash)",650);
	changeImg("mon","monon");
	eval('ClickTimeout=setTimeout(\'ClickOn=false;	changeImg("b'+imgid+'","b0");	changeImg("mon","monoff");	\',900)');
	if (SoundOn){
		document.applets[0].stopAllSounds();	//stopSound();
		document.applets[0].startPlay(2);		//playSound('clicksound');
	}
	if (url != ''){
		eval('setTimeout(\'location.href="'+url+'"\',1000)');
	}
}

function playSound(thisSound){
	curSound=thisSound;
	if (SoundOn){
//		eval('document.'+thisSound+'.play()');
	}
}

function stopSound(){
	if (curSound != '' && SoundOn){
//		eval('document.'+curSound+'.stop()');
	}
}

changeImg("mon","monoff");
