
/*  ID(4bd47c8deb496cb0e8e1c2c89aa849ae) URI(4bd47c8deb496cb0e8e1c2c89aa849ae) SCHEME(buffer) WEIGHT(500) TYPE(js:file) */
//ajout d'un plugin de type OpenSearch
function addProvider(name,lng) {
		if (window.external && ("AddSearchProvider" in window.external)) {
		   window.external.AddSearchProvider("http://www.termsciences.fr/services/mycroft/"+name+"-"+lng+".xml");
		}
		else {
				alert("Firefox 2+ or IE 7+ is needed to install an opensearch plugin");
		}
}

//ajout d'un plugin de type Sherlock
function addEngine(name,ext,cat)
{
		if ((typeof window.sidebar == "object") && (typeof
								window.sidebar.addSearchEngine == "function"))
		{
				window.sidebar.addSearchEngine(
								"http://www.termsciences.fr/services/mycroft/"+name+".src",
								"http://www.termsciences.fr/services/mycroft/"+name+"."+ext,
								name,
								cat );
		}
		else {
				alert("Netscape 6 or Mozilla is needed to install a sherlock plugin");
		}
}
function popupURL(url, dest)
{
		var PARAM = 'menubar=yes,scrollbars=yes,toolbar=yes,status=yes,location=yes,resizable=yes,width=800,height=600';
		var TARGET = new String( (typeof dest == "undefined" || dest+"" == "") ? 'termsciences' : dest);
		var wind = window.open(url, TARGET.replace(/\./g, ''), PARAM);
		wind.focus();
}
function popupExternalURL(url, dest)
{
		var u = '/services/redirect/?l='+escape(url);
		popupURL(u, dest);
}
function openExternalURL(url)
{
		window.location='/services/redirect/?l='+escape(url);
}
function pluginOpen()
{
		var u = '/-/Fenetre/RechercherLight/';
		return popupURL(u);
}
function openURL(url, dest)
{
		popupURL(url,dest)
}

/*  ID(da2ddcc170b943b84bdc6c475c362b4a) URI(da2ddcc170b943b84bdc6c475c362b4a) SCHEME(buffer) WEIGHT(500) TYPE(js:file) */
var adv_nbligne_defaut;
var text01;
var text02;
var text03;
var text04;
var text05;
var text06;
var text07;
var text08;
var text09;
var text10;

function ADD_ligne() {
		try {
				var table = document.getElementById("grc-bloc-adv");

				tr = document.createElement("tr");

				/* td1 = document.createElement("td");
				td1.setAttribute("width","20");
				tr.appendChild(td1); */

				td2 = document.createElement("td");
				td2_select = document.createElement("select");
				td2_select.setAttribute("name","grcopr["+ adv_nbligne_defaut +"]");

				td2_select_option1 = document.createElement("option");
				td2_select_option1.setAttribute("value","AND");
				td2_select_option1_text=document.createTextNode(text01);
				td2_select_option1.appendChild(td2_select_option1_text);
				td2_select.appendChild(td2_select_option1);

				td2_select_option2 = document.createElement("option");
				td2_select_option2.setAttribute("value","OR");
				td2_select_option2_text=document.createTextNode(text011);
				td2_select_option2.appendChild(td2_select_option2_text);				
				td2_select.appendChild(td2_select_option2);
				td2.appendChild(td2_select);
				tr.appendChild(td2);
				
				td3 = document.createElement("td");
				td3.setAttribute("width","60");
				td3.setAttribute("class","gras");
				td3_text=document.createTextNode(text02);
				td3.appendChild(td3_text);
				tr.appendChild(td3);

				td4 = document.createElement("td");
				td4_input = document.createElement("input");
				td4_input.setAttribute("size","37");
				td4_input.setAttribute("type","text");
				td4_input.setAttribute("name","grcvalue["+ adv_nbligne_defaut +"]");
				td4_input.setAttribute("value","");
				td4_input.setAttribute("class","grc-input-grcvalue");

				///////////////////////////////////////////////////////////////////////////////
				// patch IE (entre autres) pour la prise en charge des feuilles de style sur //
				// la plupart des élements créés via le DOM de façon dynamique               //
				///////////////////////////////////////////////////////////////////////////////
				for(i=0;i<document.styleSheets.length;i++){
						if(document.styleSheets[i].rules){
								for(j=0;j<document.styleSheets[i].rules.length;j++){
										if(document.styleSheets[i].rules[j].selectorText==".grc-input-grcvalue"){
												td4_input.style.cssText = document.styleSheets[i].rules[j].style.cssText;
										}
								}
						}
						else{
								for(j=0;j<document.styleSheets[i].cssRules.length;j++){
										if(document.styleSheets[i].cssRules[j].selectorText==".grc-input-grcvalue"){
												td4_input.style.cssText = document.styleSheets[i].cssRules[j].style.cssText;
										}
								}
						}
				}
				///////////////////////////////////////////////////////////////////////////////


				td4.appendChild(td4_input);
				tr.appendChild(td4);

				td5 = document.createElement("td");
				td5.setAttribute("id","grc-label-4");
				td5_text=document.createTextNode(text03);
				td5.appendChild(td5_text);
				tr.appendChild(td5);


				td6 = document.createElement("td");
				td6.setAttribute("align","center");

				td6_select = document.createElement("select");
				td6_select.setAttribute("name","grcname["+ adv_nbligne_defaut +"]");

				td6_select_option1 = document.createElement("option");
				td6_select_option1.setAttribute("value","TERMFR");
				td6_select_option1_text=document.createTextNode(text04);
				td6_select_option1.appendChild(td6_select_option1_text);
				td6_select.appendChild(td6_select_option1);

				td6_select_option1p = document.createElement("option");
				td6_select_option1p.setAttribute("value","PREFFR");
				td6_select_option1p_text=document.createTextNode(text04p);
				td6_select_option1p.appendChild(td6_select_option1p_text);
				td6_select.appendChild(td6_select_option1p);

				td6_select_option2 = document.createElement("option");
				td6_select_option2.setAttribute("value","TERMEN");
				td6_select_option2_text=document.createTextNode(text05);
				td6_select_option2.appendChild(td6_select_option2_text);
				td6_select.appendChild(td6_select_option2);

				td6_select_option2p = document.createElement("option");
				td6_select_option2p.setAttribute("value","PREFEN");
				td6_select_option2p_text=document.createTextNode(text05p);
				td6_select_option2p.appendChild(td6_select_option2p_text);
				td6_select.appendChild(td6_select_option2p);

				td6_select_option3 = document.createElement("option");
				td6_select_option3.setAttribute("value","TERMES");
				td6_select_option3_text=document.createTextNode(text06);
				td6_select_option3.appendChild(td6_select_option3_text);
				td6_select.appendChild(td6_select_option3);

				td6_select_option3p = document.createElement("option");
				td6_select_option3p.setAttribute("value","PREFES");
				td6_select_option3p_text=document.createTextNode(text06p);
				td6_select_option3p.appendChild(td6_select_option3p_text);
				td6_select.appendChild(td6_select_option3p);
				
				td6_select_option4 = document.createElement("option");
				td6_select_option4.setAttribute("value","TERMDE");
				td6_select_option4_text=document.createTextNode(text07);
				td6_select_option4.appendChild(td6_select_option4_text);
				td6_select.appendChild(td6_select_option4);

				td6_select_option4p = document.createElement("option");
				td6_select_option4p.setAttribute("value","PREFDE");
				td6_select_option4p_text=document.createTextNode(text07p);
				td6_select_option4p.appendChild(td6_select_option4p_text);
				td6_select.appendChild(td6_select_option4p);

				/*
					 td6_select_option5 = document.createElement("option");
					 td6_select_option5.setAttribute("value","DOMAINE");
					 td6_select_option5_text=document.createTextNode(text08);
					 td6_select_option5.appendChild(td6_select_option5_text);
					 td6_select.appendChild(td6_select_option5);
					 */

/*
				td6_select_option6 = document.createElement("option");
				td6_select_option6.setAttribute("value","VOCBASE");
				td6_select_option6_text=document.createTextNode(text09);
				td6_select_option6.appendChild(td6_select_option6_text);
				td6_select.appendChild(td6_select_option6);
*/
				td6_select_option7 = document.createElement("option");
				td6_select_option7.setAttribute("value","INSTITUTION");
				td6_select_option7_text=document.createTextNode(text10);
				td6_select_option7.appendChild(td6_select_option7_text);
				td6_select.appendChild(td6_select_option7);

				td6.appendChild(td6_select);
				tr.appendChild(td6);


				table.appendChild(tr);

				adv_nbligne_defaut++;
		} catch(e){}
}

/*  ID(2aa8a0a66a9dfb98e310de4d7f31a3b9) URI(2aa8a0a66a9dfb98e310de4d7f31a3b9) SCHEME(buffer) WEIGHT(500) TYPE(js:file) */
iehover = function() {
		/** IE script to change class on mouseover **/
		var sfEls = document.getElementById("MenuBarre").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
				sfEls[i].onmouseover=function() {
						this.className+=" iehover";
				}
				sfEls[i].onmouseout=function() {
						this.className=this.className.replace(new RegExp(" iehover\\b"), "");
				}
		}
}
if (window.attachEvent) window.attachEvent("onload", iehover);
/*  ID(da66fd247547e5d4fc77336af2603ad9) URI(da66fd247547e5d4fc77336af2603ad9) SCHEME(buffer) WEIGHT(500) TYPE(js:file) */
/**
 * change de page pour l'url "loc" avec les params "params"
 */
function openWithParams(loc,params) {
	var href = loc.href;
	var tab = href.split("?");
	href = tab[0];
	loc.assign(href+params);
}
/**
 *	ajoute dynamiquement un champ input de type hidden à un formulaire
 */
function addHidenInput(formId,inputName,inputValue) {
	var form = document.getElementById(formId);
	var newInput = document.createElement("input");
	newInput.type = "hidden";
	newInput.name = inputName;
	newInput.value = inputValue;
	form.appendChild(newInput);
}

// Strip leading and trailing white-space
function trim(ch) {
	return ch.replace(/^\s*|\s*$/g, "");
}

/**
 * Checks/unchecks all tables
 *
 * @param   string   le checkbox appelant
 * @param   string   filtre sur le nom dur checkbox
 */
CheckBoxesToggle = function(element, name) {

                var checkbox = $(element);
                var flag = checkbox.checked;

                var checkboxes = Form.getInputs(checkbox.form, 'checkbox');
                for (i = 0; i < checkboxes.length; i++ ) {
                                cb = checkboxes[i];
                                if (name != null && name!= "") {
                                        if (cb.name.indexOf(name) >= 0) cb.checked = flag;
                                } else {
                                        cb.checked = flag;
                                }

                }
}


