var snd = document.createElement('audio');
var paused = false;

window.onload = function() {
	snd.volume=.1;
	var source = document.createElement('source');
	if (snd.canPlayType("audio/mpeg;")) {
		source.type = "audio/mpeg";
		source.src = "/static/mixdown.mp3";
	} else {
		source.type = "audio/ogg";
		source.src = "/static/mixdown.ogg";
	}
	snd.appendChild(source);
	document.getElementById("bgouter").addEventListener("mouseenter",
		function(event) { if (!paused) { snd.play(); }});
	document.getElementById("bgouter").addEventListener("click", 
		function(event) {if (!paused) {snd.pause(); paused=true;} else {snd.play();paused=false;}});

	document.getElementById("bgouter").addEventListener("mousewheel",
			function(event) { snd.volume -= (0.001*event.deltaY); });
}

function choose_style(style) {
	if (style == "none") {
		document.getElementById("bgouter").style.display = "none";
		snd.pause();
		snd.currentTime = 0;
	} else if (style == "bea") {
		document.getElementById("bgouter").style.display = "initial";
	}
}
