function load(num) {
    http = getHTTPObject();
    http.onreadystatechange = update;
    http.open("GET", "/typo3conf/ext/youtubetv/get.php?n="+num, true);
    http.send(null);

    http1 = getHTTPObject();
    http1.onreadystatechange = updatecomment;
    http1.open("GET", "/typo3conf/ext/youtubetv/get.php?c="+num, true);
    http1.send(null);

    for (i=1; i<=5; i++) {
        document.getElementById('clipi'+i).style.backgroundImage = "url(/fileadmin/templates/images/"+i+".gif)";
    }
    document.getElementById('clipi'+num).style.backgroundImage = "url(/fileadmin/templates/images/"+num+"-over.gif)";

}

function play() {
    ytplayer = document.getElementById("myytplayer");
    ytplayer.playVideo();
}

function updatecomment() {
    if (http1.readyState == 4) {
        var results = http1.responseText;
        document.getElementById('youtube_comment').innerHTML = results;
    }
}

function update() {
    if (http.readyState == 4) {
        var results = http.responseText;
        document.getElementById('youtube_int').innerHTML = results;
    }
}

function getHTTPObject() {
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}
load(1);

