/*
 * page.js
 * 
 * Contains javascript functions. 
 * Automatically imported into every page as part of doHeader();.
 *
 * Seeing as it's not going to get very big, pretty much everything will be in here.
 *  
 */

//
// COMMON
//

/*
 * Render embedded object to show youtube control for a video
 * 
 * Params: (string) YoutubeId
 *
 */

function embedVideo(id)
{
	document.write('<center> \
					<param name="movie" value="http://www.youtube.com/v/' +id + '&rel=0"></param> \
					<param name="wmode" value="transparent"></param> \
					<embed src="http://www.youtube.com/v/' + id + '&rel=0" \
					type="application/x-shockwave-flash" wmode="transparent" \
					width="425" height="350"></embed></center>');
}

//
// VIDEOS
//

/*
 * Change embedded object to show youtube control for selected video
 * 
 * Params: (string) YoutubeId
 *
 */
function UpdateVideo(id)
{
    document.getElementById('videocontainer').innerHTML = '<param name="movie" value="http://www.youtube.com/v/' +id + '&rel=0"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' + id + '&rel=0" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed>\n<span class="heading" id="videoname"></span><br><span id="videoinfo"></span>';
	linkid = "link_" + id;
	infoid = "info_" + id;
	document.getElementById('videoname').innerHTML = document.getElementById(linkid).innerHTML;
	document.getElementById('videoinfo').innerHTML = document.getElementById(infoid).value;
}

