function news_alert()
{

	this.typeOuvrage = new news_alert.obj_genre();
	this.choiceTheme = new news_alert.obj_famille(); 
	this.choiceSousTheme = new news_alert.obj_sous_famille(); 
	this.choiceSousSousTheme = new news_alert.obj_sous_sous_famille();
	this.txt_alert = new news_alert.obj_texte();
}


// Interface d'ecriture du rappel des choix saisie via clavier 
news_alert.obj_texte = function()
{
	this.titleNews = document.getElementById("txt_nameAlert");
	this.title = document.getElementById("txtTitre");
	this.auteur = document.getElementById("txtAuteur");
	this.editeur = document.getElementById("txtEditeur");
	this.collection = document.getElementById("txtCollection");
	
	
	this.rappel_titleNews = document.getElementById("valueOf_txt_nameAlert");
	this.rappel_title = document.getElementById("valueOf_title");
	this.rappel_auteur = document.getElementById("valueOf_auteurs");
	this.rappel_editeur = document.getElementById("valueOf_Editeurs");
	this.rappel_collection = document.getElementById("valueOf_Collections");
	
	 
	this.loadRappelRayon = function()
	{  
		if (objAlert.typeOuvrage.livres.checked)
		{
			objAlert.typeOuvrage.txt_rappel.innerHTML = "<strong>Type d'ouvrage :</strong> Livres";
			
			if (objAlert.choiceTheme.select.selectedIndex > 0) 
			{
				objAlert.choiceTheme.txt_rappel.innerHTML = "<strong>Th\351mes :</strong> " + objAlert.choiceTheme.select.options[objAlert.choiceTheme.select.selectedIndex].text;
			}
			else
			{
				objAlert.typeOuvrage.affiner();
			}
		}
		else if (objAlert.typeOuvrage.cd_dvd.checked)
		{
			objAlert.typeOuvrage.txt_rappel.innerHTML = "<strong>Type d'ouvrage :</strong> Musique et DVD";
			if (objAlert.choiceTheme.select.selectedIndex > 0) 
			{
				objAlert.choiceTheme.txt_rappel.innerHTML = "<strong>Th\351mes :</strong> " + objAlert.choiceTheme.select.options[objAlert.choiceTheme.select.selectedIndex].text;
			}
			else
			{
				objAlert.typeOuvrage.affiner();
			}
			
		}
		else if (objAlert.typeOuvrage.tous.checked)
		{
			objAlert.typeOuvrage.txt_rappel.innerHTML = "<strong>Type d'ouvrage :</strong> Tous";
			objAlert.choiceTheme.txt_rappel.innerHTML = "";
			objAlert.choiceTheme.select.disabled = 'disabled';
		}
		else
		{ return;}

		 
	
		var allTabCheck = objAlert.choiceSousTheme.obj_sousSousFam;
	
		for (i = 0; i < allTabCheck.length; i++)
		{
			objAlert.choiceSousTheme.i_current =i;
			objAlert.choiceSousTheme.majObj_sousSousFam(allTabCheck[i][0],allTabCheck[i][2])
		}
			
	}
	
	this.copyPast_searchName  = function()
	{
		if (this.titleNews.value.length > 0)
		{this.rappel_titleNews.innerHTML = this.titleNews.value;}
		else
		{this.rappel_titleNews.innerHTML = "Nouvelle recherche";}
	}
	
	this.copyPast_title  = function()
	{
		if (this.title.value.length > 0)
		{this.rappel_title.innerHTML = "<strong>Titre : </strong>" + this.title.value;}
		else
		{this.rappel_title.innerHTML = "<strong>Titre : </strong>Aucun crit\350re";}
	}
	
	this.copyPast_auteur= function()
	{
		if (this.auteur.value.length > 0)
		{this.rappel_auteur.innerHTML = "<strong>Auteur : </strong>" + this.auteur.value;}
		else
		{this.rappel_auteur.innerHTML = "<strong>Auteur : </strong>Aucun crit\350re";}
	}
	
	this.copyPast_editeur = function()
	{
		if (this.editeur.value.length > 0)
		{this.rappel_editeur.innerHTML = "<strong>Editeur : </strong>" + this.editeur.value;}
		else
		{this.rappel_editeur.innerHTML = "<strong>Editeur : </strong>Aucun crit\350re";}
	}
	
	this.copyPast_collection = function()
	{
		if (this.collection.value.length > 0)
		{this.rappel_collection.innerHTML = "<strong>Collection : </strong>" + this.collection.value;}
		else
		{this.rappel_collection.innerHTML = "<strong>Collection : </strong>Aucun crit\350re";}
	}
	
 
	
	if (this.title)
	{
		// on associe à chacun, sur l'évenement onChange, les opération necessaire à la mise à jour de la liste déroulante des themes
		if (typeof window.addEventListener == "function")
		{		
			this.titleNews.addEventListener("keyup", function(){objAlert.txt_alert.copyPast_searchName()}, false);
			this.title.addEventListener("keyup", function(){objAlert.txt_alert.copyPast_title()}, false);
			this.auteur.addEventListener("keyup", function(){objAlert.txt_alert.copyPast_auteur()}, false);
			this.editeur.addEventListener("keyup", function(){objAlert.txt_alert.copyPast_editeur()}, false);
			this.collection.addEventListener("keyup", function(){objAlert.txt_alert.copyPast_collection()}, false);
		
		}
		else
		{
			this.titleNews.attachEvent("onkeyup", function(){objAlert.txt_alert.copyPast_searchName()}, false);
			this.title.attachEvent("onkeyup", function(){objAlert.txt_alert.copyPast_title()}, false);
			this.auteur.attachEvent("onkeyup", function(){objAlert.txt_alert.copyPast_auteur()}, false);
			this.editeur.attachEvent("onkeyup", function(){objAlert.txt_alert.copyPast_editeur()}, false);
			this.collection.attachEvent("onkeyup", function(){objAlert.txt_alert.copyPast_collection()}, false);
		}
		
		this.copyPast_searchName();
		this.copyPast_title();
		this.copyPast_auteur();
		this.copyPast_editeur();
		this.copyPast_collection();
		
	}
		
}

// objet gerant le choix du genre, et l'ecriture dans la zone de rappel
news_alert.obj_genre = function()
{
	// on récupere pour ces 3 éléments les objets html
	this.tous = document.getElementById("rdb_all_ouvrage");
	this.livres = document.getElementById("rdb_ouvrage_livre");
	this.cd_dvd = document.getElementById("rdb_ouvrage_musique_et_dvd"); 
	this.txt = document.getElementById("txt_typeOuvrage");
	this.label_tous = document.getElementById("label_all_ouvrage");
	this.label_livres = document.getElementById("label_ouvrage_livre");
	this.label_cd_dvd = document.getElementById("label_ouvrage_musique_et_dvd");
	this.txt_rappel = document.getElementById("rappel_typeOuvrage");
	this.isRaffine = false;
	
	if (this.tous)
	{
		// on associe à chacun, sur l'évenement onChange, les opération necessaire à la mise à jour de la liste déroulante des themes
		if (typeof window.addEventListener == "function")
		{		
			// this.tous.addEventListener("click", function(){objAlert.typeOuvrage.empty_div()}, false);
			// this.livres.addEventListener("click", function(){objAlert.typeOuvrage.livre_div()}, false);
			// this.cd_dvd.addEventListener("click", function(){objAlert.typeOuvrage.cddvd_div()}, false);
			this.cd_dvd.addEventListener("click", function(){objAlert.typeOuvrage.affiner()}, false);
			this.livres.addEventListener("click", function(){objAlert.typeOuvrage.affiner()}, false);
			this.tous.addEventListener("click", function(){objAlert.typeOuvrage.raz()}, false);
		}
		else
		{
			this.cd_dvd.attachEvent("onclick", function(){objAlert.typeOuvrage.affiner()}, false);
			this.livres.attachEvent("onclick", function(){objAlert.typeOuvrage.affiner()}, false);
			this.tous.attachEvent("onclick", function(){objAlert.typeOuvrage.raz()}, false);
			// this.tous.attachEvent("onclick", function(){objAlert.typeOuvrage.empty_div()}, false);
			// this.livres.attachEvent("onclick", function(){objAlert.typeOuvrage.livre_div()}, false);
			// this.cd_dvd.attachEvent("onclick", function(){objAlert.typeOuvrage.cddvd_div()}, false);
		}
		
	
	}
	
	// l'utilisateur a demander d'affiner
	this.affiner = function()
	{
		objAlert.choiceTheme.dispose() 
				
		if (this.livres.checked)
		{this.livre_div();this.txt_rappel.innerHTML = "<strong>Type d'ouvrage :</strong> Livres";}
		else if (this.cd_dvd.checked)
		{this.cddvd_div();this.txt_rappel.innerHTML = "<strong>Type d'ouvrage :</strong> Musique et DVD";}
		else if (this.tous.checked)
		{this.txt_rappel.innerHTML = "<strong>Type d'ouvrage :</strong> Tous";}
		else
		{ return;}
			   
		
		// on associe à chacun, sur l'évenement onChange, les opération necessaire à la mise à jour de la liste déroulante des themes
		this.isRaffine = true;
	}
	
	this.raz = function()
	{
		this.dispose();
	}
	
	this.dispose = function()
	{
		this.tous.checked = true;
		this.txt_rappel.innerHTML = "<strong>Type d'ouvrage :</strong> Tous";
			
		objAlert.choiceTheme.dispose() 
	}
		
	// evenement click sur bouton "Livre"
	this.livre_div = function()
	{
		// on n'effectue l'action seulement si nous ne sommes pas d"ja en livre
		if (objAlert.choiceTheme.currentGenre != "LIVRE")
		{
			objAlert.choiceTheme.div.innnerHTML = "... LIVRES ...";
			objAlert.choiceTheme.currentGenre = "LIVRE";
			
			var myXHR = new httpRequest(objAlert.choiceTheme.xhrPath + "?idControl=31&id=W-1" , "", "POST");
			myXHR.LoadContent("arbo_famille" ,"Chargement en cours","objAlert.choiceTheme.reloadElement();");
		}
	}
	
	// evenement click sur bouton "Cd DVD"
	this.cddvd_div = function()
	{
		// on n'effectue l'action seulement si nous ne sommes pas d"ja en DVD
		if (objAlert.choiceTheme.currentGenre != "CD_DVD")
		{
			objAlert.choiceTheme.div.innnerHTML = "... CD_DVD ...";
			objAlert.choiceTheme.currentGenre = "CD_DVD";
			
			
			var myXHR = new httpRequest(objAlert.choiceTheme.xhrPath + "?idControl=31&id=W-2" , "", "POST");
			myXHR.LoadContent("arbo_famille" ,"Chargement en cours","objAlert.choiceTheme.reloadElement();");
		}
	}
}

news_alert.obj_famille = function ()
{
	this.currentGenre = "ALL";
	this.div = document.getElementById("arbo_famille");
	this.select = document.getElementById("slt_allTheme");
	this.xhrPath = "/ajax/ajax_request.aspx";	
	this.bouton_affine = document.getElementById("btn_affiner_theme");
	this.bouton_raz = document.getElementById("btn_raz_theme");
	this.txt = document.getElementById("lbl_allTheme");
	this.txt_rappel = document.getElementById("rappel_theme");
	this.isRaffine = false;
	
	this.reloadElement = function()
	{
		this.select = document.getElementById('slt_allTheme')
		this.bouton_raz = document.getElementById("btn_raz_theme");
		this.bouton_affine = document.getElementById("btn_affiner_theme");
		this.txt = document.getElementById("lbl_allTheme");
		
		this.addEvent();
	}
	
	this.addEvent = function()
	{
		// on associe un evenement sur le bouton ;)	
		if (typeof window.addEventListener == "function")
		{		
			this.select.addEventListener("change", function(){objAlert.choiceTheme.affinage()}, false);
			// this.bouton_raz.addEventListener("click", function(){objAlert.choiceTheme.raz()}, false);
			// this.select.addEventListener("change", function(){objAlert.choiceTheme.changeTheme()}, false);
			
		}
		else
		{
			this.select.attachEvent("onchange", function(){objAlert.choiceTheme.affinage()}, false);
			//this.bouton_raz.attachEvent("onclick", function(){objAlert.choiceTheme.raz()}, false);
		//	this.select.attachEvent("onchange", function(){objAlert.choiceTheme.changeTheme()}, false);
		}
	}
	this.affinage = function()
	{
		this.txt_rappel.innerHTML = "<strong>Th\350me : </strong>" + this.select.options[this.select.selectedIndex].text
				
		// on ne charge le div des sous theme que SI il a été renseigné un theme ;)
		if (this.select.selectedIndex > 0)
		{
			var myXHR = new httpRequest(this.xhrPath + "?idControl=32&id=" + this.select.options[this.select.selectedIndex].value , "", "POST");
			myXHR.LoadContent("arbo_sous_famille" ,"Chargement en cours","objAlert.choiceSousTheme.reloadElement();");
		}

		
	} 
	
	this.dispose = function()
	{	
		this.currentGenre = "ALL";
		this.select.selectedIndex = 0;
		this.select.disabled = 'disabled';
		this.txt_rappel.innerHTML = "Th\351mes : Tous les th\351mes";
	
		objAlert.choiceSousTheme.dispose();			
	}
	// this.changeTheme = function()
	
	if (this.bouton_affine){this.addEvent()}
}

news_alert.obj_sous_famille = function ()
{
	this.div = document.getElementById("arbo_sous_famille");
	this.select = document.getElementById("slt_sousTheme");
	this.xhrPath = "/ajax/ajax_request.aspx";	
	this.obj_sousSousFam = new Array();
	this.i_current = 0;
	
	// le tableau est quasiment correctement remplis, il ne manque que la case 2 du tablea, contenant le tableau de checkbox
	this.add_obj_sousSousFam = function(thisArray, nbElement)
	{
		var obj_div_temp = document.createElement("div");
		obj_div_temp.innerHTML = thisArray[1];
		
		
		 
		objAlert.choiceSousSousTheme.div.innerHTML = thisArray[1];
		objAlert.choiceSousSousTheme.reloadElement(thisArray[0]); 
	
		this.i_current += 1;
		
	}
	
	this.reloadElement = function()
	{
		this.select = document.getElementById("slt_sousTheme");
		this.i_current = 0;
		
		this.addEvent();
	}
	
	this.dispose = function()
	{
	
		this.select.selectedIndex = 0;
		this.select.disabled = 'disabled';
		
		this.dispose_sousSousTheme();
	}
	
	
	this.dispose_sousSousTheme = function()
	{
		var arboRappel = document.getElementById("alert-rappel_arborescence");
			var i = 0; 
			this.obj_sousSousFam = new Array();
		objAlert.choiceSousSousTheme.div.innerHTML = "";
		
		var noeuds = arboRappel.firstChild;

		while (noeuds!=null) 
		{
			if(noeuds && (noeuds.tagName == "dl" || noeuds.tagName == "DL"))
			{
				arboRappel.removeChild(noeuds);
				noeuds = arboRappel.firstChild
			}
			else
			{noeuds = noeuds.nextSibling;}
			
			 
		}
	
	}
	
	this.getAllChoice = function()
	{
		var i = 0;
		var j = 0;
		var txtReturn = "";
		var txt_tmp_return = "";
		var txtTmp = "";

		if (objAlert.typeOuvrage.tous.checked)
		{return "&idGenre=0";}
		else if (objAlert.typeOuvrage.livres.checked)
		{txtReturn = "&idGenre=W-1";}
		else if (objAlert.typeOuvrage.cd_dvd.checked)
		{txtReturn = "&idGenre=W-2";}
		
		if (objAlert.choiceTheme.select.selectedIndex == 0)
		{return "&idGenre=0&idFamille=0";}
		else
		{txtReturn += "&idFamille=" + objAlert.choiceTheme.select.options[objAlert.choiceTheme.select.selectedIndex].value + "&idSel=";}

		// on choppe les différentes sous famille et sous sous famille
		for (i; i < this.obj_sousSousFam.length; i++)
		{
			var nbSel = 0;
			txtTmp = "";
			for (j = 0; j < this.obj_sousSousFam[i][2].length; j++)
			{
				if (this.obj_sousSousFam[i][2][j].checked)
				{
					if (txtTmp.length > 0)
					{txtTmp += "," + this.obj_sousSousFam[i][2][j].value;}
					else
					{txtTmp = this.obj_sousSousFam[i][2][j].value;}
					nbSel += 1;
				}
			}
			
			if (nbSel == this.obj_sousSousFam[i][2].length)
			{
				if (txt_tmp_return.length > 0){txt_tmp_return += "," + this.obj_sousSousFam[i][3];}
				else {txt_tmp_return = this.obj_sousSousFam[i][3];}
			}
			else if (nbSel > 0)
			{
				if (txt_tmp_return.length > 0){txt_tmp_return += "," + txtTmp;}
				else {txt_tmp_return = txtTmp;}
			}
		}
		
		
		return txtReturn + txt_tmp_return;
	
	}
	
	this.haveChoice = function()
	{
		var i = 0;
		var j = 0;
		
		// on choppe les différentes sous famille et sous sous famille
		for (i; i < this.obj_sousSousFam.length; i++)
		{
			var nbSel = 0;
			txtTmp = "";
			for (j = 0; j < this.obj_sousSousFam[i][2].length; j++)
			{
				if (this.obj_sousSousFam[i][2][j].checked)
				{
					return true;
				}
			}
		}
		
		return false
	}
	
	this.majObj_sousSousFam = function(idSousFam, tabTmp)
	{
		var lastObj_dl = document.getElementById("rappel_" + idSousFam);
		var objDl_beforeNewDL;
		var obj_dl = document.createElement("dl");
		var obj_dt = document.createElement("dt");
		var nbChild = 0;
		var i = 0;
		var posInSel = -1;
		var objMother = document.getElementById("alert-rappel_arborescence"); // récupération de l'élément contenant les DL
		
		// on affecte l'id à notre DL
		obj_dl.setAttribute("id", "rappel_" + idSousFam);
		
		// on boucle sur toutes les options pour récupéré le nom du DT.
		// de plus on va mettre la main sur l'élément juste avant notre élément !
		for (i; i < this.select.options.length; i++)
		{
			// on met à jour le text du dt en fonction de l'id :=)
			if (this.select.options[i].value == idSousFam)
			{
				obj_dt.innerHTML = "<strong>Sous-th\350me : </strong><a href='#checkBox' onclick='objAlert.choiceSousTheme.showThis("+ this.i_current +")'>" + this.select.options[i].text + "</a>"; 
				posInSel=i;
			}
			
			// Une fois que l'on a trouvé noter noeud, on cherche avant qui il doit être inséré !
			if (posInSel > -1)
			{
				if (!objDl_beforeNewDL && document.getElementById("rappel_" + this.select.options[i].value))
				{objDl_beforeNewDL = document.getElementById("rappel_" + this.select.options[i].value)}
			}
		}
		
		obj_dl.appendChild(obj_dt);
		
		for (i = 0; i < tabTmp.length; i++)
		{
			if(tabTmp[i].checked)
			{
				nbChild += 1;
				var one_dd = document.createElement("dd");
				one_dd.innerHTML = tabTmp[i].parentNode.innerHTML.replace(/<[^>]*>/, "");
				obj_dl.appendChild(one_dd);
			}
		}
		
		this.obj_sousSousFam[this.i_current][2] = tabTmp; // mise à jour du tableau
	
		if (lastObj_dl)
		{
			// on efface si plus d'enfant 
			if(nbChild == 0)
			{
				objMother.removeChild(lastObj_dl)
			}
			else if (nbChild == tabTmp.length)
			{
				var one_dd = document.createElement("dd");
				
				lastObj_dl.innerHTML = "";
				
				one_dd.innerHTML = " Tout le sous-th\350me";
				
				lastObj_dl.appendChild(obj_dt);
				lastObj_dl.appendChild(one_dd);
			}
			else
			{lastObj_dl.innerHTML = obj_dl.innerHTML;}
		}
		else if (nbChild > 0)
		{
			if (nbChild == tabTmp.length)
			{
							var one_dd = document.createElement("dd");
				
				obj_dl = document.createElement("dl");
				// on affecte l'id à notre DL
		obj_dl.setAttribute("id", "rappel_" + idSousFam);
				one_dd.innerHTML = " Tout le sous th\350me";
				
				obj_dl.appendChild(obj_dt);
				obj_dl.appendChild(one_dd);
			}
			
			if (objDl_beforeNewDL)
			{
				objMother.insertBefore(obj_dl, objDl_beforeNewDL);
			}
			else
			{
				objMother.appendChild(obj_dl);
			}
			
		}
	}
	
	this.showThis = function(curI)
	{
		this.i_current= curI;
		var currentId = this.obj_sousSousFam[this.i_current][0];
		
		for (var iTab = 0; iTab < this.select.options.length; iTab ++)
		{
			if (this.select.options[iTab].value == currentId)
			{
				this.select.options[iTab].selected = true;
			}
			else
			{
				this.select.options[iTab].selected = false;
			}
		}
		
		
		objAlert.choiceSousSousTheme.div.innerHTML = this.obj_sousSousFam[this.i_current][1];
		objAlert.choiceSousSousTheme.reLaunch(this.obj_sousSousFam[this.i_current][2], currentId);
	}
	
	this.printContent = function()
	{
		
		// on ne charge le div des sous theme que SI il a été renseigné un theme ;)
		if (this.select.selectedIndex > 0)
		{
			var i = 0;
			var currentId = this.select.options[this.select.selectedIndex].value;
			var isLoad = false;
			
			for(i = 0; i < this.obj_sousSousFam.length; i++)
			{
				if (this.obj_sousSousFam[i][0] == currentId)
				{
					isLoad = true;
					this.i_current = i;
					
					objAlert.choiceSousSousTheme.div.innerHTML = this.obj_sousSousFam[i][1];
					objAlert.choiceSousSousTheme.reLaunch(this.obj_sousSousFam[i][2], currentId);
				}
			}

			if (!isLoad)
			{
				var myXHR = new httpRequest(this.xhrPath + "?idControl=33&id=" + currentId , "", "POST");
				myXHR.LoadContent("arbo_sous_sous_famille" ,"Chargement en cours","objAlert.choiceSousSousTheme.reloadElement('" + currentId + "');");
			}
		}
		else
		{
			objAlert.choiceSousSousTheme.div.innerHTML = "";
		}
			
	}
	
	this.addEvent = function()
	{
		// on associe un evenement sur le bouton ;)	
		if (typeof window.addEventListener == "function")
		{		
			this.select.addEventListener("change", function(){objAlert.choiceSousTheme.dispose_sousSousTheme();objAlert.choiceSousTheme.printContent()}, false);
		}
		else
		{
			this.select.attachEvent("onclick", function(){objAlert.choiceSousTheme.dispose_sousSousTheme();objAlert.choiceSousTheme.printContent()}, false);		
		}
	}
	
	if (this.select) {this.addEvent()}
}

news_alert.obj_sous_sous_famille = function ()
{
	this.div = document.getElementById("arbo_sous_sous_famille");
	this.chkBox_all = document.getElementById("chkBox_ssSsTheme_all");
	this.chkBox = new Array();
	this.nbCheckBox = 0;
	this.nbCheckBox_checked = 0;
	this.checkBoxAll_isInProgress = false;
	this.id_sousFamille = "";
	
	this.reloadElement = function(idSousFam)
	{
		this.div = document.getElementById("arbo_sous_sous_famille");
		this.chkBox_all = document.getElementById("chkBox_ssSsTheme_all");
		this.nbCheckBox = 1;
		this.nbCheckBox_checked = 0;
		this.id_sousFamille = idSousFam;
		this.chkBox = new Array();
		var arraySsSsFam = new Array();
		
		var isEnd = false
		
		arraySsSsFam[0] = idSousFam;
		arraySsSsFam[1] = this.div.innerHTML;
		arraySsSsFam[2] = new Array();
		arraySsSsFam[3] = idSousFam;
						
		while (!isEnd)
		{
			var newCheckBox = document.getElementById("chkBox_ssSsTheme_" + this.nbCheckBox);
			
			if (newCheckBox)
			{

				this.chkBox.push(newCheckBox);
				arraySsSsFam[2].push(newCheckBox);
				this.nbCheckBox += 1
				
				// on associe un evenement sur le bouton ;)	
				if (typeof window.addEventListener == "function")
				{newCheckBox.addEventListener("change", function(){objAlert.choiceSousSousTheme.majCheckList()}, false);}
				else
				{newCheckBox.attachEvent("onclick", function(){objAlert.choiceSousSousTheme.majCheckList()}, false);}
			}
			else
			{
				isEnd = true;
			}
		}
		
		this.nbCheckBox -= 1; // on décremente de 1 car la position XSL comment a 1... un tableau javascript commence à 0 ;)
		 
		// on associe un evenement sur le bouton ;)	
		if (typeof window.addEventListener == "function")
		{		
			this.chkBox_all.addEventListener("change", function(){objAlert.choiceSousSousTheme.changeCheckAll()}, false);
		}
		else
		{
			this.chkBox_all.attachEvent("onclick", function(){objAlert.choiceSousSousTheme.changeCheckAll()}, false);	
		}
		
		objAlert.choiceSousTheme.obj_sousSousFam.push(arraySsSsFam)
		objAlert.choiceSousTheme.i_current = objAlert.choiceSousTheme.obj_sousSousFam.length - 1;
		
		if (this.chkBox_all.checked)
		{
		objAlert.choiceSousSousTheme.changeCheckAll()
		}
		 
	
		
	}
	
	this.reLaunch = function(curObj_check, idSousFam)
	{
		this.div = document.getElementById("arbo_sous_sous_famille");
		this.chkBox_all = document.getElementById("chkBox_ssSsTheme_all");
		this.nbCheckBox = curObj_check.length;
		this.chkBox = new Array();
		this.nbCheckBox_checked = 0;
		this.id_sousFamille = idSousFam;
		
		// on associe un evenement sur le bouton ;)	
		if (typeof window.addEventListener == "function")
		{		
			this.chkBox_all.addEventListener("change", function(){objAlert.choiceSousSousTheme.changeCheckAll()}, false);
		}
		else
		{
			this.chkBox_all.attachEvent("onclick", function(){objAlert.choiceSousSousTheme.changeCheckAll()}, false);	
		}
		
		
		var i = 0;
		var iMax = curObj_check.length
		
		
		for (i = 0; i < iMax; i++)
		{
			var newCheckBox = document.getElementById("chkBox_ssSsTheme_" + (i + 1));
			
			if (newCheckBox)
			{
				if (curObj_check[i].checked)
				{
					this.nbCheckBox_checked += 1
					newCheckBox.checked = true;
				}
				
				this.chkBox.push(newCheckBox);
				
				// on associe un evenement sur le bouton ;)	
				if (typeof window.addEventListener == "function" )
				{newCheckBox.addEventListener("change", function(){objAlert.choiceSousSousTheme.majCheckList()}, false);}
				else 
				{newCheckBox.attachEvent("onclick", function(){objAlert.choiceSousSousTheme.majCheckList()}, false);}
			}
			
			
		}
	
		if (this.nbCheckBox_checked == iMax)
		{
			this.chkBox_all.checked = true;
			this.changeCheckAll();
		}
	}
	
	
	// met à) jour le tableau de checkBox présent pour tous les sous theme du présent theme
	this.majCheckList = function()
	{
		if (!this.checkBoxAll_isInProgress)
		{
			var tabTmp = new Array();
			var i = 0; 
			
			for(i = 0; i < this.nbCheckBox; i++)
			{
				tabTmp.push(document.getElementById("chkBox_ssSsTheme_" + (i + 1)));
				
			}
			//objAlert.choiceSousTheme.obj_sousSousFam[objAlert.choiceSousTheme.i_current][2] = tabTmp;
			objAlert.choiceSousTheme.majObj_sousSousFam(this.id_sousFamille, tabTmp);
		} 
	
	}
	 
	
	// si la checkBox "Tout le sous thème" a été coché, on coche toutes les autres, et on les grise
	this.changeCheckAll = function()
	{
		this.checkBoxAll_isInProgress = true; // pour éviter le déclanchement de l'evenement lié à chaque checkbox
		var color = "#cac8bb";
		var i = 0;

		// si on a décoché, on remet en noir les checkBox de sous sous theme
		if (!this.chkBox_all.checked)
		{color = "#000"}

		// on tourne sur chaque checkbox
		for(i = 0; i < this.nbCheckBox; i++)
		{
			this.chkBox[i].checked = this.chkBox_all.checked;
			this.chkBox[i].disabled = this.chkBox_all.checked;
			this.chkBox[i].parentNode.style.color = color;
		}
	
		this.checkBoxAll_isInProgress = false; // maintenant que l"'on a finit... on précise que l'evenement lié à chaque checkbopx peut être appelé
		
		// et on met à jour la reference des checkBox
		this.majCheckList();
	}
}

// on initialise l'objet alert
var objAlert = new Object;



function submit_alert()
{
	
	var param_uri = ""
	var xhrPath = "/ajax/ajax_request.aspx";	 
	var strAllChoice = objAlert.choiceSousTheme.getAllChoice();
	
	/* on choppe les titre, les auteur, les editeurs, les collection */
	param_uri = "idControl=34&searchName="+ objAlert.txt_alert.titleNews.value +"&titre=" + 
	objAlert.txt_alert.title.value + "&auteur=" + objAlert.txt_alert.auteur.value + "&editeur=" + objAlert.txt_alert.editeur.value + "&collection=" + objAlert.txt_alert.collection.value + strAllChoice;
	
	// on choppe l'id recherche 
	if (document.getElementById("hid_idRecherche"))
	{param_uri += "&idRecherche=" + document.getElementById("hid_idRecherche").value;}
	
	
	if (objAlert.txt_alert.title.value.length == 0 && objAlert.txt_alert.auteur.value.length == 0 && objAlert.txt_alert.editeur.value.length == 0 && objAlert.txt_alert.collection.value.length == 0 && !objAlert.choiceSousTheme.haveChoice())
	{
		alert("Pour Valider votre alerte vous devez soit renseigner un ou plusieurs crit\350res parmi les titre, l'auteur, l'\351diteur et la collection. \n\n Soit choisir un rayon apr\350s avoir s\351lectionn\351 le type d'ouvrages (livres, DV, DVD), le th\350me et le sous th\350me.")
	}
	else
	{
		var myXHR = new httpRequest(xhrPath, param_uri, "POST");
		myXHR.sendContent("document.location.href = '/mon-espace/lettre-alerte/index.html'");
	}		
	return false			
}
