/*******************************************************************************************
Récupération du flux xml généré par le fichier pagination.php en remplacement de l'inclusion
classique de la totalité des vidéos de la chaine TV.

On parse les infos de chaque vidéo et via Dom, on met à jour le contenu du div "dynTop"

Inclusion en plus de la barre de navig
*******************************************************************************************/
function getPagination(obj) {
	var tabResult = obj.responseXML.getElementsByTagName('resultat');
	var i;
	var video = "";
	var title = "";
	var linked = "";
	var infoLinked = "";
	var cstLink = true;
	var flGauche = "";
	var fldroite = "";
	var flPrem = "";
	var flDer = "";
	for (i=0;i<tabResult.length;i++) {
		var resultat = tabResult.item(i);
		var pasEncore = resultat.getAttribute('pasEncore');
		var pasVideo = resultat.getAttribute('pasVideo');
		if (resultat.getAttribute('iscat') == "1") {
			title = "<div class=\"title_topvideo2\">Toutes les vid&eacute;os du secteur "+resultat.getAttribute('CAT_TVPRO')+"</div>";
		} else {
			title = "<div class=\"title_topvideo2\">TOUTES LES VID&Eacute;OS AYANT LE CODE NAF "+resultat.getAttribute('CODE_NAFAFF')+"</div>";
		}
		if (pasEncore == null) {
			if (pasVideo == null) {
				var j;
				if (cstLink) {
					if (parseInt(resultat.getAttribute('pageActuelle')) > 1) {
						flGauche = "<li style=\"display:inline;padding-left:0px;margin-left:4px;margin-right:4px;\"><a href=\"javascript:setPagination("+(parseInt(resultat.getAttribute('pageActuelle'))-1)+","+resultat.getAttribute('paramCat')+",'"+resultat.getAttribute('paramNaf')+"',"+resultat.getAttribute('paramId')+","+resultat.getAttribute('paramId_soc')+","+resultat.getAttribute('paramId_categ')+","+resultat.getAttribute('paramId_sec')+");switchBanner(true,true,true);\"><img src=\"images/GoogleMap/prev.gif\" alt=\"Pr&eacute;c&eacute;dente\" style=\"vertical-align:baseline;\" height=\"12px\"/></a></li>";
						if ((parseInt(resultat.getAttribute('pageActuelle'))-1)!= 1) {
							flPrem = "<li style=\"display:inline;padding-left:0px;margin-left:4px;margin-right:4px;\"><a href=\"javascript:setPagination(1,"+resultat.getAttribute('paramCat')+",'"+resultat.getAttribute('paramNaf')+"',"+resultat.getAttribute('paramId')+","+resultat.getAttribute('paramId_soc')+","+resultat.getAttribute('paramId_categ')+","+resultat.getAttribute('paramId_sec')+");switchBanner(true,true,true);\"><img src=\"images/GoogleMap/first.png\" alt=\"Premi&egrave;re\" style=\"vertical-align:baseline;\" height=\"12px\"/></a></li>";
						}
					}
					if (parseInt(resultat.getAttribute('pageActuelle')) < parseInt(resultat.getAttribute('nombreDePage'))) {
						fldroite = "<li style=\"display:inline;padding-left:0px;margin-left:4px;margin-right:4px;\"><a href=\"javascript:setPagination("+(parseInt(resultat.getAttribute('pageActuelle'))+1)+","+resultat.getAttribute('paramCat')+",'"+resultat.getAttribute('paramNaf')+"',"+resultat.getAttribute('paramId')+","+resultat.getAttribute('paramId_soc')+","+resultat.getAttribute('paramId_categ')+","+resultat.getAttribute('paramId_sec')+");switchBanner(true,true,true);\"><img src=\"images/GoogleMap/next.gif\" alt=\"Suivante\" style=\"vertical-align:baseline;\" height=\"12px\"/></a></li>";
						if ((parseInt(resultat.getAttribute('pageActuelle'))+1)!= resultat.getAttribute('nombreDePage')) {
							flDer = "<li style=\"display:inline;padding-left:0px;margin-left:4px;margin-right:4px;\"><a href=\"javascript:setPagination("+resultat.getAttribute('nombreDePage')+","+resultat.getAttribute('paramCat')+",'"+resultat.getAttribute('paramNaf')+"',"+resultat.getAttribute('paramId')+","+resultat.getAttribute('paramId_soc')+","+resultat.getAttribute('paramId_categ')+","+resultat.getAttribute('paramId_sec')+");switchBanner(true,true,true);\"><img src=\"images/GoogleMap/last.png\" alt=\"Derni&egrave;re\" style=\"vertical-align:baseline;\" height=\"12px\"/></a></li>";
						}
					}
					var premier = 1;
					debutpage = parseInt(resultat.getAttribute('pageActuelle'));
					for(j=1;debutpage > 0 && j <= ((20-1)/2);j++) {
					  	debutpage--;
					}
					finpage = parseInt(resultat.getAttribute('pageActuelle'))+20-(parseInt(resultat.getAttribute('pageActuelle'))-debutpage);
					if (finpage > parseInt(resultat.getAttribute('nombreDePage'))) {
					  debutpage = debutpage-(finpage-parseInt(resultat.getAttribute('nombreDePage')));
					  if(debutpage < 0) {
						debutpage = 0;
					  }
					  finpage = parseInt(resultat.getAttribute('nombreDePage'));
					}
					for(j=debutpage; j<finpage && (finpage-debutpage) > 1;j++) {
					//for (j=1; j <= resultat.getAttribute('nombreDePage');j++){
						if (premier==1) {
							infoLinked += "<div style=\"font-size:12px;float:right;padding-right:10px;\"><br class=\"clear\"/>["+resultat.getAttribute('pageActuelle')+" sur "+resultat.getAttribute('nombreDePage')+" Pages]</div>";
							linked += "<div style=\"text-align:center;padding-top:10px;margin-bottom:10px;\"><br class=\"clear\"/><ul style=\"list-style-type:none;list-style-image:none;list-style-position:outside;display:inline;padding-left:0px;margin-left:0px;\">"+flPrem+flGauche;	
						}
						linked += "<li style=\"display:inline;padding-left:0px;margin-left:4px;margin-right:4px;\"><a href=\"javascript:setPagination("+(j+1)+","+resultat.getAttribute('paramCat')+",'"+resultat.getAttribute('paramNaf')+"',"+resultat.getAttribute('paramId')+","+resultat.getAttribute('paramId_soc')+","+resultat.getAttribute('paramId_categ')+","+resultat.getAttribute('paramId_sec')+");switchBanner(true,true,true);\">";
						if((j+1) == resultat.getAttribute('pageActuelle')){
							linked += "<span style=\"font-weight:bold;font-size:13px\">"+(j+1)+"</span>";
						} else {
							linked += "<span style=\"color:#DE0016;\">"+(j+1)+"</span>";	
						}
						linked += "</a></li>";
						premier++;
					}
					linked += fldroite+flDer+"</ul></div>";
					cstLink = false;
				}
				video += "<div class=\"link_topvideo\">";
				video += "<a href=\"chaine_sshome.php?id="+resultat.getAttribute('num');
				if (resultat.getAttribute('iscat') == "1") {
					video += "&amp;cat="+resultat.getAttribute('ID_CATEG');
				} else {
					video += "&amp;naf="+resultat.getAttribute('CODE_NAF');
				}
				video += "&amp;pageIndex="+resultat.getAttribute('pageActuelle')+"\"><img class=\"screen\" width=\"80\" height=\"64\" src=\""+resultat.getAttribute('screen')+"\" name=\"this\" alt=\""+resultat.getAttribute('nom')+"\" title=\""+resultat.getAttribute('nom')+"\" /></a>";
				var notemoy=resultat.getAttribute('note');
				if (notemoy>0.25) {
    				if (notemoy>0.75) {
      					if (notemoy>1.25) {
					        if (notemoy>1.75) {
          						if (notemoy>2.25) {
            						if (notemoy>2.75) {
              							if (notemoy>3.25) {
                							if (notemoy>3.75) {
    											if (notemoy>4.25) {
                    								if (notemoy>4.75) {
                      									video += "<img src=\"images/rating_vert5.png \" alt=\"5\" />";
                    								} else {
                      									video += "<img src=\"images/rating_vert4moit.png \" alt=\"4.5\" />";
                  									}
												} else {
                    								video += "<img src=\"images/rating_vert4.png \" alt=\"4\" />";
                								}
											} else {
                  								video += "<img src=\"images/rating_vert3moit.png \" alt=\"3.5\" />";
              								}
										} else {
                							video += "<img src=\"images/rating_vert3.png \" alt=\"3\" />";
            							}
									} else {
              							video += "<img src=\"images/rating_vert2moit.png \" alt=\"2.5\" />";
          							}
								} else {
            						video += "<img src=\"images/rating_vert2.png \" alt=\"2\" />";
        						}
							} else {
          							video += "<img src=\"images/rating_vert1moit.png \" alt=\"1.5\" />";
      						}
						} else {
        					video += "<img src=\"images/rating_vert1.png \" alt=\"1\" />";
    					}
					} else {
      					video += "<img src=\"images/rating_vert0moit.png \" alt=\"0.5\" />";
  					}
				} else {
    				video += "<img src=\"images/rating_vert0.png \" alt=\"0\" />";
				}
				video += "<p class=\"date\" style=\"text-align:left;\">";
				video += "<span style=\"color:black;\">"+resultat.getAttribute('name')+"</span><br/><a href=\""+resultat.getAttribute('linkMinisite')+"\" title=\"FICHE SOCI&Eacute;T&Eacute;\" target=\""+resultat.getAttribute('targetMinisite')+"\">";
				video += resultat.getAttribute('spCharNom')+"</a></p>";
				video += "<table cellpadding=\"0\" cellspacing=\"2\" border=\"0\" align=\"left\"><tr><td valign=\"top\" width=\"15px\"><img src=\"images/oeil.jpg\" alt=\"vue\" align=\"middle\" /></td><td align=\"left\" style=\"color:#DE0016;font-size:9px;font-weight:bold;\">&nbsp;"+resultat.getAttribute('vue')+" fois</td></tr>";
				video += "<tr><td colspan=\"2\"><a href=\""+resultat.getAttribute('linkMinisite')+"\" title=\"FICHE SOCI&Eacute;T&Eacute;\" target=\""+resultat.getAttribute('targetMinisite')+"\"><img src=\"images/lire_fiche.gif\" alt=\"lire la fiche\" onmouseover=\"this.src = 'images/lire_fiche2.gif';\" onmouseout=\"this.src ='images/lire_fiche.gif';\" style=\"display:inline;\"/></a></td></tr></table>";
				video += "</div>";
				if (resultat.getAttribute('nombreDePage')> 1) {
					document.getElementById("dynTop").innerHTML = title+infoLinked+linked+video+linked;
				} else {
					document.getElementById("dynTop").innerHTML = title+video;
				}
			} else {
				document.getElementById("dynTop").innerHTML = pasVideo;
			}
		} else {
			document.getElementById("dynTop").innerHTML = pasEncore;
		}
	}
}


/*******************************************************************************************
Récupération du flux xml généré par le fichier paginationSalon.php en remplacement de l'inclusion
classique de la totalité des vidéos du salon.

On parse les infos de chaque vidéo et via Dom, on met à jour le contenu du div "dynTop"

Inclusion en plus de la barre de navig
*******************************************************************************************/
function getPaginationSalon(obj) {
	var tabResult = obj.responseXML.getElementsByTagName('resultat');
	var i;
	var video = "";
	var title = "";
	var linked = "";
	var infoLinked = "";
	var cstLink = true;
	var flGauche = "";
	var fldroite = "";
	var flPrem = "";
	var flDer = "";
	for (i=0;i<tabResult.length;i++) {
		var resultat = tabResult.item(i);
		var pasVideo = resultat.getAttribute('pasVideo');
		if (pasVideo == null) {
			var j;
			if (cstLink) {
				if (parseInt(resultat.getAttribute('pageActuelle')) > 1) {
					flGauche = "<li style=\"display:inline;padding-left:0px;margin-left:4px;margin-right:4px;\"><a href=\"javascript:setPaginationSalon("+(parseInt(resultat.getAttribute('pageActuelle'))-1)+","+resultat.getAttribute('paramSalon')+");switchBanner(true,true,true);\"><img src=\"images/GoogleMap/prev.gif\" alt=\"Pr&eacute;c&eacute;dente\" style=\"vertical-align:baseline;\" height=\"12px\"/></a></li>";
					if ((parseInt(resultat.getAttribute('pageActuelle'))-1)!= 1) {
						flPrem = "<li style=\"display:inline;padding-left:0px;margin-left:4px;margin-right:4px;\"><a href=\"javascript:setPaginationSalon(1,"+resultat.getAttribute('paramSalon')+");switchBanner(true,true,true);\"><img src=\"images/GoogleMap/first.png\" alt=\"Premi&egrave;re\" style=\"vertical-align:baseline;\" height=\"12px\"/></a></li>";
					}
				}
				if (parseInt(resultat.getAttribute('pageActuelle')) < parseInt(resultat.getAttribute('nombreDePage'))) {
					fldroite = "<li style=\"display:inline;padding-left:0px;margin-left:4px;margin-right:4px;\"><a href=\"javascript:setPaginationSalon("+(parseInt(resultat.getAttribute('pageActuelle'))+1)+","+resultat.getAttribute('paramSalon')+");switchBanner(true,true,true);\"><img src=\"images/GoogleMap/next.gif\" alt=\"Suivante\" style=\"vertical-align:baseline;\" height=\"12px\"/></a></li>";
					if ((parseInt(resultat.getAttribute('pageActuelle'))+1)!= parseInt(resultat.getAttribute('nombreDePage'))) {
						flDer = "<li style=\"display:inline;padding-left:0px;margin-left:4px;margin-right:4px;\"><a href=\"javascript:setPaginationSalon("+resultat.getAttribute('nombreDePage')+","+resultat.getAttribute('paramSalon')+");switchBanner(true,true,true);\"><img src=\"images/GoogleMap/last.png\" alt=\"Derni&egrave;re\" style=\"vertical-align:baseline;\" height=\"12px\"/></a></li>";
					}
				}
				var premier = 1;
				debutpage = parseInt(resultat.getAttribute('pageActuelle'));
				for(j=1;debutpage > 0 && j <= ((20-1)/2);j++) {
					debutpage--;
				}
				finpage = parseInt(resultat.getAttribute('pageActuelle'))+20-(parseInt(resultat.getAttribute('pageActuelle'))-debutpage);
				if (finpage > parseInt(resultat.getAttribute('nombreDePage'))) {
				  debutpage = debutpage-(finpage-parseInt(resultat.getAttribute('nombreDePage')));
				  if(debutpage < 0) {
					debutpage = 0;
				  }
				  finpage = parseInt(resultat.getAttribute('nombreDePage'));
				}
				for(j=debutpage; j<finpage && (finpage-debutpage) > 1;j++) {
				//for (j=1; j <= resultat.getAttribute('nombreDePage');j++){
					if (premier==1) {
						infoLinked += "<div style=\"font-size:12px;float:right;padding-right:10px;\"><br class=\"clear\"/>["+resultat.getAttribute('pageActuelle')+" sur "+resultat.getAttribute('nombreDePage')+" Pages]</div>";
						linked += "<div style=\"text-align:center;padding-top:10px;margin-bottom:10px;\"><br class=\"clear\"/><ul style=\"list-style-type:none;list-style-image:none;list-style-position:outside;display:inline;padding-left:0px;margin-left:0px;\">"+flPrem+flGauche;	
					}
					linked += "<li style=\"display:inline;padding-left:0px;margin-left:4px;margin-right:4px;\"><a href=\"javascript:setPaginationSalon("+(j+1)+","+resultat.getAttribute('paramSalon')+");switchBanner(true,true,true);\">";
					if((j+1) == resultat.getAttribute('pageActuelle')){
						linked += "<span style=\"font-weight:bold;;font-size:13px\">"+(j+1)+"</span>";
					} else {
						linked += "<span style=\"color:#DE0016;\">"+(j+1)+"</span>";	
					}
					linked += "</a></li>";
					premier++;
				}
				linked += fldroite+flDer+"</ul></div>";
				cstLink = false;
			}
			video += "<div class=\"link_topvideo\">";
			video += "<a href=\"chaine_salons.php?id="+resultat.getAttribute('num')+"&amp;id_salon="+resultat.getAttribute('paramSalon');
			video += "&amp;pageIndex="+resultat.getAttribute('pageActuelle')+"\"><img class=\"screen\" width=\"80\" height=\"64\" src=\""+resultat.getAttribute('screen')+"\" name=\"this\" alt=\""+resultat.getAttribute('nom')+"\" title=\""+resultat.getAttribute('nom')+"\" /></a>";
			var notemoy=resultat.getAttribute('note');
			if (notemoy>0.25) {
				if (notemoy>0.75) {
					if (notemoy>1.25) {
						if (notemoy>1.75) {
							if (notemoy>2.25) {
								if (notemoy>2.75) {
									if (notemoy>3.25) {
										if (notemoy>3.75) {
											if (notemoy>4.25) {
												if (notemoy>4.75) {
													video += "<img src=\"images/rating_vert5.png \" alt=\"5\" />";
												} else {
													video += "<img src=\"images/rating_vert4moit.png \" alt=\"4.5\" />";
												}
											} else {
												video += "<img src=\"images/rating_vert4.png \" alt=\"4\" />";
											}
										} else {
											video += "<img src=\"images/rating_vert3moit.png \" alt=\"3.5\" />";
										}
									} else {
										video += "<img src=\"images/rating_vert3.png \" alt=\"3\" />";
									}
								} else {
									video += "<img src=\"images/rating_vert2moit.png \" alt=\"2.5\" />";
								}
							} else {
								video += "<img src=\"images/rating_vert2.png \" alt=\"2\" />";
							}
						} else {
								video += "<img src=\"images/rating_vert1moit.png \" alt=\"1.5\" />";
						}
					} else {
						video += "<img src=\"images/rating_vert1.png \" alt=\"1\" />";
					}
				} else {
					video += "<img src=\"images/rating_vert0moit.png \" alt=\"0.5\" />";
				}
			} else {
				video += "<img src=\"images/rating_vert0.png \" alt=\"0\" />";
			}
			video += "<p class=\"date\" style=\"text-align:left;\">";
			video += "<span style=\"color:black;\">"+resultat.getAttribute('name')+"</span><br/><a href=\""+resultat.getAttribute('linkMinisite')+"\" title=\""+resultat.getAttribute('nomSoc')+"\" target=\""+resultat.getAttribute('targetMinisite')+"\">";
			video += resultat.getAttribute('spCharNom')+"</a></p>";
			video += "<table cellpadding=\"0\" cellspacing=\"2\" border=\"0\" align=\"left\"><tr><td valign=\"top\" width=\"15px\"><img src=\"images/oeil.jpg\" alt=\"vue\" align=\"middle\" /></td><td align=\"left\" style=\"color:#DE0016;font-size:9px;font-weight:bold;\">&nbsp;"+resultat.getAttribute('vue')+" fois</td></tr>";
			video += "<tr><td colspan=\"2\"><a href=\""+resultat.getAttribute('linkMinisite')+"\" title=\""+resultat.getAttribute('nomSoc')+"\" target=\""+resultat.getAttribute('targetMinisite')+"\"><img src=\"images/lire_fiche.gif\" alt=\"lire la fiche\" onmouseover=\"this.src = 'images/lire_fiche2.gif';\" onmouseout=\"this.src ='images/lire_fiche.gif';\" style=\"display:inline;\"/></a></td></tr></table>";
			video += "</div>";
			if (resultat.getAttribute('nombreDePage')> 1) {
				document.getElementById("dynTop").innerHTML = title+infoLinked+linked+video+linked;
			} else {
				document.getElementById("dynTop").innerHTML = title+video;
			}
		} else {
			document.getElementById("dynTop").innerHTML = pasVideo;
		}
	}
}

function getPaginationSalonModeration(obj) {
	var tabResult = obj.responseXML.getElementsByTagName('resultat');
	var i;
	var video = "";
	var title = "";
	var linked = "";
	var infoLinked = "";
	var cstLink = true;
	var flGauche = "";
	var fldroite = "";
	var flPrem = "";
	var flDer = "";
	for (i=0;i<tabResult.length;i++) {
		var resultat = tabResult.item(i);
		var pasVideo = resultat.getAttribute('pasVideo');
		if (pasVideo == null) {
			var j;
			if (cstLink) {
				if (parseInt(resultat.getAttribute('pageActuelle')) > 1) {
					flGauche = "<li style=\"display:inline;padding-left:0px;margin-left:4px;margin-right:4px;\"><a href=\"javascript:setPaginationSalonModeration("+(parseInt(resultat.getAttribute('pageActuelle'))-1)+","+resultat.getAttribute('paramSalon')+");switchBanner(true,true,true);\"><img src=\"images/GoogleMap/prev.gif\" alt=\"Pr&eacute;c&eacute;dente\" style=\"vertical-align:baseline;\" height=\"12px\"/></a></li>";
					if ((parseInt(resultat.getAttribute('pageActuelle'))-1)!= 1) {
						flPrem = "<li style=\"display:inline;padding-left:0px;margin-left:4px;margin-right:4px;\"><a href=\"javascript:setPaginationSalonModeration(1,"+resultat.getAttribute('paramSalon')+");switchBanner(true,true,true);\"><img src=\"images/GoogleMap/first.png\" alt=\"Premi&egrave;re\" style=\"vertical-align:baseline;\" height=\"12px\"/></a></li>";
					}
				}
				if (parseInt(resultat.getAttribute('pageActuelle')) < parseInt(resultat.getAttribute('nombreDePage'))) {
					fldroite = "<li style=\"display:inline;padding-left:0px;margin-left:4px;margin-right:4px;\"><a href=\"javascript:setPaginationSalonModeration("+(parseInt(resultat.getAttribute('pageActuelle'))+1)+","+resultat.getAttribute('paramSalon')+");switchBanner(true,true,true);\"><img src=\"images/GoogleMap/next.gif\" alt=\"Suivante\" style=\"vertical-align:baseline;\" height=\"12px\"/></a></li>";
					if ((parseInt(resultat.getAttribute('pageActuelle'))+1)!= parseInt(resultat.getAttribute('nombreDePage'))) {
						flDer = "<li style=\"display:inline;padding-left:0px;margin-left:4px;margin-right:4px;\"><a href=\"javascript:setPaginationSalonModeration("+resultat.getAttribute('nombreDePage')+","+resultat.getAttribute('paramSalon')+");switchBanner(true,true,true);\"><img src=\"images/GoogleMap/last.png\" alt=\"Derni&egrave;re\" style=\"vertical-align:baseline;\" height=\"12px\"/></a></li>";
					}
				}
				var premier = 1;
				debutpage = parseInt(resultat.getAttribute('pageActuelle'));
				for(j=1;debutpage > 0 && j <= ((20-1)/2);j++) {
					debutpage--;
				}
				finpage = parseInt(resultat.getAttribute('pageActuelle'))+20-(parseInt(resultat.getAttribute('pageActuelle'))-debutpage);
				if (finpage > parseInt(resultat.getAttribute('nombreDePage'))) {
				  debutpage = debutpage-(finpage-parseInt(resultat.getAttribute('nombreDePage')));
				  if(debutpage < 0) {
					debutpage = 0;
				  }
				  finpage = parseInt(resultat.getAttribute('nombreDePage'));
				}
				for(j=debutpage; j<finpage && (finpage-debutpage) > 1;j++) {
				//for (j=1; j <= resultat.getAttribute('nombreDePage');j++){
					if (premier==1) {
						infoLinked += "<div style=\"font-size:12px;float:right;padding-right:10px;\"><br class=\"clear\"/>["+resultat.getAttribute('pageActuelle')+" sur "+resultat.getAttribute('nombreDePage')+" Pages]</div>";
						linked += "<div style=\"text-align:center;padding-top:10px;margin-bottom:10px;\"><br class=\"clear\"/><ul style=\"list-style-type:none;list-style-image:none;list-style-position:outside;display:inline;padding-left:0px;margin-left:0px;\">"+flPrem+flGauche;	
					}
					linked += "<li style=\"display:inline;padding-left:0px;margin-left:4px;margin-right:4px;\"><a href=\"javascript:setPaginationSalonModeration("+(j+1)+","+resultat.getAttribute('paramSalon')+");switchBanner(true,true,true);\">";
					if((j+1) == resultat.getAttribute('pageActuelle')){
						linked += "<span style=\"font-weight:bold;;font-size:13px\">"+(j+1)+"</span>";
					} else {
						linked += "<span style=\"color:#DE0016;\">"+(j+1)+"</span>";	
					}
					linked += "</a></li>";
					premier++;
				}
				linked += fldroite+flDer+"</ul></div>";
				cstLink = false;
			}
			video += "<div class=\"link_topvideo\">";
			video += "<a href=\"moderation_chaine_salons.php?id="+resultat.getAttribute('num')+"&amp;id_salon="+resultat.getAttribute('paramSalon');
			video += "&amp;pageIndex="+resultat.getAttribute('pageActuelle')+"\"><img class=\"screen\" width=\"80\" height=\"64\" src=\""+resultat.getAttribute('screen')+"\" name=\"this\" alt=\""+resultat.getAttribute('nom')+"\" title=\""+resultat.getAttribute('nom')+"\" /></a>";
			var notemoy=resultat.getAttribute('note');
			if (notemoy>0.25) {
				if (notemoy>0.75) {
					if (notemoy>1.25) {
						if (notemoy>1.75) {
							if (notemoy>2.25) {
								if (notemoy>2.75) {
									if (notemoy>3.25) {
										if (notemoy>3.75) {
											if (notemoy>4.25) {
												if (notemoy>4.75) {
													video += "<img src=\"images/rating_vert5.png \" alt=\"5\" />";
												} else {
													video += "<img src=\"images/rating_vert4moit.png \" alt=\"4.5\" />";
												}
											} else {
												video += "<img src=\"images/rating_vert4.png \" alt=\"4\" />";
											}
										} else {
											video += "<img src=\"images/rating_vert3moit.png \" alt=\"3.5\" />";
										}
									} else {
										video += "<img src=\"images/rating_vert3.png \" alt=\"3\" />";
									}
								} else {
									video += "<img src=\"images/rating_vert2moit.png \" alt=\"2.5\" />";
								}
							} else {
								video += "<img src=\"images/rating_vert2.png \" alt=\"2\" />";
							}
						} else {
								video += "<img src=\"images/rating_vert1moit.png \" alt=\"1.5\" />";
						}
					} else {
						video += "<img src=\"images/rating_vert1.png \" alt=\"1\" />";
					}
				} else {
					video += "<img src=\"images/rating_vert0moit.png \" alt=\"0.5\" />";
				}
			} else {
				video += "<img src=\"images/rating_vert0.png \" alt=\"0\" />";
			}
			video += "<p class=\"date\" style=\"text-align:left;\">";
			video += "<span style=\"color:black;\">"+resultat.getAttribute('name')+"</span><br/><a href=\""+resultat.getAttribute('linkMinisite')+"\" title=\"FICHE SOCI&Eacute;T&Eacute;\" target=\""+resultat.getAttribute('targetMinisite')+"\">";
			video += resultat.getAttribute('spCharNom')+"</a></p>";
			video += "<table cellpadding=\"0\" cellspacing=\"2\" border=\"0\" align=\"left\"><tr><td valign=\"top\" width=\"15px\"><img src=\"images/oeil.jpg\" alt=\"vue\" align=\"middle\" /></td><td align=\"left\" style=\"color:#DE0016;font-size:9px;font-weight:bold;\">&nbsp;"+resultat.getAttribute('vue')+" fois</td></tr>";
			video += "<tr><td colspan=\"2\"><a href=\""+resultat.getAttribute('linkMinisite')+"\" title=\"FICHE SOCI&Eacute;T&Eacute;\" target=\""+resultat.getAttribute('targetMinisite')+"\"><img src=\"images/lire_fiche.gif\" alt=\"lire la fiche\" onmouseover=\"this.src = 'images/lire_fiche2.gif';\" onmouseout=\"this.src ='images/lire_fiche.gif';\" style=\"display:inline;\"/></a>";
			
			if (resultat.getAttribute('mode_moderation')) {	/// Mad 20090609 Mise en ligne auto
				video +="<br/><input type=\"checkbox\" name=\"ids[]\" value=\""+resultat.getAttribute('num')+"\"/>Online";
			}
			video += "</td></tr></table>";
			video += "</div>";
			if (resultat.getAttribute('nombreDePage')> 1) {
				document.getElementById("dynTop").innerHTML = title+infoLinked+linked+video+linked;
			} else {
				document.getElementById("dynTop").innerHTML = title+video;
			}
		} else {
			document.getElementById("dynTop").innerHTML = pasVideo;
		}
	}
}

/*******************************************************************************************
Méthode appelée lorsque l'internaute navig entre les vidéos de la chaine TV.
Le paramètre page sert à spécifier la page à afficher et donc le filtre LIMIT de la requête
de la table vidéo.

getPagination est le nom de la méthode js a exécuter en retour du traitement php
*******************************************************************************************/
function setPagination(page,cat,naf,id,id_soc,id_categ,id_sec) {
	var XHR = new XHRConnection();
	XHR.appendData("page", page);
	XHR.appendData("cat", cat);
	XHR.appendData("naf", naf);
	XHR.appendData("id", id);
	XHR.appendData("id_soc", id_soc);
	XHR.appendData("id_categ", id_categ);
	XHR.appendData("id_sec", id_sec);
	XHR.sendAndLoad("ajaxPagination/pagination.php", "GET", getPagination);
}

/*******************************************************************************************
Méthode appelée lorsque l'internaute navig entre les vidéos du salon.
Le paramètre page sert à spécifier la page à afficher et donc le filtre LIMIT de la requête
de la table vidéo.

getPaginationSalon est le nom de la méthode js a exécuter en retour du traitement php
*******************************************************************************************/
function setPaginationSalon(page,id_salon) {
	var XHR = new XHRConnection();
	XHR.appendData("page", page);
	XHR.appendData("id_salon", id_salon);
	XHR.sendAndLoad("ajaxPagination/paginationSalon.php", "GET", getPaginationSalon);
return;
 try
   {
     xhr = new XMLHttpRequest(); 
   } catch(e)
   { 
     try { xhr = new ActiveXObject("Msxml2.XMLHTTP"); } 
     catch (e2)
    { 
       try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } 
       catch (e) {}
    }
  }

  xhr.onreadystatechange = function()
   { 
     alert("Wait server...");                
     if(xhr.readyState == 4)
     {
        if(xhr.status == 200)
        { 
             alert("Received:" + xhr.responseText); 
        } 
       else 
        { 
              alert("Error: returned status code " + 
                   xhr.status + " " + xhr.statusText); 
       } 
    } 
 }; 

	xhr.open("GET", "ajaxPagination/paginationSalon.php?id_salon="+id_salon, true);
	xhr.send(null);
}

function setPaginationSalonModeration(page,id_salon) {
	var XHR = new XHRConnection();
	XHR.appendData("page", page);
	XHR.appendData("id_salon", id_salon);
	XHR.sendAndLoad("ajaxPagination/paginationSalonModeration.php", "GET", getPaginationSalonModeration);
}


/*******************************************************************************************
Une fois la liste des vidéos updatée, on cherche à actualisé les bandeaux de pub.

On récupère le flux affiché par la page pub.php et on l'affecte au bloc concerné.

Cette méthode ne fonctionne pas pour le moment. Le flux javascript retourné n'est pas 
interprété par la page
*******************************************************************************************/
function switchBanner(bigBan,mediumBan1,mediumBan2)  {
	if (bigBan) {
		var homeBloc = document.getElementById("fluxAjaxPaginationBigBannerHome");
		var elseBloc = document.getElementById("fluxAjaxPaginationBigBannerElse");
		if (homeBloc != null) {
			var adlink_randomnumber=Math.floor(Math.random()*10000000000)
			eval('<script language="JavaScript" src="http://ad.fr.doubleclick.net/adj/tivipro.tv/HP;dcopt=ist;sz=728x90;ord='+adlink_randomnumber+'?"><\/script>');
			var newLink = "<a href=\"http://ad.fr.doubleclick.net/jump/tivipro.tv/HP;sz=728x90;ord="+adlink_randomnumber+"?\" target=\"_blank\"><img src=\"http://ad.fr.doubleclick.net/ad/tivipro.tv/HP;sz=728x90;ord="+adlink_randomnumber+"?\" border=\"0\" width=\"728\" height=\"90\"></a>";
			homeBloc.innerHTML = newLink;
		}
		if (elseBloc != null) {
			var adlink_randomnumber=Math.floor(Math.random()*10000000000)
			eval('<script language="JavaScript" src="http://ad.fr.doubleclick.net/adj/tivipro.tv/default;dcopt=ist;sz=728x90;ord='+adlink_randomnumber+'?"><\/script>');
			var newLink = "<a href=\"http://ad.fr.doubleclick.net/jump/tivipro.tv/default;sz=728x90;ord="+adlink_randomnumber+"?\" target=\"_blank\"><img src=\"http://ad.fr.doubleclick.net/ad/tivipro.tv/default;sz=728x90;ord="+adlink_randomnumber+"?\" border=\"0\" width=\"728\" height=\"90\"></a>";
			elseBloc.innerHTML = newLink;
		}
	}
	if (mediumBan1) {
		var homeBloc = document.getElementById("fluxAjaxPaginationMediumBanner1Home");
		var elseBloc = document.getElementById("fluxAjaxPaginationMediumBanner1Else");
		if (homeBloc != null) {
			var adlink_randomnumber=Math.floor(Math.random()*10000000000)
			eval('<script language="JavaScript" src="http://ad.fr.doubleclick.net/adj/tivipro.tv/HP1;dcopt=ist;sz=300x250;ord='+adlink_randomnumber+'?"><\/script>');
			var newLink = "<a href=\"http://ad.fr.doubleclick.net/jump/tivipro.tv/HP1;sz=300x250;ord="+adlink_randomnumber+"?\" target=\"_blank\"><img src=\"http://ad.fr.doubleclick.net/ad/tivipro.tv/HP1;sz=300x250;ord="+adlink_randomnumber+"?\" border=\"0\" width=\"300\" height=\"250\"></a>";
			homeBloc.innerHTML = newLink;
		}
		if (elseBloc != null) {
			var adlink_randomnumber=Math.floor(Math.random()*10000000000)
			eval('<script language="JavaScript" src="http://ad.fr.doubleclick.net/adj/tivipro.tv/default;dcopt=ist;sz=300x250;ord='+adlink_randomnumber+'?"><\/script>');
			var newLink = "<a href=\"http://ad.fr.doubleclick.net/jump/tivipro.tv/default;sz=300x250;ord="+adlink_randomnumber+"?\" target=\"_blank\"><img src=\"http://ad.fr.doubleclick.net/ad/tivipro.tv/default;sz=300x250;ord="+adlink_randomnumber+"?\" border=\"0\" width=\"300\" height=\"250\"></a>";
			elseBloc.innerHTML = newLink;
		}
	}
	if (mediumBan2) {
		var homeBloc = document.getElementById("fluxAjaxPaginationMediumBanner2Home");
		var elseBloc = document.getElementById("fluxAjaxPaginationMediumBanner2Else");
		if (homeBloc != null) {
			var adlink_randomnumber=Math.floor(Math.random()*10000000000)
			eval('<script language="JavaScript" src="http://ad.fr.doubleclick.net/adj/tivipro.tv/HP2;dcopt=ist;sz=300x250;ord='+adlink_randomnumber+'?"><\/script>');
			var newLink = "<a href=\"http://ad.fr.doubleclick.net/jump/tivipro.tv/HP2;sz=300x250;ord="+adlink_randomnumber+"?\" target=\"_blank\"><img src=\"http://ad.fr.doubleclick.net/ad/tivipro.tv/HP2;sz=300x250;ord="+adlink_randomnumber+"?\" border=\"0\" width=\"300\" height=\"250\"></a>";
			homeBloc.innerHTML = newLink;
		}
		if (elseBloc != null) {
			var adlink_randomnumber=Math.floor(Math.random()*10000000000)
			eval('<script language="JavaScript" src="http://ad.fr.doubleclick.net/adj/tivipro.tv/default2;dcopt=ist;sz=300x250;ord='+adlink_randomnumber+'?"><\/script>');
			var newLink = "<a href=\"http://ad.fr.doubleclick.net/jump/tivipro.tv/default2;sz=300x250;ord="+adlink_randomnumber+"?\" target=\"_blank\"><img src=\"http://ad.fr.doubleclick.net/ad/tivipro.tv/default2;sz=300x250;ord="+adlink_randomnumber+"?\" border=\"0\" width=\"300\" height=\"250\"></a>";
			elseBloc.innerHTML = newLink;
		}
	}
}