 String.prototype.endsWith = function(str){return (this.match(str+"$")==str)} 
 
 $(document).ready(function(){
	var flowplayerKey = "#@c3060e16cd94e709bb8";
	
	var domain = window.location.hostname; 
	
	if(domain.endsWith("wurnet.nl"))
		flowplayerKey = "#@de25674d4635dbeb3f3";
	
	if(domain.endsWith("wageningenuniversity.nl"))
		flowplayerKey = "#@937a7cb2e6b257209cd";
	
	
	 flowplayer("a.rtmp-player", "/Wever.internet/thema/js/flowplayer.commercial-3.1.1.swf", {
		key: flowplayerKey,
		clip: {
			provider: 'rtmp',
			autoPlay:false,
			autoBuffering:true		
			
		},  
		
		plugins: {
			rtmp: {
				url: '/Wever.internet/thema/js/flowplayer.rtmp-3.1.0.swf',
				netConnectionUrl: 'rtmp://www.streaming.wur.nl/vod/'
			}
		}
		});	
	
	$("a.rtmp-player").click(function(){
		var firstfilm = $(".VideoWidget #slideshow a:first").attr("href");
		$f().play(firstfilm); 
	});
	
	$('#slideshow').serialScroll({
		items:'a',
		prev:'#screen2 a.prev',
		next:'#screen2 a.next',
		duration:1500,
		exclude:3,
		force:false,
		stop: true,
		lock: false,
		cycle:true,
		jump:false,
		easing:'easeInOutBack',
		axis:'y',
		step:1 // scroll 2 news each time
	});	
          

	var links = $(".VideoWidget #slideshow a").each(function(i){
		$(this).click(function(){
				
				$f().play($(this).attr("href")); 
				return false;
				
		});
	});
	
		
	if($(".VideoWidget #slideshow a").length < 5)
	{
		$(".VideoWidget #screen2 a.prev").hide();
		$(".VideoWidget #screen2 a.next").hide();
	}

		

   
 });
 


