// Funky song player code!
// by Alan Mackey, 5/13/02; 2/25/04

var Playlist = new Array();
var CurrentSong = 0;
var PrevCat = '';

function AddSong(category, file, title, blurb) {
  Playlist[Playlist.length] = new Song(category, file, title, blurb);
  if (category != PrevCat) {
    if (PrevCat != "") {
      ToAdd += '</td><td width="5"></td>';
    }
    ToAdd += '<td class="songlist" valign="top"><p align="center"><b>'+category+'</b></p>';
    PrevCat = category;
  }
  ToAdd += '<a href="javascript:SelectSong('+(Playlist.length-1)+')"><font class="nobold">'+title+'</font></a><br>';
}

function Song(category, file, title, blurb) {
  this.category = category;
  this.file = file;
  this.title = title;
  this.blurb = blurb;
}

function Init() {
  if (!(document.getElementById)) {
    alert('Error: document.getElementById() not supported by this browser.');
  }
  e = document.getElementById("player");
  e.innerHTML = ToAdd;

  UpdateSongDisplay();
}

function UpdateSongDisplay() {
  var e = document.getElementById("title");
  e.innerHTML = Playlist[CurrentSong].title;

  var e = document.getElementById("desc");
  e.innerHTML = Playlist[CurrentSong].blurb;

  var songlinks = document.getElementsByTagName("font");
  for (var n=0; n<songlinks.length; n++) {
    songlinks[n].style.textDecoration = (n==CurrentSong)?"underline":"none";
    songlinks[n].style.color = (n==CurrentSong)?"#C63008":"black";
  }
}

function PlaySong(num) {
  SelectSong(num);
  MPPlay();
}

function MPPlay() {
  var swf = false;
  if (window.MusicPlayer) {
    swf = window.MusicPlayer;
  } else if (document.MusicPlayer) {
    swf = document.MusicPlayer;
  }
  
  if (swf) {
    swf.SetVariable("LoadMusicFile", "http://www.blinken.com/alsmusic/"+Playlist[CurrentSong].file+".mp3");
  } else {
    var url = "m3u/" + Playlist[CurrentSong].file + ".m3u";
    window.location = url;
  }
}

function MPPlayWinamp() {
  var url = "m3u/" + Playlist[CurrentSong].file + ".m3u";
  window.location = url;
}

function MPDownload() {
  var file = Playlist[CurrentSong].file;
  var url = "http://www.blinken.com/alsmusic/" + file + ".mp3";
  window.location = url;
}

function PlayerFile(file) {
  PluginPlayFile(file);
}

function SelectSong(n) {
  CurrentSong = n;
  UpdateSongDisplay();
}

var ToAdd = '<table border=0 cellspacing=0 cellpadding=0 width="100%" height="115">';
ToAdd += '<tr><td valign="top" align="center" width="100%">';

ToAdd += '<br><b><span id="title"></span></b><br><span id="desc"></span></td><td style="padding-left: 5px;" valign="top">';
ToAdd += '<table border="0" cellpadding="0" cellspacing="5"><tr>';
ToAdd += '<td colspan="2" align="center"><div class="songlist" style="padding: 0;">';
ToAdd += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="256" height="34" id="MusicPlayer" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="MusicPlayer.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#cfdef1" /><embed src="MusicPlayer.swf" quality="high" bgcolor="#cfdef1" width="256" height="34" name="MusicPlayer" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
ToAdd += '</div></td></tr><tr>';
ToAdd += '<td align="center"><div class="navon"><a href="javascript:MPPlay()"><span class="navtext">Play&nbsp;Stream</span></a></div></td>';
ToAdd += '<td align="center"><div class="navon"><a href="javascript:MPDownload()"><span class="navtext">Download&nbsp;MP3</span></a></div></td>';
ToAdd += '</tr></table>';

ToAdd += '</td></tr></table><br>';

ToAdd += '<center><table border=0 cellspacing=0 cellpadding=0><tr>';

AddSong("Songs", "Android Dancehall 80s Mix", "Android Dancehall (80s Mix)", "This is a remix of one of my favorite songs from my Patchwerk album done in untra-cheesey 80's synthpop style.  The original song was a parody of Karftwerk, so this one kind of pokes fun at how they re-emerge every decade or so and do remixes of all their old stuff.");
AddSong("Songs", "Some Days It's Dark", "Some Days It's Dark (As performed by retarded robots)", "This mock-goth song was originally part of The Kids In The Hall's movie, Brain Candy.  I recreated it using the open-source multitrack recorder Audacity, using the SidStation, Nord Lead, and the Amiga speech synthesizer.");
AddSong("Songs", "KingOfTheSeaMonkeys V2", "King Of The Sea Monkeys (Patchwerk Mix)", "This is an updated mix of an older song of mine.  This is the version on my first CD, Patchwerk.");
AddSong("Songs", "Petroleum Product V3", "Petroleum Product (Patchwerk Version)", "This version differs from the one released originally on mp3.com mostly on its lead instruments, which were done with my Nord Lead instead of pre-sampled.");
AddSong("Songs", "Mile High Club", "Mile High Club (Al's remix)", "One of my favorite musicians, Divinorum (AKA Bjorn Lynne) announced a remix competition for his song, Mile High Club. Naturally, I couldn't resist...");
AddSong("Songs", "Spite-Remix", "Spite (Remix)", "This is a version of my old song Spite done with a more dance-oriented drum track.");
AddSong("Songs", "Something Funky", "Something Funky", "Funky funky funky funky funky.  Ten Geek Points to anyone who can correctly identify the two vocal snippets.  Lots of old funk-band samples and stuff went into this one.");
AddSong("Songs", "Space Opera", "Space Opera", "This is my attempt to make a song that's a bit more low-key, but avoids falling into the traps of \"New Age\" or \"Ambient\" music. Turns out, this concept makes for great space music! Or at least, I think so...");
AddSong("Songs", "Unknown", "Unknown", "This one's got kind of a subtle spookiness to it.  Hence the name.");
AddSong("Songs", "The Nightmare", "Your Darkness (The Nightmare)", "This is a second remix of Force Majeure's \"Your Darkness\" that I completed arround halloween.  SpooOOooOOooky!");
AddSong("Songs", "Numbers", "Numbers", "A happy song about spies!  This song uses samples from real \"Numbers Stations\".  Those are transmissions that happen on shortwave radio, where a voice reads out a long sequence of numbers or letters.  It is believed that these stations are used by spy organizations.");
AddSong("Songs", "Anubis", "Anubis", "I got the idea for the distorted drums in the background for this one from a bunch of old garage recordings of Devo.  I think it's a great effect.");
AddSong("Songs", "Dive", "Dive", "This song is the first song of mine to use the SidSataion.  It's also the first song on my album, Patchwerk.");
AddSong("Songs", "Out There", "Out There", "This is one of my songs from way back that I've remade using new gear. It's kind of strange and melodic.");
AddSong("Songs", "Basics", "Basics", "This song was inspired by old C64 tunes. The Sidstation takes the lead in this one, backed up by simple waveforms and some sampled C64 drums.");
AddSong("Songs", "Spite", "Spite", "Not the original version of Spite, but an older revision.  It's kind of mellow and dancey, with a jazz-inspired lead.");
AddSong("Songs", "Your Darkness", "Your Darkness (Dark Filter)", "This is my first remix of Force Majeure's \"Your Darkness\".  This one uses a lot of weird filtering effects.");
AddSong("Songs", "Woopy", "Woopy", "This is me having way too much fun with my Nord Lead's arpegiator.");
AddSong("Songs", "Android Dancehall", "Android Dancehall", "Ja!  The original Android Dancehall.  I found this great freeware Vocoder, the Zerius Vocoder, so obviously it was time to do a Kraftwerk parody!");
AddSong("Songs", "King of the Sea Monkeys", "King of the Sea Monkeys", "This is the original version, with more techno-mod-crap stereotypia than you can shake a weasel at.");
AddSong("Songs", "Petroleum Product", "Petroleum Product", "The original version.  This is a strange song that combines hard and soft elements that flirts between dance and ambient styles.");


AddSong("Snippets/Rejects", "Preminision", "Preminision", "This was going to be the opening to an album, but I decided it was too incoherant.");
AddSong("Snippets/Rejects", "Something", "Something", "One day I wrote a song I didn't know what to call, so I called it Something.  From that day on, I used Something plus an adjective to name songs I couldn't properly name.");
AddSong("Snippets/Rejects", "Something Retro", "Something Retro", "I'm not sure what I thought was so retro about it, but it's a pretty interesting song.  Unfortunately, there wasn't much to its structure so my inspiration just kind of puttered out.");
AddSong("Snippets/Rejects", "Something Funky Try1", "Something Funky (Try 1)", "My first take on the funk samples eventually used in \"Something Funky\".");
AddSong("Snippets/Rejects", "Something Stupid", "Something Stupid", "This one was too \"mainstream techno\" for my tastes, so it went abandoned.");
AddSong("Snippets/Rejects", "Something Bizzare", "Something Bizzare", "An interesting progression that wasn't going anywhere.");
AddSong("Snippets/Rejects", "swb", "S.W.B.", "This one was hard to work on because the physical patch routings I needed to set up for the guitar sounds were very complicated.  However, this is a remake of an old song I made when I first heard Nirvana.  I was trying to nonlyrically parody their wild mood swings.  This became the title song for my game SUAVE.");
AddSong("Snippets/Rejects", "Diabolikal Experiment", "Diabolikal Experiment", "This one just wasn't going anywhere, but it may give MSTies a chuckle.");
AddSong("Snippets/Rejects", "Drek", "Drek", "This song has some odd charm to it, but I never got around to finishing it.");
AddSong("Snippets/Rejects", "Aerobatics-Sketch", "Aerobatics (sketch)", "I made this thing before writing Aerobatics, in order to figure out the melodies.  It's a digital music version of a sketch!");
AddSong("Snippets/Rejects", "Wolves-Saccharine", "Wolves (Saccharine Mix)", "This is something I composed on a whim.  It's an alternate background for Chama's beautiful song, \"Wolves\", but it's cheezey synth-pop instead of orchestral.  He liked the concept, but unfortunately he didn't have a raw recording of the lyrics to combine it with.");
AddSong("Snippets/Rejects", "Yia Evil Gnats Try1", "Yia! Evil Gnats! (Try 1)", "I <i>so</i> wanted to make this song work.  Something wasn't quite right, though...  I think it's cool that its name is an anagram of the name of the song that was diced up to form the background track.");
AddSong("Snippets/Rejects", "Yia Evil Gnats Try2", "Yia! Evil Gnats! (Try 2)", "This is me trying various drum tracks to apply back to the original melodies in Try 1.  I didn't like any of them enouigh.");
AddSong("Snippets/Rejects", "Afterthought", "Afterthought", "A counterpoint to Preminission.  Backwards masking?  I don't know <i>what</i> you're talking about.");


AddSong("Old Stuff", "Its Not My Fault", "It's Not My Fault", "This strange MOD composition represents the point where I started taking influences from the hip-hop genre seriously.  It only ever uses 3 samples at once.");
AddSong("Old Stuff", "Underground", "Underground", "This is a song I did back in college, back in my Amiga days, after finding an incredibly generic collection of old Rave and 808/909 samples for my Kurzweil K2000.");
AddSong("Old Stuff", "Help Me", "Help Me", "This is one of the first songs I made on the PC.  It's all samples, no MIDI.");
AddSong("Old Stuff", "NextMove", "Next Move", "This one has some good bits, but also shows how weak the K2000 could be at drums if you're not careful.");
AddSong("Old Stuff", "Cloud", "Cloud", "Another song from my Amiga/K2000 era.  This one shows that I wasn't always such a spastic freak.");
AddSong("Old Stuff", "Morning", "Morning", "Also from the Amiga days, this song reflects how I felt in the early morning one day.");
AddSong("Old Stuff", "Space Epic", "Space Epic", "10 minutes of cheesey space music goodness.");
AddSong("Old Stuff", "Spite-Original", "Spite (Original)", "Yes, the original version of Spite, from the Amiga/K2000.");
AddSong("Old Stuff", "Eediots In Space", "Eediots In Space", "A familiar song gets a silly twist.");
AddSong("Old Stuff", "Aerobatics", "Aerobatics", "My attempt to fuse synth-pop and Ska.  The horror!  The horror!!!!");
AddSong("Old Stuff", "Pack Mentality", "Pack Mentality", "This is a rather old song with strange patterns.");
AddSong("Old Stuff", "Run the Monty", "Run The Monty (Al's Mix)", "A fairly old remix of an old video game song from the C64 era.");
AddSong("Old Stuff", "Mod-Ern", "Mod-Ern", "This is a truly old song from my C64 days.  The \"Mod\" in the title is a pun, since I'm using the SID chip's Mod (ring modulation) function.");

ToAdd += '</td></tr></table></center>';
