function toggleVideos() {
	var container;
	if (container = document.getElementById('videos')) {
		var display = document.getElementById('video-display');
		var videos = display.getElementsByTagName('li');
		
		var menu = document.createElement('ul');
		menu.id = 'video-menu';
		
		var length = videos.length;
		for (x = 0; x < length; x++) {		
			// link innerHTML grabbed from video's title attribute
			var menuItem = document.createElement('li');
			menuItem.id = 'video-link-'+x;
			
			// with link if first, otherwise without link
			if (x == 0) {
				menuItem.innerHTML = videos[x].title;
			} else {
				menuItem.innerHTML = '<a href="#">'+videos[x].title+'</a>';
			}
			
			// onclick for each link: hide all but requested video and remove the link from the active video
			menuItem.onclick = function() {
				for (y = 0; y < length; y++) {
					var menuItems = menu.childNodes;
					if (menuItems[y].id == this.id) {
						videos[y].style.display = 'block';
						menuItems[y].innerHTML = videos[y].title;
					} else {
						videos[y].style.display = 'none';
						menuItems[y].innerHTML = '<a href="#">'+videos[y].title+'</a>';
					}
				}
				return false;
			}
			
			// hide all but first video
			if (x != 0) {
				videos[x].style.display = 'none';
			}
			
			menu.appendChild(menuItem);
		}
		container.appendChild(menu);
	}
}

addLoadEvent(toggleVideos);