var langue = 'fr';

function DstepRollUtil(ImgNam, langue, Img) {
	document.images[ImgNam].src="../images/" + langue + "/" + Img;
}

function DstepPreload() {var doc=document; if(doc.images){ if(!doc.Drstp) doc.Drstp=new Array();var i,j=doc.Drstp.length,a=DstepPreload.arguments;for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){doc.Drstp[j]=new Image; doc.Drstp[j++].src=a[i];}}}

DstepPreload('../images/'+ langue +'/util_plansite_on.gif','../images/'+ langue +'/util_plansite_off.gif','../images/'+ langue +'/util_newsletter_on.gif','../images/'+ langue +'/util_newsletter_off.gif','../images/'+ langue +'/util_mentions_on.gif','../images/'+ langue +'/util_mentions_off.gif','../images/'+ langue +'/util_forum_on.gif','../images/'+ langue +'/util_forum_off.gif','../images/'+ langue +'/util_faq_on.gif','../images/'+ langue +'/util_faq_off.gif','../images/'+ langue +'/util_contact_on.gif','../images/'+ langue +'/util_contact_off.gif','../images/'+ langue +'/util_acces_on.gif','../images/'+ langue +'/util_acces_off.gif');

function BrowserCheck() {		
	var b = navigator.appName;
	if (b=="Netscape") this.b = "ns";
	else if (b=="Microsoft Internet Explorer") this.b = "ie";
	else this.b = b;
	this.version = navigator.appVersion;
	this.v = parseInt(this.version)
    this.dom=document.getElementById?1:0;
	this.ns = (this.b=="ns" && this.v>=4);
	this.ns4 = (this.b=="ns" && this.v==4);
	this.ns5 = (this.b=="ns" && this.v==5);
	this.ie = (this.b=="ie" && this.v>=4);
	this.ie4 = (this.version.indexOf('MSIE 4')>0);
	this.ie5 = (this.version.indexOf('MSIE 5')>0);
	this.min = (this.ns||this.ie);
}
is = new BrowserCheck();

if (!is.ns4) {
	document.write('<link rel="STYLESHEET" type="text/css" href="../css/ie.css">');
}

function doPopUp(strFileName, intWidth, intHeight, strScroll) {
	        var parametres = 'TOOLBAR=NO,LOCATION=NO,DIRECTORIES=NO,STATUS=NO,MENUBAR=NO,SCROLLBARS='+ strScroll +',RESIZABLE=YES,COPYHISTORY=YES,WIDTH='+ intWidth +',HEIGHT='+ intHeight;
	        window.open(strFileName, "windowname", parametres); 
	}


function imprimer() {
	        var url = document.location.href;
			param = url.split("&");
			zonecontenu = param[5].split("=");
			
			window.open('display.jsp?srv=afm&typ=docs&lang='+langue+'&cmd=view&style=styles/pop_impression.xsl&select='+zonecontenu[1]+'','print','TOOLBAR=NO,LOCATION=NO,DIRECTORIES=NO,STATUS=NO,MENUBAR=YES,SCROLLBARS=YES,RESIZABLE=YES,COPYHISTORY=YES,WIDTH=620,HEIGHT=400');
}



function envoyerAmi() {
// var url = 

	        var url = document.location.href;
			
//	doPopUp("display.jsp?srv=afm&amp;typ=docs&amp;lang="+langue+"&amp;cmd=view&amp;style=styles/popup_envoyer_ami.xsl&amp;select=GLOSSAIRE","367","400","yes");
	doPopUp("display.jsp?srv=afm&amp;typ=docs&amp;lang="+langue+"&amp;cmd=view&amp;style=styles/popup_envoyer_ami.xsl&url="+url+"","367","400","yes");
					
	}
	
// pour la recherche

function Trim (str) {
    var start = 0;
    var send = str.length;
    while (send > 0 && str.substring(send-1, send) == ' ') send--;
    while (send > start && str.substring(start, start+1) == ' ') start++;
    return (str.substring(start, send));
}

function BuildAction (form, mode) {
form.search.value = Trim(form.search.value);
if ((form.search.value == "") || (form.search.value  == '*') || (form.search.value == '%')  || (form.search.value == 'Recherche')) {
    form.search.value = " Recherche";
    alert('Vous devez saisir un mot clé');
    return (false);
}

//var action = "search.jsp?style=styles/fulsearch.xsl&lang=" + langue;
var action;

if (mode=='multi') {
	action = "search.jsp?srv=afm&typ=docs&cmd=view&select2=HEADER[@ID$eq$2]|FOOTER[@ID$eq$1]&style=styles/fulsearch-multi.xsl&lang=" + langue;
}
else {
	action = "search.jsp?srv=afm&typ=docs&cmd=view&select2=HEADER[@ID$eq$2]|FOOTER[@ID$eq$1]&style=styles/fulsearch.xsl&lang=" + langue;
}

var word = form.search.value;

//var word = HTMLEncode(form.search.value).replace(/]/g, "&#x5D;").replace(/\'/g, " ").replace(/&#x2019;/g, " ");
//if (word.indexOf(" ")!=-1) {
//word = "&#34;"+word+"&#34;";
//alert (word);
//}

form.action = action;
form.select.value = "*(0,10)[*$contains$'" + word + "']";

return (true);
}

function press(key) {
  if (key == '13') {
    if (BuildAction(document.search, 'normal')) document.search.submit();
  } else {
    return false;
  }
}					

function pressMulti(key) {
  if (key == '13') {
    if (BuildAction(document.search, 'multi')) document.search.submit();
  } else {
    return false;
  }
}					
