var cc914_channel=81;  var cc914loaded = 0; var cc914livecode = 0;  function cc914togglechat(c){ if ($('#cc914_box_live_iframe').is(":visible"))$('#cc914_box_live_iframe').hide(); else { $('#cc914_box_live_iframe').html('<iframe scrolling="no" frameborder="0" width="350" height="450" src="'+cc914_baseurl+'inc/coverit.php?alcast='+c+'"></iframe>'); $('#cc914_box_live_iframe').show(); } } function cc914loadLive(i,e,b,c){  cc914loaded = i; if(cc914_actulive != i){ cc914_actulive = i; $('#cc914_box_live_vid').html('<iframe frameborder="0" width="630" height="354" src="'+e+'"></iframe>'); $('#cc914_box_live').css("background-image", "url("+b+")"); if(c!=''){ $('#cc914_box_live_head a').show().click(function(){  cc914togglechat(c);  return false; });  } } }   function cc914checkLive(){  cc914naction =0;  cc914cntime = new Date(); cc914acttime = Math.round(cc914cntime.getTime()/1000);  var cc914livecodechk = '';   $.each(cc914_liveinfo, function(index, vid){   if(vid.start<=cc914acttime && cc914acttime<=vid.end){   cc914livecodechk+=(vid.liveid);  cc914naction++;  }   });   if(cc914livecodechk!=cc914livecode){ console.log('livechk : '+cc914livecodechk+ ' '+cc914livecode+' nx:'+cc914naction);  cc914livecode = cc914livecodechk; $("#lisvids").html('');  $.each(cc914_liveinfo, function(index, vid){  if(vid.start<=cc914acttime && cc914acttime<=vid.end){ if(cc914_actulive != vid.liveid)$("#lisvids").append( '<a href="javascript:void(0)" id="c914btn'+vid.liveid+'" onclick="cc914loadLive(\''+vid.liveid+'\',\''+vid.embed+'\',\''+vid.bg+'\',\''+vid.coveritid+'\')">'+vid.name+'</a>');  cc914loadLive(vid.liveid,vid.embed,vid.bg,vid.coveritid);  }  });  }   if (cc914naction==0){  $('#cc914_box_live').hide();  $('#cc914_box').show();  $('#cc914_box_live_vid').html('');  cc914_modelive = 0;  } else {  $('#cc914_box_live').show();  $('#cc914_box').hide();  cc914_modelive = 1;  }  setTimeout("cc914checkLive()",1000); }  var cc914_actulive = ''; var cc914_liveinfo = []; var cc914_modelive = 0; var cc914_baseurl = "http://www.rtl.be/webservices/sites/widgets/livebox/"; $(document).ready(function(){  $('head').append('<link rel="stylesheet" href="'+cc914_baseurl+'css/style.css" type="text/css" />'); $('#cc914_box_place').html('<div id="cc914_box_live" style="display:none"><div id="cc914_box_live_iframe"></div><div id="cc914_box_live_head"><a style="display:none" href="">Réagissez en direct</a></div><div id="cc914_box_live_vid"></div><div id="lisvids"></div></div><div id="cc914_box" ><div class="cc914_headtitle" id="cc914_headtitle"></div><div class="cc914_carousel"><button type="button" data-role="none" onclick="$(\'.cc914_list\').slickPrev(); return false" style="display:none" class="cc914_slick-prev cc914_slick-disabled" style="display: block;">Previous</button><button type="button" data-role="none" class="cc914_slick-next" style="display:none" onclick="$(\'.cc914_list\').slickNext(); return false" style="display: block;">Next</button><div class="cc914_holder"> <div class="slider cc914_list"></div></div></div></div>'); $.getJSON( cc914_baseurl+"flux/lastvid.php", function( data){  $('#cc914_headtitle').html('<a href="'+data.link+'">RTL INFO '+data.pfx+'H EN INTEGRALITE</a><span>'+data.title+'</span>');  $.each( data.videos, function( key, val){  $('.cc914_list').slickAdd('<div><a href="'+val.url+'" class="cc914_img"><span class="cc914_hoverplay"></span><img src="'+val.img+'"/><span class="cc914_txt">'+val.title+'</span></a></div>');   });  });  $('.cc914_list').slick({  dots: true,  infinite: false,  placeholders: false,  speed: 300,  centerPadding: '60px',  slidesToShow: 4,  touchMove: false,  slidesToScroll: 3,  asNavFor: '.slider-for',  arrows : false   });  if($('#sl45_html').length <30){  var sl45_ttd = new Date();  var sl45_ttdn = sl45_ttd.getHours()+'-'+sl45_ttd.getMinutes();   console.log ('loading live infos');  /*$.getJSON( "flux/live.json", function( data2){*/   $.getJSON( cc914_baseurl+"flux/live.php?"+sl45_ttdn, function( data2){  cc914_liveinfo = data2;  console.log ('flux live infos'); console.log (cc914_liveinfo);  setTimeout("cc914checkLive()",1000); });  setTimeout(function (){  if(cc914_liveinfo.length<1){   $.getJSON( cc914_baseurl+"flux/live.php?"+sl45_ttdn, function( data2){  cc914_liveinfo = data2;  console.log ('flux live infos backup'); console.log (cc914_liveinfo);  }); } }, 15000); }  });