function editdwplayer(cheminson) {
document.write('<object type="application/x-shockwave-flash" data="dewplayer.swf?son='+ cheminson +'" width="200" height="20">');
document.write('<param name="movie" value="dewplayer.swf?son='+ cheminson +'" \/>');
document.write('<param name="bgcolor" value="#000000" \/>');
document.write('<param name="wmode" value="transparent" \/>');
document.write('Le lecteur nécessite l\'installation du plugin Flash en téléchargement <a href="http://www.macromedia.com/go/getflashplayer" onclick="window.open(\'http://www.macromedia.com/go/getflashplayer\',\'_blank\'); return false;">ici<\/a>. Par ailleurs, si vous utilisez Internet Explorer, le navigateur doit être configuré pour exécuter les contrôles ActiveX et les plugins : Outils > Options internet, onglet "Sécurité" puis cliquez sur "Niveau par défaut" (ou cliquez sur "Personnaliser le niveau..." puis cochez "Activer" sous "Exécuter les contrôles ActiveX et les plugins"). Cliquez ensuite sur "Appliquer" puis sur "OK". Enfin, actualisez votre page : bouton "Actualiser" du navigateur ou touche F5 du clavier. ');
document.write('<\/object>'); 
}

function editdivxplayer(cheminvideo,largeur,hauteur) {
document.write('<object classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616" width="'+ largeur +'" height="'+ hauteur +'" codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab">');
document.write('<param name="autoPlay" value="false" \/>');
document.write('<param name="allowFullScreen" value="true" \/>');
document.write('<param name="wmode" value="transparent" \/>');
document.write('<param name="src" value="'+ cheminvideo +'" \/>');
document.write('<embed type="video/divx" src="'+ cheminvideo +'" width="'+ largeur +'" height="'+ hauteur +'" autoPlay="false" allowfullscreen="true" wmode="transparent"  pluginspage="http://go.divx.com/plugin/download/">');
document.write('<\/embed>');
document.write('<\/object>');
}

function editflvplayeurmax(cheminvideo,largeur,hauteur) {
document.write('<object type="application/x-shockwave-flash" data="player_flv_maxi.swf" width="'+ largeur +'" height="'+ hauteur +'">');
document.write('<param name="movie" value="player_flv_maxi.swf" \/>');
document.write('<param name="allowFullScreen" value="true" \/>');
document.write('<param name="wmode" value="transparent" \/>');
document.write('<param name="FlashVars" value="flv='+ cheminvideo +'&amp;config=flv_config_maxi.txt" \/>');
document.write('<\/object>');
}

function editflvplw(cheminvideo,largeur,hauteur) {
document.write('<object width="'+ largeur +'" height="'+ hauteur +'">');
document.write('<param name="allowFullScreen" value="true" \/>');
document.write('<param name="wmode" value="transparent" \/>');
document.write('<param name="movie" value="'+ cheminvideo +'" \/>');

document.write('<embed type="application/x-shockwave-flash" src="'+ cheminvideo +'" width="'+ largeur +'" height="'+ hauteur +'" allowfullscreen="true" wmode="transparent" >');
document.write('<\/embed>');
document.write('<\/object>');
}

function anima() {
	document.write('<object type="application/x-shockwave-flash" data="clipFF.swf" style="z-index:1;width:440px;height:248px">');
	document.write('<param name="allowScriptAccess" value="sameDomain" \/>');
	document.write('<param name="movie" value="clipFF.swf" \/>');
	document.write('<param name="loop" value="true" \/>');
	document.write('<param name="quality" value="high" \/>');
	document.write('<param name="wmode" value="transparent" \/>');
	document.write('<\/object>');
}
			

function listrep(dos,form,input,text) {

this.popup = typeof(this.popup != 'undefined')? this.popup : null;
this.dossier = typeof(this.dossier != 'undefined')? this.dossier : null;

this.testpopup = document.getElementById('testpopup').value;
//popup = instance de la fenêtre list_fichier
//testpopup = input de contrôle d'état d'ouverture du popup inclu dans cette page
//text = 1 si concerne un textarea
//dos = dossier à lister

//	alert(this.testpopup.value);
if (this.popup != null && this.testpopup != 0 && this.dossier == dos) 
	{
		//champ_form = champ reporté dans admin_list_fichier
		//input = id du textarea ou de l'input
		this.popup.document.getElementById("champ_form").value = input;
		this.popup.document.getElementById("champ_type").value = text;
	
		this.popup.focus();

	}
	else
	{
		this.dossier = dos;
		//alert(typeof(this.dossier)+typeof(dos));
		this.popup = window.open('admin_list_fichier.php5?dos='+ dos +'&form='+ form +'&input='+ input +'&text='+ text +'','repertoire','scrollbars,resizable,width=250,height=800');
			
		this.popup.focus();	
	}
}



function DivDefile(id,vit_ouv,vit_ferm,vit_fondu,mod_fondu) 
{	
// Tableau de récupération des variables
	if (typeof this.Div_Var_H == 'undefined') this.Div_Var_H = new Array();
	if (typeof this.Div_Var_H[id] == 'undefined') this.Div_Var_H[id] = new Array();
		
	if (typeof this.Div_Var_H[id]['get_id'] == 'undefined') this.Div_Var_H[id]['get_id'] = document.getElementById(id);	
	
	if (this.Div_Var_H[id]['get_id']) 
	{
		
		/* Attention dépend de "menu_page" non renseigné dans les paramètres de la fonction DivDefile
		- Pour positionner les menus de groupe de page en static sinon bug en supperposition avec IE
		- Sert également pour augmenter z_index sur le sous menu actif. 
		- var ecart_gauche pour trouver la position du sous menu et inverser son positionnement (right:0 à la place de left:0) s'il dépasse la largeur du bandeau haut*/
		function Id_div_smenu() 
		{	 
    	var menu = document.getElementById('menu_page');
		
		var larg_menu;
		
		if (typeof menu != 'undefined')
			{
	
			larg_menu = menu.offsetWidth;
			
			for(var i=0; i < menu.childNodes.length; i++)
				{ 
					if(menu.childNodes[i].nodeType==1) 
						{	 	
							var li = menu.childNodes[i];
				
							for(var j=0; j < li.childNodes.length; j++)
								{
								
									if(li.childNodes[j].nodeType==1 && li.childNodes[j].nodeName.toLowerCase() === "div") 
									{
										var id_div = li.childNodes[j].id;
										
										var id_li = id_div.substring(0,id_div.length-3);//car id_div = id_li+'div'
										
										if(id != id_li) document.getElementById(id_div).style.zIndex = 20;
										
										if ((typeof this.Div_Var_H[id_li] == 'undefined' || typeof this.Div_Var_H[id_li]['h_inst'] == 'undefined' || this.Div_Var_H[id_li]['h_inst'] == 0) && (id != id_li)) document.getElementById(id_div).style.position = "static";
									}
								}
						} 
				}
			}
		return larg_menu;
		}
		
		
		var larg_menu = Id_div_smenu();
		
		if (typeof this.Div_Var_H[id]['div_conteneur'] == 'undefined') this.Div_Var_H[id]['div_conteneur'] = document.getElementById(id+'div');
		
		if (this.Div_Var_H[id]['div_conteneur']) 
		{
			this.Div_Var_H[id]['div_conteneur'].style.position = "relative";
			this.Div_Var_H[id]['div_conteneur'].style.zIndex = 50;
			var ecart_gauche = this.Div_Var_H[id]['div_conteneur'].offsetLeft;
		}
		
				


	
	
		function Agrand(id,incr,h_div) 
		{

		
			if (this.Div_Var_H[id]['h_inst'] < h_div) 
				{
					this.Div_Var_H[id]['h_inst'] = ((this.Div_Var_H[id]['h_inst'] + incr) <= h_div)? this.Div_Var_H[id]['h_inst'] + incr : h_div; 
					
					this.Div_Var_H[id]['get_id'].style.height = this.Div_Var_H[id]['h_inst']+'px';
					this.Div_Var_H[id]['timer'] = setTimeout(function(){Agrand(id,incr,h_div)},8);
				}
		}
		
		
		function Reduct(id,incr) 
		{

			if (this.Div_Var_H[id]['h_inst'] > 0) 
				{	
					this.Div_Var_H[id]['h_inst'] = ((this.Div_Var_H[id]['h_inst'] - incr) >= 0)? this.Div_Var_H[id]['h_inst'] - incr : 0;
					this.Div_Var_H[id]['get_id'].style.height = this.Div_Var_H[id]['h_inst']+'px';
					
					if (this.Div_Var_H[id]['h_inst'] == 0) 
						{
							this.Div_Var_H[id]['get_id'].style.display = 'none';
							
							//modif pour position != relative sinon bug de supperposition des déroulants avec IE
							if (this.Div_Var_H[id]['div_conteneur']) this.Div_Var_H[id]['div_conteneur'].style.position = "static";
						}
				
					this.Div_Var_H[id]['timer'] = setTimeout(function(){Reduct(id,incr)},8);
				}
		}
		
		/*
		function SetOpacity(obj, opacity) 
		{  
			obj.style.filter = "alpha(opacity:"+opacity+")";
			obj.style.KHTMLOpacity = opacity/100;
			obj.style.MozOpacity = opacity/100;
			obj.style.opacity = opacity/100;
		}
		
		
		function FadeIn(id,vit_fond, opacity) 
		{
			if (opacity > 0) 
				{
					opacity = ((opacity - vit_fond) >= 0) ? opacity - vit_fond : 0 ;
					SetOpacity(this.Div_Var_H[id]['get_id'], opacity);
					this.Div_Var_H[id]['fond_timer'] = setTimeout(function(){FadeIn(id,vit_fond,opacity)},10);
				}
				else
				{
					this.Div_Var_H[id]['get_id'].style.display = 'none';
					SetOpacity(this.Div_Var_H[id]['get_id'], 100);
				}
		}
		*/
						
		var vit_ouv = (typeof vit_ouv == 'number' && vit_ouv > 0)? vit_ouv : 10;// vitesse par défaut
		
		var vit_ferm = (typeof vit_ferm == 'number' && vit_ferm > 0)? vit_ferm : vit_ouv;
		
		var vit_fondu = (typeof vit_fondu == 'number' && vit_fondu > 0)? vit_fondu : 0;
		
		if (typeof mod_fondu == 'number' && mod_fondu > 0) var mod_fondu = 1;

		// Variables internes	
		if (typeof this.Div_Var_H[id]['h_inst'] != 'number') this.Div_Var_H[id]['h_inst'] = 0;

		if (typeof this.Div_Var_H[id]['sens'] != 'number') this.Div_Var_H[id]['sens'] = 1; else this.Div_Var_H[id]['sens'] *= -1;
		
		if (this.Div_Var_H[id]['timer']) clearTimeout(this.Div_Var_H[id]['timer']);
		
		if (this.Div_Var_H[id]['fond_timer']) clearTimeout(this.Div_Var_H[id]['fond_timer']);
		
		if (!this.Div_Var_H[id]['largeur']) 
			{
			this.Div_Var_H[id]['get_id'].style.overflow = 'visible';
			this.Div_Var_H[id]['get_id'].style.display = 'block';	
			this.Div_Var_H[id]['largeur'] = this.Div_Var_H[id]['get_id'].offsetWidth;
			this.Div_Var_H[id]['get_id'].style.display = 'none';
			
			if(typeof ecart_gauche != 'undefined' && typeof larg_menu != 'undefined' && (ecart_gauche + this.Div_Var_H[id]['largeur']) > larg_menu) 
				{
					this.Div_Var_H[id]['get_id'].style.left = 'auto';
					this.Div_Var_H[id]['get_id'].style.right = 0;
				}			
			}
		
		this.Div_Var_H[id]['get_id'].style.overflow = 'hidden';
		this.Div_Var_H[id]['get_id'].style.width = this.Div_Var_H[id]['largeur']+'px';	
		this.Div_Var_H[id]['get_id'].style.display = 'block';	
		this.Div_Var_H[id]['get_id'].style.height = 'auto';
		var haut_div = this.Div_Var_H[id]['get_id'].offsetHeight;
		

		
		//SetOpacity(this.Div_Var_H[id]['get_id'], 100);
		
		(this.Div_Var_H[id]['sens'] == 1)? Agrand(id,vit_ouv,haut_div) : Reduct(id,vit_ferm);
		
		var mod = (mod_fondu == 1)? 1 : this.Div_Var_H[id]['sens'];
		/*if (vit_fondu > 0 && mod != -1) 
		{
		//alert(mod);
		for (var cle in this.Div_Var_H)
			{
			if (cle != id) 
				{
					clearTimeout(this.Div_Var_H[cle]['timer']);
					FadeIn(cle,vit_fondu,100);
					this.Div_Var_H[cle]['h_inst'] = 0;
					this.Div_Var_H[cle]['sens'] = -1;
				}
			}
		}*/				
		
	}
}


function aut() {
document.location.href='pass_admin.php5';	
}


function cache_r(id,etat) {
	
	if (!this.timer) this.timer = new Array();
	if (!this.tabid) this.tabid = new Array();
	
	if (this.bloc = document.getElementById(id))	
	{
	if (!this.tabid[id]) this.tabid[id] = this.bloc;
	}

	//pour compenser le bug ie (div ne passe pas sur select)
	function montre (id) {
	id.style.visibility = 'visible';
	}
	
	if (this.tabid[id])
	{
		
		if (etat != 0) {this.timer[id] = setTimeout(function(){montre (this.tabid[id]);},300);}
		else 
		{
		if (this.timer[id]) clearTimeout(this.timer[id]);
		this.tabid[id].style.visibility = 'hidden';
		}
	}
	
}


/*
function listrep(dos,form,input,text) {
var popup = window.open('admin_list_fichier.php?dos='+ dos +'&form='+ form +'&input='+ input +'&text='+ text +'','repertoire','scrollbars,resizable,width=200,height=500');
popup.focus();
}*/

function Affiche_compt(idChamp,id_content_compteur_total,id_content_compteur_jour) 
{
var conteneur = document.getElementById(idChamp);

this.stop_affiche = (typeof this.stop_affiche == 'undefined') ? 1 : -1 ;

if (this.stop_affiche == 1)
	{
		var compteur_total = document.getElementById(id_content_compteur_total).value;
		var compteur_jour = document.getElementById(id_content_compteur_jour).value;
		
		if (compteur_total && compteur_jour && conteneur)
			{
				this.texte = document.createTextNode(compteur_total+' visites dont '+ compteur_jour +' aujourd\'hui');
				
				conteneur.appendChild(this.texte);
			}
	}
	
}

		
			
function Affiche_compt_sup(idChamp,idImg)
{

	this.limite_query = (typeof this.limite_query == 'undefined')? 0 : this.limite_query + 28;
	
	
	function Scrolldown(id) 
		{
			var h = document.getElementById(id).offsetHeight;

			window.scrollBy(0,h);
		}  
		

	if (window.XMLHttpRequest) 
		{ 
			var xhr = new XMLHttpRequest(); 
		}
	
		else if (window.ActiveXObject) 
		{ 
			var xhr = new ActiveXObject("Microsoft.XMLHTTP"); 
		}
	
	
	xhr.onreadystatechange = function() 
	{ 
	  if (xhr.readyState == 4) 
		{ 
			if (xhr.status == 200) 
				 
				{
					var cible = document.getElementById(idChamp); 							
												
				    var nbCols = 7;
					var cpt = 0;
					
					var tab = eval('('+xhr.responseText+')');
					
					// navigation admin
					if (tab['navig'] == 1) 
						document.getElementById(idImg).src = 'Images_nav/fleche_retour.png';
						else
						document.getElementById(idImg).src = 'Images_nav/transparent.png';
						
					

					var table = document.createElement('table');					
					table.style.borderCollapse = 'collapse';//pour cellspacing = 0
					
					table.style.fontSize = '0.9em';
					table.style.color = '#000000';
					table.style.marginLeft = '0';

					var id_table = 'info_sup_xcompteur';					
					table.setAttribute('id',id_table);
					

					var tablebody = document.createElement('tbody');
					
					
					for (var cle in tab['data'])
						{
							if (cpt % nbCols == 0) var tr = document.createElement('tr');
										
							var dat = document.createTextNode(cle);						
							var p_dat = document.createElement('p');
							
							p_dat.style.fontSize = '0.8em';
							p_dat.style.textAlign = 'center';
							
							p_dat.appendChild(dat);
							
							
							var qte = document.createTextNode(tab['data'][cle]);	
							var p_qte = document.createElement('p');
							
							p_qte.style.fontWeight = 'bold';
							p_qte.style.textAlign = 'center';
							p_qte.style.paddingTop = '0.3em';					
							
							p_qte.appendChild(qte);
							
														
							var td = document.createElement('td');
							td.style.width = '5em';
							td.style.padding = '0.3em';
							td.style.borderTop = '1px solid #ccc';
							
							
							td.appendChild(p_dat);
							td.appendChild(p_qte);
							
							
							tr.appendChild(td);
						
						
							if (cpt % nbCols == (nbCols - 1)) tablebody.appendChild(tr);	
								
															
							cpt++;			
						}
						
						
					if (cpt != 0 && (cpt % nbCols != 0)) 
						{ 
							var txt_comp = document.createTextNode(' ');
							var colspan =  nbCols - (cpt % nbCols);
							
							var td_comp = document.createElement('td');
							td_comp.setAttribute('colspan',colspan);

							td_comp.appendChild(txt_comp);
							
							tr.appendChild(td_comp);
							tablebody.appendChild(tr);
						}	
								
								
					table.appendChild(tablebody);
							
				
					if (cpt > 0)
						{
							cible.insertBefore(table,cible.firstChild);
							
							cible.style.marginLeft = 103+'px';
							
							setTimeout(function(){Scrolldown (id_table)},250);
						}
					
				}
	
		}
	}

	var dir = 'compteur_sup_json.php5?limite='+this.limite_query+'';
	
	xhr.open('GET', dir, true);
	
	xhr.send(null);
	
}
