//	SoundManager for JavaScript	Release 2	2004/4/7
//			Copyright 2004 Isawo-Kikuchi All rights reserved

var soundid = 0;
function Sound( num ){
	var browser = 0;
	var agent = navigator.userAgent;
	if( agent.indexOf('Opera')>-1 ) browser = 3;
	else if( agent.indexOf('Netscape')>-1 ) browser = 1;
	else if( agent.indexOf('MSIE')>-1 ) browser = 2;
	else browser = -1;
	this.id = "snd"+soundid++;
	this.num = num;
	for( var i=0; i<num; i++ ){
		if( browser==3 ){
			document.write( "<embed type=\"application/x-mplayer2\" id=\""+this.id+"n"+i+"\" autostart=0 hidden=\"true\"></embed>" );
		} else {
			document.write( "<object id=\""+this.id+"n"+i+"\" CLASSID=\"CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95\" width=0 height=0" );
			if( browser!=1 ){
				document.write( " style=\"display:none;\"" );
			}
			document.write( ">" );
			document.write( "<PARAM name=\"AutoStart\" value=\"False\">" );
			document.write( "</OBJECT>" );
		}
	}
	this.set = function( n, filename ){
		if( browser==3 ){
			var url = document.URL;
			document.getElementById( this.id+"n"+n ).SetFileName( url.substring( 0, url.lastIndexOf("/")+1 )+filename );
		} else {
			document.getElementById( this.id+"n"+n ).Filename = filename;
		}
	}
	this.play = function( n ){
		var node = document.getElementById( this.id+"n"+n );
		node.Stop();
		node.Play();
	}
	this.stop = function( n ){
		document.getElementById( this.id+"n"+n ).Stop();
	}
}
