﻿function toggleAudio() {
	
	//switch play/pause modes
	//a non-zero rate indicates that the movie is playing, zero indicates stopped.
	//for our purposes, it shouldn't matter if we're stopped at the end or paused in the middle, we should try to play on a function call regardless. 
	if (document.station.GetRate()){
		
		document.station.Stop();
		
	}else{
	
		document.station.Play();
		
	}
	
}


function AudioOn() {

	document.station.Play();
		
}

function AudioOff() {
	
	document.station.Stop();
	
}

function daySound(){

	//modulo on day of year
	var oDate = new Date();
	var intTargetImg = (oDate.getDate() % 7);
	var strBgSoundStart = '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="100" width="100"> <param name="src" value="bgsound/bgaudio';
	var strBgSoundMid = '.mp3" /><param name="autoplay" value="true" /><param name="controller" value="false" /><param name="showlogo" value="false" /><param name="loop" value="true" /><param name="bgcolor" value="#000000" /><embed height="100" pluginspage="http://www.apple.com/quicktime/download/" src="bgsound/bgaudio';
	var strBgSoundEnd = '.mp3" type="audio/mpeg" width="100" controller="false" autoplay="true" showlogo="false" loop="true" bgcolor="#000000"></embed> </object>';
	
	document.write(strBgSoundStart);
	
	if (intTargetImg) {
		document.write(intTargetImg);
	}
	
	document.write(strBgSoundMid);
	
	if (intTargetImg) {
		document.write(intTargetImg);
	}
	
	document.write(strBgSoundEnd);
	
}

function daySoundFront(){

	//modulo on day of year
	var oDate = new Date();
	var intTargetImg = (oDate.getDate() % 7);
	var strBgSoundStart = '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="100" width="100"> <param name="src" value="2008/bgsound/bgaudio';
	var strBgSoundMid = '.mp3" /><param name="autoplay" value="true" /><param name="controller" value="false" /><param name="showlogo" value="false" /><param name="loop" value="true" /><param name="bgcolor" value="#000000" /><embed height="100" pluginspage="http://www.apple.com/quicktime/download/" src="2008/bgsound/bgaudio';
	var strBgSoundEnd = '.mp3" type="audio/mpeg" width="100" controller="false" autoplay="true" showlogo="false" loop="true" bgcolor="#000000"></embed> </object>';
	
	document.write(strBgSoundStart);
	
	if (intTargetImg) {
		document.write(intTargetImg);
	}
	
	document.write(strBgSoundMid);
	
	if (intTargetImg) {
		document.write(intTargetImg);
	}
	
	document.write(strBgSoundEnd);
	
}