if(280 <= 0 || 250 <= 0){
  document.write('<div id="container_player"><div id="player-wrapper"><div id="companion"></div><div id="player"></div></div></div>');
}else{
  document.write('<div id="container_player"><div id="player-wrapper"><div id="companion"></div><div id="player"></div></div><div id="pcontainer"><a class="go up"></a><div class="playlist"><div id="container_clips" class="clips low"></div></div><a class="go down"></a></div></div>');
}

  lazy_load_jQuery = function() {
    lazy_load_jQuery.getScript("http://cdn.clipkit.de/lib/js/jquery.js");

    lazy_load_jQuery.tryReady(0);
  }

  lazy_load_jQuery.getScript = function(filename) {
    var fileref = document.createElement('script');
    fileref.setAttribute("type","text/javascript");
    fileref.setAttribute("src", filename);
    if (typeof fileref!="undefined"){
        document.getElementsByTagName("head")[0].appendChild(fileref);
    }
  }

  lazy_load_jQuery.tryReady = function(time_elapsed) {
    if (typeof jQuery == "undefined") {
      if (time_elapsed <= 5000) {
        setTimeout("lazy_load_jQuery.tryReady(" + (time_elapsed + 200) + ")", 200);
      }
    } else {
      jQuery.noConflict();
      lazy_load_flowplayer();
    }
  }

  /*
   * Start Loading...
   */
  if (typeof jQuery == "undefined") {

    lazy_load_jQuery();

  } else {
    jQuery(function(){
      lazy_load_flowplayer();
    });
  }
  function lazy_load_flowplayer(){
    if (typeof flowplayer == "undefined") {
      jQuery.ajax({
        url: 'http://cdn.clipkit.de/lib/js/flowplayer.js',
        type: 'GET',
        dataType: 'script',
        cache: true,
        success: function(response) {
          lazy_load_flowplayer_playlist();
        }
      })
    } else {
      lazy_load_flowplayer_playlist();
    }
  }

  function lazy_load_flowplayer_playlist(){
    jQuery.ajax({
      url: 'http://cdn.clipkit.de/lib/js/flowplayer.playlist.js',
      type: 'GET',
      dataType: 'script',
      cache: true,
      success: function(response) {
        lazy_load_flowplayer_fallbackad();
      }
    });
  }

  function lazy_load_flowplayer_fallbackad(){
    if(typeof fallbackCall == "undefined"){
      jQuery.ajax({
        url: 'http://cdn.clipkit.de/lib/js/clipkit.fallbackad.js',
        type: 'GET',
        dataType: 'script',
        cache: true,
        success: function(response) {
          load_player_config();
        }
      });
    }else{
      load_player_config();
    }
  }

  function lazy_load_flowplayer_nuggad(){

    var config = playlistConfig;
    if(typeof config.user.plugins.nuggad.nuggrid == 'undefined'){
        var nuggrid = encodeURIComponent(top.location.href);
      }else{
        var nuggrid = config.user.plugins.nuggad.nuggrid;
      }
      
    var nuggn = config.user.plugins.nuggad.nuggn;
    var nuggsid = config.user.plugins.nuggad.nuggsid;

    jQuery.ajax({
        url: "http://clipkit.nuggad.net/rc?nuggn="+nuggn+"&nuggsid="+nuggsid+"&nuggrid=" + nuggrid,
        type: 'GET',
        dataType: 'script',
        cache: false,
        success: function(response) {
          if(typeof n_pbt != 'undefined'){
            playlistConfig.user.plugins.liverail.LR_TAGS  += ',' + (n_pbt.replace(';',',').replace(';',''));
          }
          init_player();
        },
        error: function(){
          init_player();
        }
      });
    
  }

  var playlistConfig;

  function load_player_config() {
    jQuery.ajax({
      type: 'GET',
      url: 'http://signin.clipkit.de/206/player/191/playlist/419/config.json',
      dataType: 'jsonp',
      success: function(response) {
        playlistConfig = response;
        if(typeof response.user.plugins.nuggad != 'undefined' && response.user.plugins.liverail != 'undefined'){
            lazy_load_flowplayer_nuggad();
        }else{
             init_player();  
        }

        init_css();
       }
    });
  }

  function init_css(){
    jQuery("head").append('<link rel="stylesheet" href="http://cdn.clipkit.de/206/playlist/template/playlist.css" type="text/css" />');
  }


  function init_player() {
    var config = playlistConfig;

    jQuery('#player').css({
      'width': config.player.css.width + 'px',
      'height': config.player.css.height + 'px'
    });
    jQuery('#player-wrapper').css({
      'width': config.player.css.width + 'px',
      'height': config.player.css.height + 'px'
    });
    jQuery('#container_player').css({
      'width': config.player.css.width + 'px',
      'height': config.player.css.height + 'px'
    });
    var actualTime = new Date();

    var playerParams = {
      width: config.player.css.width + 'px',
      height: config.player.css.height + 'px',
      logo: config.player.logo,
      clip: config.clip,
      canvas: config.player.canvas,
      playlist: config.playlist+'?'+actualTime.getTime(),
      plugins: {
        controls: config.player.plugins.controls
      },
      onLoad: function() {
            jQuery("#pcontainer").css({
                visibility:'visible'
            });
            var playlistHeight = 250;

            var playlistElementHeight = 50;
            var upDownButtonHeight = 16;
            
            var elemCount = parseInt((playlistHeight-2*upDownButtonHeight) / playlistElementHeight);

            jQuery("div.playlist").scrollable({
                items:'div.clips',
                vertical:true,
                size: elemCount, //Anzahl der sichtbaren elemente ohne scrollen
                next:'a.down',
                prev:'a.up'
            });

            //jQuery('a.go.down').toggleClass('disabled');

        var playlistObj = this.getPlaylist();

        var splashScreen = "http://cdn.clipkit.de/227/video/93635/thumbnails/previous.png?phash=4fa24e53a931513cefabe6ba722f0a2d";

        if(splashScreen != playlistObj[0].url)
        {
          var newClip = {
            scaling: 'fit',
            url: splashScreen,
            title: 'Preview'
          };

          this.addClip(newClip,0);

          this.play(0);

          if(this.getCommonClip().autoMute == true){
              this.mute();
          }else{
              this.unmute();
          }
         }
      }

    };
    if(config.player.autoMute != 'undefined'){
        if(playerParams.clip.autoMute == 'undefined'){
            playerParams.clip.autoMute = config.player.autoMute;
        }
        playerParams.clip.autoMute = playerParams.clip.autoMute || config.player.autoMute;
    }
    if(typeof config.user.plugins.liverail != "undefined" && typeof config.user.plugins.liverail.LR_PUBLISHER_ID != "undefined"){
      playerParams.plugins.liverail = config.user.plugins.liverail;
      if(typeof config.clip.clipkitPlaylistId != "undefined"){
        playerParams.plugins.liverail.LR_VIDEO_AMID = config.clip.clipkitPlaylistId;
      }
    }

    if(typeof config.user.plugins.secure_stream != 'undefined'){
        playerParams.plugins.secure_stream = config.user.plugins.secure_stream;
    }

    if(typeof config.user.plugins.openAdFallback != "undefined"){
      playerParams.plugins.openAdFallback = config.user.plugins.openAdFallback;
    }

    flowplayer('player', {src: 'http://cdn.clipkit.de/lib/swf/v-3.2.5/clipkitplayer.swf', wmode: 'opaque' }, playerParams);
    


    if(280 > 0 || 250 > 0){

      if(parseInt(config.player.css.height) > parseInt(250))
      {
        var playlistheight = parseInt(config.player.css.height);
      }
      else
      {
        var playlistheight = parseInt(250);
      }

      if('bottom' == 'left'){
        jQuery('#container_player').css({
          'width': config.player.css.width + 'px',
          'height': playlistheight + 'px'
        });
        jQuery('#pcontainer').css({
          'width': 280 + 'px',
          'height':250 - 2 + 'px',
          'left': 0,
          'top': 0
        });
        jQuery('#player-wrapper').css({
          'width': config.player.css.width + 'px',
          'height': config.player.css.height + 'px',
          'left': 280 + 'px',
          'top': 0
        });
      }else if('bottom' == 'right'){
        jQuery('#container_player').css({
          'height': playlistheight + 'px'
        });
        jQuery('#pcontainer').css({
          'width': 280 + 'px',
          'height':250 - 2 + 'px',
          'left': config.player.css.width + 'px',
          'top': 0
        });
        jQuery('#player-wrapper').css({
          'width': config.player.css.width + 'px',
          'height': config.player.css.height + 'px',
          'left': 0,
          'top': 0
        });
      }else if('bottom' == 'top'){
        jQuery('#container_player').css({
          'height': (parseInt(config.player.css.height) + parseInt(250)) + 'px'
        });
        jQuery('#pcontainer').css({
          'width': 280 + 'px',
          'height':250 - 2 + 'px',
          'left': 0,
          'top': 0
        });
        jQuery('#player-wrapper').css({
          'width': config.player.css.width + 'px',
          'height': config.player.css.height + 'px',
          'left': 0,
          'top': 250 + 'px'
        });
      }else{// if('bottom' == 'bottom'){
        jQuery('#container_player').css({
          'height': (parseInt(config.player.css.height) + parseInt(250)) + 'px'
        });
        jQuery('#pcontainer').css({
          'width': 280 + 'px',
          'height':250 - 2 + 'px',
          'left': 0,
          'top': config.player.css.height + 'px'
        });
        jQuery('#player-wrapper').css({
          'width': config.player.css.width + 'px',
          'height': config.player.css.height + 'px',
          'left': 0,
          'top': 0
        });
      }

      jQuery('div.playlist').css({
        'height': 250 - 32 + 'px',
        'width': 280  + 'px',
        'overflow': 'hidden'
      });

      flowplayer('player').playlist("div.clips", {
          preview: 1,
          loop: true,
          template: '<a href="${url}" class="first ${clipkit:className}" title="Clip abspielen / anhalten"><img src="${clipkit:imagePath}"><span><b>${title}</b><br />${clipkit:vdescription}</span><br /></a>'});

	  if(typeof config.user.clickThruTracker != "undefined"){

	    	var trackerCode = '<object width="1" height="1">';
	    	trackerCode += '<param name="movie" value="http://cdn.clipkit.de/lib/swf/clipkit.third-party-ad-tracker.swf"></param>';
	    	trackerCode += '<param name="allowFullScreen" value="true"></param>';
	    	trackerCode += '<param name="allowscriptaccess" value="always"></param>';
	    	trackerCode += '<param name="flashvars" value="pc=' + config.user.clickThruTracker + '&publisher=' + config.user.website + '&lr_publisher=' + config.user.plugins.liverail.LR_PUBLISHER_ID + '"></param>';
	    	trackerCode += '<embed src="http://cdn.clipkit.de/lib/swf/clipkit.third-party-ad-tracker.swf" flashvars="pc=' + config.user.clickThruTracker + '&publisher=' + config.user.website + '&lr_publisher=' + config.user.plugins.liverail.LR_PUBLISHER_ID + '" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="1" height="1"></embed>';
	    	trackerCode += '</object>';


	    	jQuery('#container_player').append( trackerCode );
	   }
    }
  }

  /*
   * tools.scrollable 1.1.2 - Scroll your HTML with eye candy.
   *
   * Copyright (c) 2009 Tero Piirainen
   * http://flowplayer.org/tools/scrollable.html
   *
   * Dual licensed under MIT and GPL 2+ licenses
   * http://www.opensource.org/licenses
   *
   * Launch  : March 2008
   * Date: ${date}
   * Revision: ${revision}
   */
  if(typeof jQuery != "undefined" && typeof jQuery.scrollable == "undefined"){
    (function(b){b.tools=b.tools||{};b.tools.scrollable={version:"1.1.2",conf:{size:5,vertical:false,speed:400,keyboard:true,keyboardSteps:null,disabledClass:"disabled",hoverClass:null,clickable:true,activeClass:"active",easing:"swing",loop:false,items:".items",item:null,prev:".prev",next:".next",prevPage:".prevPage",nextPage:".nextPage",api:false}};var c;function a(o,m){var r=this,p=b(this),d=!m.vertical,e=o.children(),k=0,i;if(!c){c=r}b.each(m,function(s,t){if(b.isFunction(t)){p.bind(s,t)}});if(e.length>1){e=b(m.items,o)}function l(t){var s=b(t);return m.globalNav?s:o.parent().find(t)}o.data("finder",l);var f=l(m.prev),h=l(m.next),g=l(m.prevPage),n=l(m.nextPage);b.extend(r,{getIndex:function(){return k},getClickIndex:function(){var s=r.getItems();return s.index(s.filter("."+m.activeClass))},getConf:function(){return m},getSize:function(){return r.getItems().size()},getPageAmount:function(){return Math.ceil(this.getSize()/m.size)},getPageIndex:function(){return Math.ceil(k/m.size)},getNaviButtons:function(){return f.add(h).add(g).add(n)},getRoot:function(){return o},getItemWrap:function(){return e},getItems:function(){return e.children(m.item)},getVisibleItems:function(){return r.getItems().slice(k,k+m.size)},seekTo:function(s,w,t){if(s<0){s=0}if(k===s){return r}if(b.isFunction(w)){t=w}if(s>r.getSize()-m.size){return m.loop?r.begin():this.end()}var u=r.getItems().eq(s);if(!u.length){return r}var v=b.Event("onBeforeSeek");p.trigger(v,[s]);if(v.isDefaultPrevented()){return r}if(w===undefined||b.isFunction(w)){w=m.speed}function x(){if(t){t.call(r,s)}p.trigger("onSeek",[s])}if(d){e.animate({left:-u.position().left},w,m.easing,x)}else{e.animate({top:-u.position().top},w,m.easing,x)}c=r;k=s;v=b.Event("onStart");p.trigger(v,[s]);if(v.isDefaultPrevented()){return r}f.add(g).toggleClass(m.disabledClass,s===0);h.add(n).toggleClass(m.disabledClass,s>=r.getSize()-m.size);return r},move:function(u,t,s){i=u>0;return this.seekTo(k+u,t,s)},next:function(t,s){return this.move(1,t,s)},prev:function(t,s){return this.move(-1,t,s)},movePage:function(w,v,u){i=w>0;var s=m.size*w;var t=k%m.size;if(t>0){s+=(w>0?-t:m.size-t)}return this.move(s,v,u)},prevPage:function(t,s){return this.movePage(-1,t,s)},nextPage:function(t,s){return this.movePage(1,t,s)},setPage:function(t,u,s){return this.seekTo(t*m.size,u,s)},begin:function(t,s){i=false;return this.seekTo(0,t,s)},end:function(t,s){i=true;var u=this.getSize()-m.size;return u>0?this.seekTo(u,t,s):r},reload:function(){p.trigger("onReload");return r},focus:function(){c=r;return r},click:function(u){var v=r.getItems().eq(u),s=m.activeClass,t=m.size;if(u<0||u>=r.getSize()){return r}if(t==1){if(m.loop){return r.next()}if(u===0||u==r.getSize()-1){i=(i===undefined)?true:!i}return i===false?r.prev():r.next()}if(t==2){if(u==k){u--}r.getItems().removeClass(s);v.addClass(s);return r.seekTo(u,time,fn)}if(!v.hasClass(s)){r.getItems().removeClass(s);v.addClass(s);var x=Math.floor(t/2);var w=u-x;if(w>r.getSize()-t){w=r.getSize()-t}if(w!==u){return r.seekTo(w)}}return r},bind:function(s,t){p.bind(s,t);return r},unbind:function(s){p.unbind(s);return r}});b.each("onBeforeSeek,onStart,onSeek,onReload".split(","),function(s,t){r[t]=function(u){return r.bind(t,u)}});f.addClass(m.disabledClass).click(function(){r.prev()});h.click(function(){r.next()});n.click(function(){r.nextPage()});if(r.getSize()<m.size){h.add(n).addClass(m.disabledClass)}g.addClass(m.disabledClass).click(function(){r.prevPage()});var j=m.hoverClass,q="keydown."+Math.random().toString().substring(10);r.onReload(function(){if(j){r.getItems().hover(function(){b(this).addClass(j)},function(){b(this).removeClass(j)})}if(m.clickable){r.getItems().each(function(s){b(this).unbind("click.scrollable").bind("click.scrollable",function(t){if(b(t.target).is("a")){return}return r.click(s)})})}if(m.keyboard){b(document).unbind(q).bind(q,function(t){if(t.altKey||t.ctrlKey){return}if(m.keyboard!="static"&&c!=r){return}var u=m.keyboardSteps;if(d&&(t.keyCode==37||t.keyCode==39)){r.move(t.keyCode==37?-u:u);return t.preventDefault()}if(!d&&(t.keyCode==38||t.keyCode==40)){r.move(t.keyCode==38?-u:u);return t.preventDefault()}return true})}else{b(document).unbind(q)}});r.reload()}b.fn.scrollable=function(d){var e=this.eq(typeof d=="number"?d:0).data("scrollable");if(e){return e}var f=b.extend({},b.tools.scrollable.conf);d=b.extend(f,d);d.keyboardSteps=d.keyboardSteps||d.size;this.each(function(){e=new a(b(this),d);b(this).data("scrollable",e)});return d.api?e:this}})(jQuery);
  }
