// JavaScript Document

function modifImage(id, src)
{
	document.getElementById(id).src = dataImage+src;
}

function fileGET(fichier)
{
	return fileAjax(fichier,null,"GET",false);
}

function filePOST(fichier,info)
{
	return fileAjax(fichier,info,"POST",true);
}

function fileAjax(fichier,info,format,asyn)
{
	if(window.XMLHttpRequest) // FIREFOX
	  xhr_object = new XMLHttpRequest(); 
	else if(window.ActiveXObject) // IE
	  xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
	else 
	  return(false); 
	  
	xhr_object.open(format, fichier, asyn); 
	if (format == "POST")
	{
		xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");  
		xhr_object.onreadystatechange = function() {   
		   if(xhr_object.readyState == 4)  
		   {
//			   alert(xhr_object.responseText);
			  afficher(xhr_object.responseText);   
		   }

		}  

	}
	xhr_object.send(info); 
	if(xhr_object.readyState == 4) return(xhr_object.responseText);
	else return(false);
}

function afficherElement(obj,etat)
{
	var el = document.getElementById(obj);
	if (!el) return;
	if(etat)
	{
		el.style.display = "block";
	}
	else
	{
		el.style.display = "none";
	}
}

function chgcolor(ligne,action)
{
	if (action == 'in')
		col1 = 'E2FFE1';
	else
	if (action == 'clic')
		col1 = 'FFCC99';
	else
		col1 = '';
		
	ligne.setAttribute('bgcolor', col1, 0);
}

function popupcentrer(obj)
{
	var el = document.getElementById(obj);

	var hh = el.offsetHeight;
	var vv = el.offsetWidth;

	position_y = (screen.height - hh)/4;
	position_x = (screen.width - vv)/2;
			
	el.style.top = position_y+"px";
	el.style.left = position_x+"px";
}

function afficherOmbrage(id,etat)
{
	var el = document.getElementById(id);
	if (!el) return;

	if(etat)
	{
		el.style.height = document.body.clientHeight;
		el.style.width = document.body.clientWidth;
		el.style.display = "block";
	}
	else
	{
		el.style.display = "none";
	}
}

function pleinePage(obj)
{
	var el = document.getElementById(obj);
			
	el.style.top = "0px";
	el.style.left = "0px";
	el.style.width= screen.width;
	el.style.height= screen.height;
}

function smfFooterHighlight(element, value)
{
	element.src = nameServeur + "partenaires/" + (value ? "h_" : "") + element.id + ".png";
}

function allerAURL(url)
{
	this.document.location = url;
}

function telechargerFichier(num)
{
	var info = 'fichier='+num;
	filePOST('getFile.php',info);
}

function changeLangue(id)
{
//	select = document.getElementById("select");
	id.style.backgroundImage = id.options[id.selectedIndex].style.backgroundImage;
}