function playVideo(csig,style,autostart,w,h,div,pos,sig){
	
	var ajaxPlayVideo = new Ajax.Request(
	urlPlayVideo,
	{
	method: 'get',
	asynchronous: true,
	parameters: {'csig': csig,'style':style,'autostart':autostart,'w':w,'h':h,'div':div,'pos':pos,'sig':sig},
	onSuccess: getPlayerVideo
	});
	
}



function getPlayerVideo(xhr){
	
	var div = xhr.request.parameters.div;
	var tab = xhr.responseText.split('###');
	
	if(xhr.responseText != ''){
		if(div == 'vpodVideoCarriere'){
			document.getElementById(div).innerHTML = tab[0];
			document.getElementById('titreVideoUne').innerHTML = tab[1];
			document.getElementById('descVideoUne').innerHTML = tab[2];
		}
		else if(div == 'vpodTVCurrentVideo'){

			document.getElementById(div).innerHTML = tab[0];
			document.getElementById('titreVid').innerHTML = tab[1];
			document.getElementById('descVid').innerHTML = tab[2];
			//document.getElementById('viewsVid').innerHTML = tab[3];
			document.getElementById('dateVid').innerHTML = tab[4];
			if(tab[5] != "0"){document.getElementById('notationVid').innerHTML = tab[5];}
			if(tab[5] == "0"){document.getElementById('notationVid').innerHTML = "";}
			document.getElementById('formNotation').innerHTML = tab[6];
		}
		else{
			document.getElementById(div).innerHTML = tab[0];
		}
	}
	

}


function gestionPaginationTV(channel,page) {
	
	document.getElementById('blocPagination').innerHTML = 
			'<div class="blc_lst_prm_top">&nbsp;</div>' + 
			'<div class="blc_lst_prm_page">' +
			'<div style="font-weight: bold; text-align: center; padding-top: 6px;">Chargement...</div>' + 
			'</div>' + 
			'<div class="blc_lst_prm_bot">&nbsp;</div>';
			
	var ajaxPaginationTV = new Ajax.Request(
	urlPaginationTV,
	{
	method: 'get',
	asynchronous: true,
	parameters: {'channel': channel,'page':page},
	onSuccess: majMiniatureTV
	});
	
}


function majMiniatureTV(xhr) {
	
	if(xhr.responseText != ''){
		tab = xhr.responseText.split('###');
		document.getElementById('blocListeMiniatures').innerHTML = tab[0];
		document.getElementById('blocPagination').innerHTML = tab[1];
	}


}


var gestionNotationTV = function () {

	note = document.getElementById('note').value;
	videoId = document.getElementById('videoId').value;
	total_note = document.getElementById('total_note').value;
	nb_note = document.getElementById('nb_note').value;
	document.getElementById('chargementNotationEnCour').innerHTML = '<img src="/img/chargement.gif">';
	
	var ajaxNotationTV = new Ajax.Request(
	urlNotationTV,
	{
	method: 'get',
	asynchronous: true,
	parameters: {'note': note,'videoId':videoId,'total_note':total_note,'nb_note':nb_note},
	onSuccess: function(xhr){
				  retour = xhr.responseText.split('###');
				  if(retour[2] == "1"){
					document.getElementById('notationVid').innerHTML = retour[1];
				  }
				  
			      var message = retour[0];
			      if (message) {
			    	  document.getElementById('chargementNotationEnCour').innerHTML = "";
			          //gestion popin
			    	  var nodeErreurAccroche	= document.getElementById("pmmsgmain");
			    	  nodeErreurAccroche.innerHTML = message;
			    	  popupErr();
			      }
			    }
	});


}



