window.addEvent('domready', function() {

 $('currenttab').addEvent('click', function() {
  $('currenttab').removeClass('inactivetab');
  $('currenttab').addClass('activetab');
  $('oldtab').addClass('inactivetab');
  $('oldtab').removeClass('activetab');
  $('currentlist').set('style', 'display: block;');
  $('oldlist').set('style', 'display: none');
 });

 $('oldtab').addEvent('click', function() {
  $('currenttab').addClass('inactivetab');
  $('currenttab').removeClass('activetab');
  $('oldtab').addClass('activetab');
  $('oldtab').removeClass('inactivetab');
  $('oldlist').set('style', 'display: block;');
  $('currentlist').set('style', 'display: none');
 });

$$('.programme').each(function(obj){
 obj.addEvent('click',function(e){
  $$('#videotitle', '#videocaption').fade('hide');
  this.getElements('.caption').each(function(obj){
   $('videotitle').set('html', obj.get('html'));
  });
  this.getElements('.previewthumb').each(function(obj) {
   $('videocaption').set('html', obj.get('alt'));
  });
  $$('#videotitle', '#videocaption').fade('in');
 });

});

});


function playivideo(file) {
	$('video').set('html', '<video src="http://staticstream.sunseeker.com/sunseekervideo/'+file+'" width="660" controls="controls" autoplay="autoplay"></video>');
}


 function playvideo(file) {
   jwplayer("video").setup({
    flashplayer: "player.swf",
    height: 397,
    width: 660,
    streamer: "rtmp://s1f5gj4reee660.cloudfront.net/cfx/st",
    provider: "rtmp",
    autostart: "true",
    controlbar: "over",
    file: 'sunseekervideo/'+file
   });
  }
