function RunFoo(swf, hauteur, largeur, couleur, nom) {
	document.write("<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\""+hauteur+"\" height=\""+largeur+"\" id=\""+nom+"\" align=\"middle\">\n");
	document.write("<param name=\"allowScriptAccess\" value=\"sameDomain\" />\n");
	document.write("<param name=\"movie\" value=\""+swf+"\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\""+couleur+"\" /><embed src=\""+swf+"\" quality=\"high\" bgcolor=\""+couleur+"\" width=\""+hauteur+"\" height=\""+largeur+"\" name=\""+nom+"\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />\n");
	document.write("</object>\n");
}
function closeMessage() {
	document.getElementById('message').style.visibility="hidden";
}
function closeMessageRedirect(url) {
	document.getElementById('message').style.visibility="hidden";
	window.location.replace(url);
}

function Show_Centrale_Menu(id){
	if (document.getElementById(id).style.display != "block") {
		document.getElementById(id).style.display="block";
	} else {
		document.getElementById(id).style.display="none";
	}
	
}

function DoRequest(page, id_block) {
	var xhr_object = null;

	if(window.XMLHttpRequest) // Firefox
	   xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // Internet Explorer
	   xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else { // XMLHttpRequest non supporté par le navigateur
	   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
	   return;
	}
	
	xhr_object.open("POST", page, true);
	xhr_object.onreadystatechange = function() {
		if(xhr_object.readyState == 4) { 
			eval(xhr_object.responseText);   
		} else if(xhr_object.readyState == 1) { 
			document.getElementById(id_block).innerHtml = "Début transfert";   
		} else if(xhr_object.readyState == 2) { 
			document.getElementById(id_block).innerHtml = "Donnée transférées";   
		} else if(xhr_object.readyState == 3) { 
			document.getElementById(id_block).innerHtml = "Traitement des données";   
		}
	}
	
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	//var data = "id_site="+document.forms["recherche"].test.value;
	var data = '';
	xhr_object.send(data);
}

function getXhr() {
	if(window.XMLHttpRequest)
		xhr = new XMLHttpRequest(); 
	
	else if(window.ActiveXObject) {
		try {
			xhr = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			xhr = new ActiveXObject("Microsoft.XMLHTTP");
		}
	} else {
		alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
		xhr = false; 
	} 
	
	return xhr;
}

function refresh() {
	var xhr = getXhr();
	xhr.onreadystatechange = function() {
		if (xhr.readyState == 4 && xhr.status == 200) {
			reponse = xhr.responseText;
			document.getElementById('actualites_horizontal').innerHTML = reponse
		}
	}
	xhr.open('GET', 'includes/actualites_horizontal_AJAX.php', true);
	//xhr.setRequestHeader('Content-Type','text/html;  charset=ISO-8859-1');
	xhr.send(null);
}

function MoveScrollContent () {
	if (curentContent == 1) {
		var ThisBlock = 10;
	} else {
		var ThisBlock = curentContent - 1;
	}
	
	if (styleTop == 0) {
		var ScriptOffsetCurrent = 0;
	} else {
		var ScriptOffsetCurrent = document.getElementById('Content_Scroll_'+ThisBlock).style.top;
	}
	
	
	var ScriptPositionCurrent = document.getElementById('Content_Scroll_'+ThisBlock).style.position;
	var Next_Scrolling = styleTop - 1;
	var Next_StopstyleTop = StopstyleTop + 1;
	
	if (Next_StopstyleTop < (HeightCurrent + 10)) {
		document.getElementById('Content_Scroll_'+ThisBlock).style.position = 'absolute';
		document.getElementById('Content_Scroll_'+ThisBlock).style.top = Next_Scrolling+'px';
		//document.getElementById('ScriptOffsetCurrent').value = ScriptOffsetCurrent+' _ '+StopstyleTop+' _ '+ScriptPositionCurrent;
		
		this.styleTop = Next_Scrolling;
		this.StopstyleTop = Next_StopstyleTop;
	} else {
		this.styleTop = 0;
		this.StopstyleTop = 0;
		document.getElementById('Content_Scroll_'+ThisBlock).style.display = 'none';
		document.getElementById('Content_Scroll_'+ThisBlock).style.top = '0px';
		document.getElementById('Content_Scroll_'+ThisBlock).style.position = '';
		stop();
	}
}

function ScrollContent() {
	
	if ((curentContent + 1) > nb_content) {
		var next_scroll = 1;
	} else {
		var next_scroll = curentContent + 1;
	}
	
	var HeightCurrent = document.getElementById('Content_Scroll_'+curentContent).offsetHeight;
	var OffsetCurrent = document.getElementById('Content_Scroll_'+curentContent).offsetTop;
	var OffsetNext = document.getElementById('Content_Scroll_'+next_scroll).offsetTop;
	
	/*document.getElementById('CurrentScroll').value = curentContent;
	document.getElementById('HeightCurrent').value = HeightCurrent;
	document.getElementById('OffsetCurrent').value = OffsetCurrent;
	document.getElementById('NextScroll').value = next_scroll;
	document.getElementById('OffsetNext').value = OffsetNext;*/
	
	this.styleTop = 0;
	this.StopstyleTop = 0;
	this.HeightCurrent = HeightCurrent;
	setInterval("MoveScrollContent()", 15);
	
	document.getElementById('Content_Scroll_'+next_scroll).style.display = 'block';
	
	this.curentContent = next_scroll;
}

function StartScrolling(nb_content) {
	this.curentContent = 1;
	this.nb_content = nb_content;
	setInterval("ScrollContent()", 10000);	
}

// DANS LA FICHE PRODUIT
	function StartMediaPlayer(width, height, flv, apercu, site_url, id_player) {
		var s1 = new SWFObject("includes/flash/player/mediaplayer.swf","single",width,height,"7");
		s1.addVariable("width",width);
		s1.addVariable("height",height);
		s1.addVariable("autostart","false");
		s1.addParam("allowfullscreen","true");
		s1.addVariable("controlbar","false");
		
		s1.addVariable("showdownload","false");
		s1.addVariable("autoscroll","true");
		s1.addVariable("displaywidth",width);
		s1.addVariable("displayheight",height);
		
		s1.addVariable("file",site_url+flv);
		s1.addVariable("image",site_url+apercu);
		s1.write(id_player);
	}
	function DisplayScrollFiche(id_block) {
		if (document.getElementById(id_block).style.overflow == '') {
			document.getElementById(id_block).style.overflow = "auto";
		} else if (document.getElementById(id_block).style.overflow != "hidden") {
			document.getElementById(id_block).style.overflow = "hidden";
		} else {
			document.getElementById(id_block).style.overflow = "auto";
		}
	}
	
	function ChangeHrefAZoom(id) {
		var href_select = document.getElementById('selected_photo').href;
		document.getElementById(id).href = href_select;
	}
	
	function DisplayThisPhotoin(id_img, src, src_gd, title) {
		document.getElementById('selected_photo').href = src_gd;
		document.getElementById('photo_fiche').style.background = "url('"+src+"') 0 0 no-repeat";
		document.getElementById('photo_zoom').style.background = "url('"+src_gd+"') 0 0 no-repeat";
		
		/*document.getElementById(id_img).src = src;
		document.getElementById(id_img).title = title;
		
		document.getElementById(id_img+'_link').href = src_gd;
		document.getElementById(id_img+'_link').title = title;*/
	}
	function ShowThisOnglet(id_onglet) {
		if (id_onglet == 'info_description') {
			document.getElementById('info_description').style.display = 'block';
			if (document.getElementById('images')) {
				document.getElementById('images').style.display = 'none';
			}
			document.getElementById('document').style.display = 'none';
			if (document.getElementById('videos')) {
				document.getElementById('videos').style.display = 'none';
			}
		} else if (id_onglet == 'images') {
			document.getElementById('info_description').style.display = 'none';
			if (document.getElementById('images')) {
				document.getElementById('images').style.display = 'block';
			}
			document.getElementById('document').style.display = 'none';
			if (document.getElementById('videos')) {
				document.getElementById('videos').style.display = 'none';
			}
		} else if (id_onglet == 'document') {
			document.getElementById('info_description').style.display = 'none';
			if (document.getElementById('images')) {
				document.getElementById('images').style.display = 'none';
			}
			document.getElementById('document').style.display = 'block';
			if (document.getElementById('videos')) {
				document.getElementById('videos').style.display = 'none';
			}
		} else {
			document.getElementById('info_description').style.display = 'none';
			if (document.getElementById('images')) {
				document.getElementById('images').style.display = 'none';
			}
			document.getElementById('document').style.display = 'none';
			if (document.getElementById('videos')) {
				document.getElementById('videos').style.display = 'block';
			}
		}
	}
	
	function ChangeGestTrie() {
		document.getElementById('gest_trie').submit();
	}
	function ChangeGestPage(valeur) {
		document.getElementById('nb_page').value = valeur;
		document.getElementById('gest_page').submit();
	}
	
	
	function ShowMenu(id) {
		document.getElementById('sub_'+id).style.display = 'block';
	}
	function HideMenu(id) {
		document.getElementById('sub_'+id).style.display = 'none';
	}
