loadMeUp += "initVideoPanel();";

function initVideoPanel() {
	if (document.getElementById('videoOptions')) {
		videoThumbnailEls = new Array();
		imgs = document.getElementsByTagName('IMG');
		k=2;
		for(i=0;i<imgs.length;i++) {
			el = imgs[i];
			if (el.className.indexOf('videoThumb')==0) {
				el.setAttribute('videoNum',k);
				el.setAttribute('title',el.getAttribute('alt'));
				el.onmouseover = function() {
					
				}
				el.onmouseout = function() {
					
				}
				el.onclick = function() {
					switchVideo(this.getAttribute('videoNum'));
				}
				k--;
				videoThumbnailEls[videoThumbnailEls.length] = el;
			}
		}
	}
}

function toggleVideoEmbedCode() {
	el = document.getElementById('videoCode');
	el.style.display = (el.style.display=='block') ? 'none' : 'block';
	matchColumns();
}

function switchVideo(videoNum) {
	for(v=0;v<3;v++) {
		el = videoThumbnailEls[v];
		el.className = (el.getAttribute('videoNum')==videoNum) ? 'videoThumbSelected' : 'videoThumb';
	}
	videoId = videoIds[videoNum];
	videoTitle = videoTitles[videoNum];
	videoDesc = videoDescriptions[videoNum];
	videoURL = videoURLs[videoNum];
	
	el = document.getElementById('videoPlayer');
	el.innerHTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='246' height='186'><param name='movie' value='http://www.animalsaustralia.org/swf/video.swf?v="+videoId+"' /><param name='quality' value='high' /><param name='wmode' value='transparent' /><param name='flashvars' value='aa=1' /><embed src='http://www.animalsaustralia.org/swf/video.swf?v="+videoId+"' flashvars='aa=1' wmode='transparent' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='246' height='186'></embed></object>";

	el = document.getElementById('videoLink1');
	el.innerHTML = videoTitle;
	el.href = "/media/videos.php?vid="+videoId;

	el = document.getElementById('videoLink2');
	el.href = "/media/videos.php?vid="+videoId;

	el = document.getElementById('videoLink3');
	el.href = "/media/videos.php?vid="+videoId;

	el = document.getElementById('videoDescription');
	el.innerHTML = videoDesc;
	
	el = document.getElementById('videoCodeBox');
	el.value = "<div style='background:#000;width:370px;padding:4px;'><embed src='http://www.animalsaustralia.org/swf/video.swf?v="+videoId+"' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='370' height='280'></embed></div><a href='http://www.animalsaustralia.org/?ref="+videoId+"'>More videos from Animals Australia</a>";
	
}