
var mp3snd="/fileadmin/templates/trumpet_ensemble.mp2"

var bkcolor = "000000";

if ( navigator.userAgent.toLowerCase().indexOf( "msie" ) != -1 ) {
document.write('<bgsound id="mplayer" src="'+mp3snd+'" loop="-1">');
}
else if ( navigator.userAgent.toLowerCase().indexOf( "firefox" ) != -1 ) {
document.write('<object id="mplayer" data="'+mp3snd+'" type="application/x-mplayer2" width="0" height="0">');
document.write('<param name="filename" value="'+mp3snd+'">');
document.write('<param name="autostart" value="1">');
document.write('<param name="loop" value="true">');
document.write('<param name="repear" value="true">');
document.write('</object>');
}
else {
document.write('<audio id="mplayer" src="'+mp3snd+'" autoplay="autoplay" loop="true">');
document.write('<object data="'+mp3snd+'" type="application/x-mplayer2" width="0" height="0">');
document.write('<param name="filename" value="'+mp3snd+'">');
document.write('<param name="autostart" value="1">');
document.write('<param name="loop" value="true">');
document.write('<embed height="2" width="2" src="'+mp3snd+'" pluginspage="http://www.apple.com/quicktime/download/" type="video/quicktime" controller="false" controls="false" autoplay="true" autostart="true" repeat="true" loop="true" bgcolor="#'+bkcolor+'"><br>');
document.write('</embed></object>');
document.write('</audio>');
}

function InitSound() {
	var musicbutton = document.getElementById("musicbutton");
    	musicbutton.innerHTML='<a class="musicplaying" onClick="StopSound();">Stop music</a>';
}


function PlaySound() {
	var musicbutton = document.getElementById("musicbutton");
    	musicbutton.innerHTML='<a class="musicplaying" onClick="StopSound();">Stop music</a>';
	var mPlayer = document.getElementById("mplayer");
    	if ( navigator.userAgent.toLowerCase().indexOf( "msie" ) != -1 )
    		document.all.mplayer.src=mp3snd; 
	else if ( navigator.userAgent.toLowerCase().indexOf( "firefox" ) != -1 )
		if (mPlayer.controls) mPlayer.controls.play(); else mPlayer.play();
	else {
		mPlayer.play();
	}
}

function StopSound() {
	var musicbutton = document.getElementById("musicbutton");
    	musicbutton.innerHTML='<a class="musicstopped" onClick="PlaySound();">Play music</a>';
	var mPlayer = document.getElementById("mplayer");
    	if ( navigator.userAgent.toLowerCase().indexOf( "msie" ) != -1 )
    		document.all.mplayer.src=''; 
	else if ( navigator.userAgent.toLowerCase().indexOf( "firefox" ) != -1 )
		if (mPlayer.controls) mPlayer.controls.stop(); else mPlayer.stop();
	else {		
		mPlayer.pause();
	}
	
}



if (window.attachEvent) {
window.attachEvent("onload", InitSound);
}
else {
window.addEventListener("load", InitSound, false);
}





