// JavaScript Document
function videoframe_player_ini () {
	videoframe_playlist = new Array();
}

function videoframe_player_add (player, tmp_path, title, description) {
	videoframe_playlist_sub = new Array();

	//player
	videoframe_playlist_sub[0] = player;
	
	//path
	if (player == 'yt') {
		path = /\?v=(.{11})/i.exec(tmp_path);
		videoframe_playlist_sub[1] = path[1];
	} else {
		videoframe_playlist_sub[1] = tmp_path;
	}
	
	//title
	videoframe_playlist_sub[2] = title;
	
	//description
	videoframe_playlist_sub[3] = description;
	
	videoframe_playlist.push(videoframe_playlist_sub);
}

function videoframe_play (array_id) {
	if (videoframe_playlist[array_id][0] == 'yt') {
		document.getElementById('videoframe_videoplayer').innerHTML = '<object width="320" height="265" wmode="transparent"><param name="movie" value="http://www.youtube.com/v/' + videoframe_playlist[array_id][1] + '&amp;hl=en_US&amp;fs=1&amp;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' + videoframe_playlist[array_id][1] + '&amp;hl=en_US&amp;fs=1&amp;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="320" height="265" wmode="transparent" ></embed></object>';
	} else {
		document.getElementById('videoframe_videoplayer').innerHTML = '<object width="320" height="260" type="application/x-shockwave-flash" wmode="transparent" data="http://www.bridgesthatunite.ca/storage/video1/mediaplayer.swf?file=' + videoframe_playlist[array_id][1] + '&amp;autoStart=false"><param name="movie" value="http://www.bridgesthatunite.ca/storage/video1/mediaplayer.swf?file=' + videoframe_playlist[array_id][1] + '&amp;autoStart=false" /><param name="wmode" value="transparent" /></object>';
	}
	
	document.getElementById('videoframe_title').innerHTML = videoframe_playlist[array_id][2];
	document.getElementById('videoframe_description').innerHTML = videoframe_playlist[array_id][3];	
}

function videoframe_list () {		
	videoframe_playlist_length = videoframe_playlist.length;
	
	thisplaylist_content = '';
	
	for (i=0; i<videoframe_playlist_length; i++) {
		thisplaylist_content += '<a href="javascript:videoframe_play(' + i + ')" style="display: block;min-height:16px;height:auto !important;height:16px;padding-top: 4px;padding-bottom: 4px;padding-left: 8px;padding-right: 8px;color: #FFFFFF;text-decoration: none;font-family:Arial, Helvetica, sans-serif;font-size: 12px;"><div class="videoframe_playlist_bullet">&raquo;</div>' + videoframe_playlist[i][2] + '</a>';
	}
	
	document.getElementById('videoframe_playlist_container').innerHTML = thisplaylist_content;
	
	if (videoframe_playlist.length) {
		videoframe_play(0);
	}
}
