function setUpFlowplayerWithCuepoints(player_id, slide_id, clip_uri, cuepoints_xml_uri) {
  function timeToCuepoint(time) {
    var hms = time.split(':');
    var secs = parseInt(hms[0], 10) * 3600 + parseInt(hms[1], 10) * 60 + parseInt(hms[2], 10);
    return secs * 1000;
  }
  var cuepoints = {};
	$(function() {
	  $.ajax({
	    type: 'GET',
	    url: cuepoints_xml_uri,
	    dataType: 'xml',
	    success: xmlLoaded
	  });
	});
	function xmlLoaded(xml) {
    $(xml).find('cuepoint').each(function() {
      var time = $(this).find('time').text();
      time = timeToCuepoint(time);
      var html = $(this).find('html').text();
      var jumper = $(this).find('jumper').text();
      cuepoints[time] = {}
      cuepoints[time]['html'] = html;
      cuepoints[time]['jumper'] = jumper;
    });
	  var cuepoints_raw = [];
	  for (var i in cuepoints) {
	      if (typeof console != 'undefined') console.log('Set cuepoint:', i);
	      cuepoints_raw.push(parseInt(i));
	  } 
	  function generateJumper(player_id, cuepoint, label) {
	    var jumper = document.createElement('option');
	    jumper.value = parseInt(cuepoint)/1000;
	    jumper.text = label;
	    // var jumper = '<option value="' + parseInt(cuepoint)/1000 + '">' + label + '</option>';
	    return jumper;
	  }
	  var slide_jumper = document.getElementById('slide_jumper');
	  for (var i in cuepoints) {
	    if (typeof cuepoints[i].jumper != 'undefined') {
	      var cuepoint = i;
	      var label = cuepoints[i].jumper;
	      slide_jumper.options[slide_jumper.length] = generateJumper(player_id, cuepoint, label);
	    } 
	  }
	  var slide = document.getElementById(slide_id);
	  function setSlide(point) {
	    if (typeof console != 'undefined') console.log('Passed cuepoint:', point);
	    slide.innerHTML = cuepoints[point].html;
	    var index = 0;
	    for (var i in cuepoints) {
	      if (i == point) {
	        if (typeof console != 'undefined') console.log(i, 'found at index', index);
	        break;
	      }
	      index ++;
	    }
	    slide_jumper.selectedIndex = index;
	  }
	  $f(player_id, '../shared/flowplayer.commercial-3.2.1.swf', { 
		  // KEY PRO-VERSION PRESSEAGENTUR.COM
		 key: '#$1af29b4705a52b5370c', 
		  contextMenu: [ 
			  'MEXPERTS.TV Player 3.2.1'
			],
	    // configure clip to use "lighthttpd" plugin for providing video data 
	    clip: { 
	      url: clip_uri, 
	      autoPlay: true,
	      autoBuffering: false,
	      provider: 'lighttpd',
	      onCuepoint: [cuepoints_raw, function(clip, point) {
	        setSlide(point);
	      }],
	      onSeek: function(clip) {
	        setTimeout(function() {
	          var ct = $f(player_id).getTime();
	          ct *= 1000;
	          for (var i = 0; i < cuepoints_raw.length; i++) {
	            c = cuepoints_raw[i]
	            if (c > ct) break;
	          }
	          var last_cp = cuepoints_raw[i - 1];
	          setSlide(last_cp);
	        }, 200);
	      },
	      onStart: function(clip) {
	        if (typeof console != 'undefined') console.log('Started clip');
	        if (typeof $f(player_id).seek_todo != 'undefined') {
	          if (typeof console != 'undefined') console.log('Jumping to:', $f(player_id).seek_todo);
	          $f(player_id).seek($f(player_id).seek_todo);
	          $f(player_id).seek_todo = 'undefined';
	        }
	      }
	    }, 
	    // streaming plugins are configured normally under plugins node 
	    plugins: { 
	      lighttpd: { 
	        url: '../shared/flowplayer.pseudostreaming-3.2.1.swf' 
	      },
		    // CONTROLS STEUERN, Komma hinter Klammer nicht vergessen
		    // Komma bitte nur, wenn noch weitere Eigenschaften folgen, sonsts krachts im IE!
			
			//  controls: { 
			//    all:false, 
			//    autoHide: 'always',
			//    hideDelay: 4000,
             //   backgroundColor: '#333333', 
			//    backgroundGradient: 'none',             
          	//	scrubber:true, 
			//    mute:true,
			//    time:true, 
 			//	play:true, 
			//	volume:true, 
			//	mute:true, 
			//	time:true, 
			//	stop:false,
			//	fontColor: '#FFFFFF',
			//	timeFontColor: '#FFFFFF',
			//	progressColor: '#FFFFFF'
			  
		   // }
		   
		   
		   // Google Analytics Tracker
		   
		   gatracker: {
		 	url: "../shared/flowplayer.analytics-3.2.0.swf",
		 	labels: {
			start: "Start",	
			play: "Play",	
			pause: "Pause",	
		    resume: "Resume",	
		    seek: "Seek",	
		    stop: "Stop",	
		    finish: "Finish",	
		    mute: "Mute",	
		    unmute: "Unmute",	
			fullscreen: "Full Screen",	
			fullscreenexit: "Full Screen Exit"	
		 	},
		 	debug: false,
		 	trackingMode: "AS3",
		 	googleId: "UA-579918-13" // your Google Analytics id here
	 	},
				
			
			
			
	controls: {"timeColor":"#ffffff","borderRadius":"0px","slowForward":true,"bufferGradient":"none","backgroundColor":"rgba(0, 0, 0, 0)","volumeSliderGradient":"none","slowBackward":false,"timeBorderRadius":20,"progressGradient":"none","time":true,"height":26,"volumeColor":"#4599ff","tooltips":{"marginBottom":5,"volume":true,"scrubber":true,"buttons":false},"opacity":1,"fastBackward":false,"timeFontSize":12,"volumeSliderColor":"#ffffff","bufferColor":"#a3a3a3","border":"0px","buttonColor":"#ffffff","mute":true,"autoHide":{"enabled":true,"hideDelay":500,"hideStyle":"fade","mouseOutDelay":500,"hideDuration":400,"fullscreenOnly":false},"backgroundGradient":"none","width":"100pct","sliderBorder":"1px solid rgba(128, 128, 128, 0.7)","display":"block","buttonOverColor":"#ffffff","fullscreen":false,"timeBgColor":"rgb(0, 0, 0, 0)","scrubberBarHeightRatio":0.2,"bottom":0,"stop":false,"sliderColor":"#000000","zIndex":1,"scrubberHeightRatio":0.6,"tooltipTextColor":"#ffffff","sliderGradient":"none","timeBgHeightRatio":0.8,"volumeSliderHeightRatio":0.6,"name":"controls","timeSeparator":" ","volumeBarHeightRatio":0.2,"left":"50pct","tooltipColor":"rgba(0, 0, 0, 0)","playlist":false,"durationColor":"#b8d9ff","play":true,"fastForward":true,"timeBorder":"0px solid rgba(0, 0, 0, 0.3)","progressColor":"#4599ff","scrubber":true,"volume":true,"volumeBorder":"1px solid rgba(128, 128, 128, 0.7)","builtIn":false}
			
			
			
			
			
			
	    }
	  });
	}
}
function jumpTo(player_id, sec) {
  if (!$f(player_id).isLoaded()) {
    $f(player_id).seek_todo = sec;
    $f(player_id).play();
  } else {
    $f(player_id).seek(sec);
  }
  return false;
}

