var bgsound_path="http://tomar.biz/Music/MID";
var bgsound_file="";
var bgsound_xtn="mid";
var bgsound_id=1;
var bgsound_loops=-1;
function load_and_play(bgsound_id,bgsound_path,bgsound_file,bgsound_xtn){
	document.write('<BGSOUND ID=BGSound_'+bgsound_id+' SRC=\"'+get_bgsound_src(bgsound_path,bgsound_file,bgsound_xtn)+'\">');
}
function load_and_play_in_loops(bgsound_id,bgsound_path,bgsound_file,bgsound_xtn,bgsound_loop){
	document.write('<BGSOUND ID=BGSound_'+bgsound_id+' SRC=\"'+get_bgsound_src(bgsound_path,bgsound_file,bgsound_xtn)+'\" LOOP='+bgsound_loops+'>');
}

function init(bgsound_id){
	document.write('<BGSOUND ID=BGSound_'+bgsound_id+'>');
}
function init_in_loops(bgsound_id,bgsound_loops){
	document.write('<BGSOUND ID=BGSound_'+bgsound_id+' LOOP='+bgsound_loops+'>');
}
function play(bgsound_id){
	eval('BGSound_'+bgsound_id).src=get_bgsound_src(bgsound_path,bgsound_file,bgsound_xtn);
}
function stop(bgsound_id){
	eval('BGSound_'+bgsound_id).src=null;
}
function get_bgsound_src(bgsound_path,bgsound_file,bgsound_xtn){
	return bgsound_path+'/'+bgsound_file+'.'+bgsound_xtn;
}
function play_stop(bgsound_id,bgsound_toplay){
	if (bgsound_toplay){
		play(bgsound_id);
	}else{
		stop(bgsound_id);
	}
}

MIDFiles=[
'2001.MID',
'addamsfm.mid',
'airwolf.mid',
'alien.mid',
'Avengers.mid',
'B5_Requiem.mid',
'B5_Theme5.MID',
'Babylon5.mid',
'Babylon52ndSeason.mid',
'backtothefuture.mid',
'batman1.mid',
'battle.mid',
'battlestar.mid',
'Beetlejuice.mid',
'bladerun.mid',
'BuckRogers.mid',
'BuffyTheVampireSlayer.mid',
'closeeng.mid',
'danube.mid',
'DoctorWho1996.mid',
'drwho.mid',
'Ds9_4th.mid',
'Earth2.mid',
'empire.mid',
'EscapeFromNewYork.mid',
'et.mid',
'eveofwar.mid',
'gbusters.mid',
'hercules.mid',
'Highlander.mid',
'Highlander_TheSeries.mid',
'IncredibleHulk.mid',
'IndependenceDay1.mid',
'jurassic.mid',
'kingkong.mid',
'KnightRider.mid',
'LandOfTheGiants.mid',
'laststar.mid',
'LoisAndClark.mid',
'Millenium.mid',
'MissionImpossible-TV.mid',
'MissionImpossible.mid',
'MosEisleyCantina.mid',
'NewAvengers.mid',
'Prisoner.mid',
'Quantum_Leap_Theme.mid',
'REDDWARF.MID',
'saab.mid',
'seaQuest2032.mid',
'seaQuestdsv.mid',
'Space1999-2.mid',
'Space1999.mid',
'Startrek.mid',
'StarTrekFirstContact.mid',
'StarTrekII.mid',
'StarTrekVI.mid',
'StarWars.mid',
'Superman.mid',
'T2.mid',
'TheOuterLimits.mid',
'TheSearchForSpock.mid',
'TheTwilightZone.mid',
'TheVoyageHome.mid',
'thunderb.mid',
'timetnl.mid',
'TNGTheme.mid',
'ToLiveForever.mid',
'tripods.mid',
'Ufo.mid',
'uncle.mid',
'Voyager.mid',
'VR5.MID',
'WonderWoman.mid',
'X-files.mid',
'xena.mid'
];

function writeSelectedSIFI(){
	document.write('<form name=BGS>'+
	'<input type="button" name=SIFIDo_'+bgsound_id+' value=Play onclick="javascript:playSelectedSIFI(bgsound_id)"> '+
	'<select name=BGSoundFiles_'+bgsound_id+' onchange="javascript:playSelectedSIFI(bgsound_id)" style="text-transform:capitalize">'+
	'<option>Nothing</option>');
	for(atMID=0;atMID<MIDFiles.length;atMID++){
		document.write('<option value="'+MIDFiles[atMID]+'">'+MIDFiles[atMID].substring(0,MIDFiles[atMID].indexOf('.'))+'</option>');
	}
	document.write('</select> '+
	'</form>');
	bgsound_file="";
	bgsound_path='http://tomar.biz/Music/MID/SI-FI/';
	init_in_loops(bgsound_id,bgsound_loops);
}

function playSelectedSIFI(bgsound_id){
	BGSFiles=eval('document.BGS.BGSoundFiles_'+bgsound_id);
	BGSFile2Play=BGSFiles.options[BGSFiles.selectedIndex].value;
	SIFIDo=eval('document.BGS.SIFIDo_'+bgsound_id).value;
	if(SIFIDo=="Play" && BGSFile2Play!=""){
		eval('BGSound_'+bgsound_id).src=bgsound_path+BGSFile2Play;
		eval('document.BGS.SIFIDo_'+bgsound_id).value="Stop";
	}else{
		stop(bgsound_id);
		eval('document.BGS.SIFIDo_'+bgsound_id).value="Play";
	}
}