function popup( url, nom, w, h )
{
	var top =(screen.height-h)/2; 
	var left=(screen.width-w)/2;
	window.open(url,nom,"width="+w+", height="+h+", resizable=yes, scrollbars=yes, toolbar=no, location=no, directories=no, status=no, menubar=no, copyhistory=no, top=" + top + ", left=" + left);
}

function getXMLHTTP(){

	  var xhr=null;

	  if(window.XMLHttpRequest) // Firefox et autres

	  xhr = new XMLHttpRequest();

	  else if(window.ActiveXObject){ // Internet Explorer

	    try {

	      xhr = new ActiveXObject("Msxml2.XMLHTTP");

	    } catch (e) {

	      try {

	        xhr = new ActiveXObject("Microsoft.XMLHTTP");

	      } catch (e1) {

	        xhr = null;

	      }

	    }

	  }

	  else { // XMLHttpRequest non supporté par le navigateur

	    alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");

	  }

	  return xhr;

}

function traitereponse(reponse) 
{
var liste_valeur = new Array();
var liste_option = new Array();
var liste_fin = new Array();

liste_valeur = reponse.split("-/-");
liste_option= liste_valeur[1].split("/fin/");

var nb =liste_option.length;
	for(var f=0; f<nb; f++)
	{
		liste_fin[f] = liste_option[f].split(",");
	}

	return liste_fin;
}
function affine_formation(select_domaine, url_prefixe)
{
var id_rubrique = select_domaine.options[select_domaine.options.selectedIndex].value;
//console.log(id_rubrique);

if(!url_prefixe){ var url_prefixe = ""; }
if(id_rubrique!="")
{
var url = url_prefixe+"index.php?page=recharge_formation&id_rubrique="+id_rubrique;
	
	_xmlHttp=getXMLHTTP();
	if(_xmlHttp)
	{

		_xmlHttp.open("GET",url,true);
		_xmlHttp.onreadystatechange=function(){
			if(_xmlHttp.readyState==4 && _xmlHttp.responseText ) 
			{
				var rep = traitereponse( _xmlHttp.responseText );
				var input_formation =  document.getElementById('Lieu_FORM___________');
				
				//console.log(rep);
				//console.log(rep[0][0]);
				//console.log(rep[0][1]);
				//if (!$('Lieu_FORM___________')) return;	
				//if(rep[1]!="") {$('auberge').innerHTML="";$('auberge').options.innerHTML="fbgsdf<option>selectionnez...</OPTION>"+rep[1];}alert($('auberge').innerHTML);
				
				if(rep.length!=0) {
				input_formation.length = 1;
				input_formation.options[0] = new Option('Selectionnez...', '','','');
					 for(var f=0; f<(rep.length); f++)
					{
					input_formation.options[ (1+f) ] = new Option(rep[f][1], rep[f][0],'','');
					}
				}
				
			}	

		};
			_xmlHttp.send(null)// envoi de la requete null pour GET			
	}	

}
else
{
document.getElementById('Lieu_FORM___________').selectedIndex = 0;
document.getElementById('Lieu_FORM___________').length = 1;
}

}


function incremente_champ(formation)
{

var valeur_champ_formation = formation.options[formation.options.selectedIndex].text;

var choix=document.getElementById("Choix_diplome____3");
	choix.value=valeur_champ_formation;
	choix.style["width"]="470px"

}


