function IndexationValidator(myform) {
	if (myform) {
		url = myform.action;
		nbrFormElements = myform.elements.length;
		lastCriteria = false;
		i = 1;
		request = "";
		
		if (myform.hiddenCriteria.value) {
			hiddenCriteria = myform.hiddenCriteria.value;
		}
		else {
			hiddenCriteria = "";
		}
		while (i<nbrFormElements && !lastCriteria) {
			mycriteria = eval("myform.critere"+i);
			myoperator = eval("myform.operateur"+i);
			myvalue = eval("myform.valeur"+i);
			// 1er test pour savoir si il reste encore des critères à évaluer
			if (mycriteria) {
				// 2ième test pour savoir si le critère , son opérateur et sa valeur associée sont bien remplis pour être pris en compte.
				if (mycriteria && myoperator && myvalue && mycriteria.value && myoperator.value && (myvalue.value || myvalue.options[myvalue.selectedIndex].value)) {
					request += mycriteria.value+"/";
					if (myoperator) request += myoperator.value;
					request += "/";
					if (myvalue) {
						if (myvalue.options) {
							request += myvalue.options[myvalue.selectedIndex].value;
						}
						else request += myvalue.value;
					}
					request += "/"
				}
				i++;
			}
			else lastCriteria = true;
		}
		suite = "";
		if (window.location.search && window.location.search.length > 0) {
			paramTab = (window.location.search.substring(1)).split("&");
			for (ii=0;ii<paramTab.length;ii++) {
				if (paramTab[ii].indexOf("champs=") == 0) {
					suite += "&"+paramTab[ii];
				}
			}
		}
		window.location = url+"?request="+hiddenCriteria+request+suite;	
	}
}

function writeShowListContentNav(page,nbrElementPage,nbrElementSelect,request,url) {
	strHtml = "";
	if (page > 0 && nbrElementPage > 0 && nbrElementSelect > 0) {
		maxipage = Math.ceil(nbrElementSelect/nbrElementPage);
		if (maxipage > 1) {
			strHtml += '<table cellpadding="0" cellspacing="0" width="100%" border="0" bgcolor="#FFFFFF">';
			strHtml += '<tr><td align="center" class="prehomeTextNormal">';
			if (page != 1) {
				strHtml += '<a href ="'+url+'?request='+request+'&page='+(page-1)+'" alt="previous page"><img src="/images/communs/triangle_bleu008fbb_gauche.gif" border="0" width="3" height="5" vspace="2" hspace="2" alt="previous page"/></a> ';
			}
			for(i=1;i<=maxipage;i++) {
				if (i > 1) strHtml += "| ";
				if (i == page) strHtml += i+" ";
				else strHtml += '<a href ="'+url+'?request='+request+'&page='+i+'" alt="go to page '+i+'" class="linkon">'+i+'</a> ';
			}
			if (page != maxipage) {
				strHtml += '<a href ="'+url+'?request='+request+'&page='+(page+1)+'" alt="next page"><img src="/images/communs/triangle_bleu008fbb.gif" border="0" width="3" height="5" vspace="2" hspace="2" alt="next page"/></a> ';
			}
			strHtml += '</td></tr>';
			strHtml += '</table>';
		}
	}
	document.write(strHtml);
}


function writeShowListLibraryNav(page,nbrElementPage,nbrElementSelect,request,url) {
	strHtml = "";
	if (page > 0 && nbrElementPage > 0 && nbrElementSelect > 0) {
		maxipage = Math.ceil(nbrElementSelect/nbrElementPage);
		if (maxipage > 1) {
			strHtml += '<table cellpadding="0" cellspacing="0" width="100%" border="0" bgcolor="#FFFFFF">';
			strHtml += '<tr><td align="right" class="prehomeTextNormal">';
			if (page != 1) {
				strHtml += '<a href ="'+url+'?request='+request+'&page='+(page-1)+'" alt="previous page"><img src="/images/communs/triangle_bleu008fbb_gauche.gif" border="0" width="3" height="5" vspace="2" hspace="2" alt="previous page"/></a> ';
			}
			for(i=1;i<=maxipage;i++) {
				if (i > 1) strHtml += "| ";
				if (i == page) strHtml += i+" ";
				else strHtml += '<a href ="'+url+'?request='+request+'&page='+i+'" alt="go to page '+i+'" class="linkon">'+i+'</a> ';
			}
			if (page != maxipage) {
				strHtml += '<a href ="'+url+'?request='+request+'&page='+(page+1)+'" alt="next page"><img src="/images/communs/triangle_bleu008fbb.gif" border="0" width="3" height="5" vspace="2" hspace="2" alt="next page"/></a> ';
			}
			strHtml += '</td></tr>';
			strHtml += '</table>';
		}
	}
	document.write(strHtml);
}


function writeShowListLibraryNavComplete(page,nbrElementPage,nbrElementSelect,request,url,champs) {
	
	strHtml = "";
	if (page > 0 && nbrElementPage > 0 && nbrElementSelect > 0) {
		maxipage = Math.ceil(nbrElementSelect/nbrElementPage);
		if (maxipage > 1) {
			if (page != 1) {
				strHtml += '<a href ="'+url+'?champs='+champs+'&request='+request+'&page='+(page-1)+'" alt="previous page"><<</a> ';
			}
			for(i=1;i<=maxipage;i++) {
				if (i > 1) strHtml += "- ";
				if (i == page) strHtml += i+" ";
				else strHtml += '<a href ="'+url+'?champs='+champs+'&request='+request+'&page='+i+'" alt="go to page '+i+'">'+i+'</a> ';
			}
			if (page != maxipage) {
				strHtml += '<a href ="'+url+'?champs='+champs+'&request='+request+'&page='+(page+1)+'" alt="next page">>></a> ';
			}
		}
	}
	document.write(strHtml);
}


function redirection(myselect) {
	choix = myselect.options[myselect.selectedIndex].value;
	if (choix) {
		if (choix.indexOf("http://")==-1)
		{
			if (choix.indexOf("popup_")==-1) 
			{
				top.location = choix;
			}
			else 
			{
				choix=choix.substring(6,choix.length);
				//alert("choix="+choix);
				//newwin(choix,461,500);			
				//awin = window.open(choix,'popupcountry','resizable=yes,scrollbars=yes,toolbar=no,width=478,height=500');
				//awin.focus();
				document.location = choix;
			}
		}
		else
		{
			window.open (choix, "");
		}
	}
	else {
		myselect.options[0].selected=true;
	}
}

function writeIndexationChoice(_request) {
	strHtml = "";
	if (_request && _request.length > 0) {
		if (document.forms.length > 0) {
			trouve = false;
			i = 0;
			while (!trouve && i < document.forms.length) {
				if (document.forms[i].name.indexOf("critereForm") == 0) {
					//trouve = true;
					j=1;
					lastCriteria = false;
					myform = document.forms[i];
				
					while (j<=myform.length && !lastCriteria) {
						mycriteria = eval("myform.critere"+j);
						myoperator = eval("myform.operateur"+j);
						myvalue = eval("myform.valeur"+j);
						if (mycriteria) {
							critrequest = mycriteria.value+"/"+myoperator.value+"/";
							position = _request.indexOf(critrequest);
							if (position >= 0) {
								critval = (_request.substring(position+critrequest.length)).substring(0,(_request.substring(position+critrequest.length)).indexOf("/"));
								if (myvalue.options) {
									for(k=0;k<myvalue.options.length;k++) {
										if (myvalue.options[k].value == critval) {
											if (strHtml.length > 0) strHtml += '- ';
											else strHtml += 'found for&nbsp;';
											strHtml +='<span class="libraryResultSummaryVIT">'+myvalue.options[k].text+'</span> '+myvalue.options[0].text;
											
										}
									}
								}
							}
						}
						else lastCriteria = true;
						j++;
					}
				}
				i++;
			}
		}
	}
	document.write(strHtml);
}

/***************************************************************/
/*	Ecriture de la pagination pour la recherche full text      */
/***************************************************************/

function writeFullTextResultsNav(first,last,nbrElementPage,total,url) {
	var strHtml = "";
	if (total > 0) {
		var page = Math.ceil(last/nbrElementPage);
		if (page <= 0) page = 1;
		var maxipage = Math.ceil(total/nbrElementPage);

		if (maxipage > 1) {
			strHtml += '<table cellpadding="0" cellspacing="0" width="100%" border="0" bgcolor="#FFFFFF">';
			strHtml += '<tr><td align="right" class="prehomeTextNormal">';
			if (page != 1) {
				strHtml += '<a href ="'+url+(page-1)+'" alt="previous page"><img src="/images/communs/triangle_bleu008fbb_gauche.gif" border="0" width="3" height="5" vspace="2" hspace="2" alt="previous page"/></a> ';
			}
			for(i=1;i<=maxipage;i++) {
				if (i > 1) strHtml += "| ";
				if (i == page) strHtml += i+" ";
				else strHtml += '<a href ="'+url+i+'" alt="go to page '+i+'" class="linkon">'+i+'</a> ';
			}
			if (page != maxipage) {
				strHtml += '<a href ="'+url+(page+1)+'" alt="next page"><img src="/images/communs/triangle_bleu008fbb.gif" border="0" width="3" height="5" vspace="2" hspace="2" alt="next page"/></a> ';
			}
			strHtml += '</td></tr>';
			strHtml += '</table>';
		}
	}
	document.write(strHtml);
}