//////////////////////////////////
//// Fancy Button Scripts

	function ButtonActivate(button_name,button_location,button_action,
			button_off,button_on,button_pressed,button_ack,button_noack){
		// Messy, but hard to do with delayed evaluation of a Button
		// Buttons stick in in Netscape instead of mousedown
if (navigator.appName.indexOf('Netscape') != -1) 	
	eval(button_location+".button"+button_name+".src='"+button_pressed+"'"); 
		FlashAck=button_location+".button"+button_name+".src='"+button_ack+"';"; // Confirms command
FlashAck+="window.setTimeout(\""+button_location+".button"+button_name+".src='"+button_off+"'\",200)";
		FlashNoack=button_location+".button"+button_name+".src='"+button_noack+"';"; // Confirms command
		FlashNoack+="window.setTimeout(\""+button_location+".button"+button_name+".src='"+button_off+"'\",200)";
		eval(button_action);
	}


	function MakeFancyButton(Button){
		// Converts the Button into HTML

		task="ButtonActivate('"+
			Button.name+"','"+
			Button.location+"','"+
			Button.action+"','"+
			Button.off+"','"+
			Button.on+"','"+
			Button.pressed+"','"+
			Button.ack+"','"+
			Button.noack+"'"+
		")";

		document.write('<IMG src="'+Button.off+'" name="button'+Button.name+'" border=0 usemap="#map'+Button.name+'">\n');
		document.write('<MAP name="map'+Button.name+'">\n');
		document.write("<AREA "+Button.shape+
		" onMouseDown=\""+Button.location+".button"+Button.name+".src='"+Button.pressed+"'\""+ // Buttons move with mouse button,
		" onMouseUp=\""+Button.location+".button"+Button.name+".src='"+Button.on+"'\""+   // but IE only.
		" onMouseOver=\""+Button.location+".button"+Button.name+".src='"+Button.on+"'\""+
		" onMouseOut=\""+Button.location+".button"+Button.name+".src='"+Button.off+"'\""+
		" onClick=\""+task+"; return false;\""+ // return false keeps Netscape from following the link!
		" border=0 "
		)
 		if (navigator.appName.indexOf('Netscape') != -1) 
            		 document.write("href=\"\"");
             	document.write(">\n");
		document.write('</MAP>\n');
	}

	function QueueExecute(RCXprogram,RCXtask,OnReading,OnFailure){
		// Puts the command in the queue, and executes it in turn.
		Queue("Execute("+RCXprogram+","+RCXtask+","+Freeze(OnReading)+","+Freeze(OnFailure)+")");
	}


	function Button(button_name,button_location,button_action,button_shape,
			button_off,button_on,button_pressed,button_ack,button_noack){
		// Create a fancy button

		this.name=button_name; // Unique button identifier
		this.location=button_location;
		this.action=button_action; // JavaScript you want to run when the button is pressed
		this.shape=button_shape; // shape and coords
		this.off = button_off; // Button off graphic
		if (button_on) this.on = button_on; // Button highlighted graphic
		else this.on = button_off; 
		if (button_pressed) this.pressed = button_pressed; // Button pressed in graphic
		else this.pressed=this.on;
		if (button_ack) this.ack=button_ack; // Button response graphic
		else this.ack=button_off;
		if (button_noack) this.noack=button_noack; // Button no-response graphic
		else this.ack=button_off;
	}

////////////////////////////////////////////////////////////
//// End of button maker

