
// assumes that we've included browser_detect.js

function open_song_window(song_url, artist, track)
{
    url = "../include/play_song.php?song_url=" + escape(song_url);
    url += "&artist=" + escape(artist) + "&track=" + track;
    window_features = 'height=160,width=350';

    song_window = window.open(url, 'song_window', window_features);
}


function open_video_window(video_url, video_title)
{
    url = "../include/play_video.php?video_url=" + escape(video_url) + "&video_title=" + escape(video_title);
    window_features = 'height=400,width=400';

    video_window = window.open(url, 'video_window', window_features);
}


// IE need object tags to be created from an external script
// in order to automatically activate ActiveX controls
// see: http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/overview/activating_activex.asp?frame=true&hidetoc=true

function write_quicktime_video_tag(video_url)
{
    alert("writing quicktime tag");
    document.write('<object data="' + video_url + '" width="320" height="260" type="video/quicktime"');

    if (isIE())
    {
	document.write(' classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B">');
	document.write('<param name="src" value="' + video_url + '" \>');
    }
    else
    {
	document.write('>');
    }

    document.write('</object>\n');
}


function write_song_tag(song_url)
{
    document.write("<object data=\"" + song_url + "\" width=\"300\" height=\"20\" type=\"audio/x-mpeg\">\n");
    document.write("</object>\n");
}


// this version will play the song without showing the controller
function write_hidden_song_tag(song_url)
{
    if (isIE())
    {
	document.write("<bgsound src=\"" + song_url + "\">\n");
    }
    else
    {
	document.write("<object data=\"" + song_url + "\" width=\"0\" height=\"0\" type=\"audio/mpeg\">\n");
	document.write("<param name=\"controller\" value=\"false\">\n");
	document.write("</object>\n");
    }
}

