function setPlayer (file_name) {
	document.myForm.current_video.value = file_name;
	if (window.ActiveXObject && navigator.userAgent.indexOf('Windows') != -1) {
		if (document.myForm.connection_speed[0].checked) {
			Player.URL = "/deliveries_videos/asx_files/" + file_name + "_32.asx";
		}
		else if (document.myForm.connection_speed[1].checked) {
			Player.URL = "/deliveries_videos/asx_files/" + file_name + "_100.asx";
		}
		else {
			Player.URL = "/deliveries_videos/asx_files/" + file_name + "_350.asx";
		}
		Player.controls.play();
	}
	else if (window.GeckoActiveXObject) {
		if (document.myForm.connection_speed[0].checked) {
			document.Player.FileName = "/deliveries_videos/asx_files/" + file_name + "_32.asx";
		}
		else if (document.myForm.connection_speed[1].checked) {
			document.Player.FileName = "/deliveries_videos/asx_files/" + file_name + "_100.asx";
		}
		else {
			document.Player.FileName = "/deliveries_videos/asx_files/" + file_name + "_350.asx";
		}
	} 
	else if (navigator.mimeTypes) {
		document.EmbedPlayer.SetAutoStart(true);
		if (document.myForm.connection_speed[0].checked) {
			document.EmbedPlayer.SetFileName("/deliveries_videos/asx_files/" + file_name + "_32.asx");
		}
		else if (document.myForm.connection_speed[1].checked) {
			document.EmbedPlayer.SetFileName("/deliveries_videos/asx_files/" + file_name + "_100.asx");
		}
		else {
			document.EmbedPlayer.SetFileName("/deliveries_videos/asx_files/" + file_name + "_350.asx");
		}
	}
	else {	//just try something (default)
		if (document.myForm.connection_speed[0].checked) {
			document.Player.FileName = "/deliveries_videos/asx_files/" + file_name + "_32.asx";
		}
		else if (document.myForm.connection_speed[1].checked) {
			document.Player.FileName = "/deliveries_videos/asx_files/" + file_name + "_100.asx";
		}
		else {
			document.Player.FileName = "/deliveries_videos/asx_files/" + file_name + "_350.asx";
		}
	}
}

function update_description (video_id) {
	description_text = description_array[video_id][0] + description_array[video_id][1];
	
	if (description_array[video_id][2] != undefined) {
		description_text += "<br><br><strong>To download this video, click <\/strong><a href='http://wheelchairfoundation.org/video/live/";
		
		if (document.myForm.connection_speed[0].checked) {
			description_text += description_array[video_id][2] + "_32.wmv'><strong>here<\/strong><\/a>";
		}
		else if (document.myForm.connection_speed[1].checked) {
			description_text += description_array[video_id][2] + "_100.wmv'><strong>here<\/strong><\/a>";
		}
		else {
			description_text += description_array[video_id][2] + "_350.wmv'><strong>here<\/strong><\/a>";
		}
		//description_text += "<strong>, then click File -> Save As... in Windows Media Player to save it to your hard drive</strong>";
	}

	if (document.layers) {          //netscape 4 and others
		document.layers.description_area.document.write('<font size=1 face=arial>' + description_text + '</font>');
		document.layers.description_area.document.close();
	}
	else if (document.all) {        //ie
		description_area.innerHTML = description_text;
	}
	else if (document.getElementById) {  //netscape 6
		document.getElementById("description_area").innerHTML = description_text;
	}
}

function getCookieVal (offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
			return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) 
			break; 
	}
	return null;
}

function SetCookie (name, value) {
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (2 < argc) ? argv[2] : null;
	var path = (3 < argc) ? argv[3] : null;
	var domain = (4 < argc) ? argv[4] : null;
	var secure = (5 < argc) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) +
		((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
		((path == null) ? "" : ("; path=" + path)) +
		((domain == null) ? "" : ("; domain=" + domain)) +
		((secure == true) ? "; secure" : "");
}

function DisplayInfo() {
	if (!document.layers) {	//doesn't work in netscape 4 for some reason
		var connection_speed;
		if (!(connection_speed = GetCookie("connection_speed"))) {
			SetCookie("connection_speed", "32", null, "/", null, false);
		}
		if (connection_speed == "32") {
			document.myForm.connection_speed[0].checked = true;
		}
		else if (connection_speed == "100") {
			document.myForm.connection_speed[1].checked = true;
		}
		else {
			document.myForm.connection_speed[2].checked = true;
		}
	}
}

function updateCookie () {
	if (document.myForm.connection_speed[0].checked) {
		SetCookie("connection_speed", "32", null, "/", null, false);
	}
	else if (document.myForm.connection_speed[1].checked) {
		SetCookie("connection_speed", "100", null, "/", null, false);
	}
	else {
		SetCookie("connection_speed", "350", null, "/", null, false);
	}
}

function goFullScreen () {
	if (window.ActiveXObject && navigator.userAgent.indexOf('Windows') != -1) {
		if (Player.playState == 3) {
			Player.fullScreen = true;
		}
		else {
			alert("The video clip must be playing in order to view it in full screen mode.");
		}
	}
	else if (window.GeckoActiveXObject) {
		if (document.Player.playState == 3) {
			document.Player.fullScreen = true;
		}
		else {
			alert("The video clip must be playing in order to view it in full screen mode.");
		}
	}
	else {
		alert("Not supported in your browser.  Try right-clicking on the embedded media player, and then click Zoom -> Full Screen.");
	}
}
