/*
 * ciabTrackAnnotationBox.js
 * functions needed in track annotation box
 * copyrighted (c) christian hartmann 2009 (hartmann it-design)
 */


function ShowTrackAnnotation(clipNum) {
//	alert("Show Track Annotation: " + clipNum);
	_UnshowAllTrackAnnotations();
	al[clipNum - 1].style.display = "block";
}

function UnshowTrackAnnotation(clipNum) {
	al[clipNum - 1].style.display = "none";
}

function _UnshowAllTrackAnnotations() {
	for (i=1; i<=al.length; i++) {
		UnshowTrackAnnotation(i);
	}
}

function InitTrackAnnotation() {
	var _cc = CallBoxFunc('ciabVideoPlayerBox', 'GetCurrentTrack', '');
	if ( _cc > 0 ) {
		ShowTrackAnnotation(_cc);
	} else {
		// current track is zero if autoPlay is false. 
		// so enforce annotation for track 1
		ShowTrackAnnotation(1);
	}
}

var al; // array holding all HTML <div> elements with clip annotations

window.onload = function() {
	// get the HTML <div> element containing all clip annotations
	var _ul = document.getElementById("ciabTrackAnnotationList");
	// get the individual clip annotations as an array
	al = _ul.getElementsByTagName("div"); // this array starts with zero!
	// get current track from player box and display corresponding annotation
	setTimeout("InitTrackAnnotation()", 500);
	// make firebug console working
	InitFirebugConsole(); // this is in ciabCommons.js
}
