function getEmission(id){
texte = file('http://www.tvenligne.fr/backend/getEmission.php?id='+escape(id));
writediv(texte);
}

function getEpisode(id){
texte = file('http://www.tvenligne.fr/backend/getEpisodes.php?id='+escape(id));
writediv(texte);
}

function writediv(texte){
     document.getElementById('menu').innerHTML = texte;
}

function displayEpisode(id){
url = file('http://www.tvenligne.fr/backend/getEpisode.php?id='+escape(id));
writeplayer(url);
refreshAd(); 
}

function display(id){
url = file('http://www.tvenligne.fr/backend/getLive.php?id='+escape(id));
writeplayer(url);
refreshAd(); 
}
function file(fichier)
     {
     if(window.XMLHttpRequest) 
          xhr_object = new XMLHttpRequest();
     else if(window.ActiveXObject) 
          xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
     else
          return(false);
     xhr_object.open("GET", fichier, false);
     xhr_object.send(null);
     if(xhr_object.readyState == 4) return(xhr_object.responseText);
     else return(false);
 }
 
 function writeplayer(url){
document.getElementById('player').innerHTML=
'<OBJECT id="WinMedia" width=468 height=405'+
'classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"'+
'codebase="http://activex.microsoft.com/activex/controls/'+
'mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby='+
'"Loading Microsoft® Windows® Media Player components..."'+
'type="application/x-oleobject">'+
'<PARAM NAME="fileName" VALUE="'+url+'">'+
'<PARAM NAME="AutoStart" Value="True">'+
'<PARAM NAME="ShowControls" VALUE="True">'+
'<PARAM NAME="stretchToFit" value="True">'+
'<PARAM NAME="displaysize" value="3">'+
'<PARAM NAME="ShowStatusBar" VALUE="True">'+
'<PARAM NAME="AutoSize" VALUE="True">'+
'<EMBED type="application/x-mplayer2"'+
'pluginspage="http://www.microsoft.com/Windows/'+
'MediaPlayer/" SRC="'+url+'" name="WinMedia"'+
'autostart=1 stretchToFit=1 id="WinMedia"'+
'pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" '+
'autostart="1" '+
'showcontrols="1" '+
'allowchangedisplaysize="1" autosize="1" '+
'displaysize="4" enablecontextmenu="1" '+
'windowless="0" showstatusbar="1" '+
'invokeurls="1" stretchtofit="1" '+
'border="0" hspace="0" vspace="0" '+
'width="468" height="405" '+
'stretchtofit="True" ShowStatusBar="true"'+
'ShowControls="true"></EMBED></OBJECT>';

}

 function refreshAd() {
      var currentTime = new Date();
      googlead.location = "ad.php?s=" + currentTime.getTime();
	  googlead2.location = "ad2.php?s=" + currentTime.getTime();
}