// This file must be placed AFTER loading the main flowplayer javascript file


function linkplayers() {
     flowplayer("player", "flash/flowplayer/flowplayer-3.1.4.swf" ,{ 
		clip: { 
			 
			// these two configuration variables does the trick 
			autoPlay: false,  
			autoBuffering: true // <- do not place a comma here   
		} 
	 });
		
		
	if (document.getElementById("train_videolistblk")) {
		// get all links that are inside div#clips 
		var links = document.getElementById("train_videolistblk").getElementsByTagName("a"); 
	
		// loop those links and alter their click behaviour 
		for (var i = 0; i < links.length; i++) { 
			links[i].onclick = function() { 
				 
				// play the clip specified in href- attribute with Flowplayer 
				$f().play(this.getAttribute("href", 2));
				
				// update titla from alt
				
				document.getElementById("video_title").firstChild.nodeValue = this.getElementsByTagName("img")[0].getAttribute("alt");
				document.getElementById("video_descript").firstChild.nodeValue = this.getElementsByTagName("img")[0].getAttribute("longdesc");
				 
				// by returning false normal link behaviour is skipped 
				return false; 
			} 
		}
	
	}
	
}

window.onload = linkplayers;
