sfHover = function() {
	var sfEls = document.getElementById("navg").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
	var sfEls2 = document.getElementById("menu").getElementsByTagName("LI");
	for (var i=0; i<sfEls2.length; i++) {
		sfEls2[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls2[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


/**/

function setType(node, type) 
{
  var newObject = document.createElement('input');
  newObject.type = type;
  if(node.size) newObject.size = node.size;
  if(node.value) newObject.value = node.value;
  if(node.name) newObject.name = node.name;
  if(node.id) newObject.id = node.id;
  if(node.className) node.className = node.className;
  node.parentNode.replaceChild(newObject,node);
  return newObject;
}



var f = document.getElementById('globalForm');
function restoreField(f,t)
{
	if( f.save != null && f.value == '' )
	{
		if( t != '' ) {
			/*f.type = 'text';*/
			setType(f,'text');
		}
		f.value = f.save;
	}
}


function clearFieldIfDefault(f,t)
{
	if( f.save == null ) //&& f.getAttribute('autocomplete') == 'off'
	{
		f.value = '';
		if( t == 'pwd' ) {
			/*f.type = 'password';*/
			setType(f,'password');
		}
		f.save = f.value;
	}
}

function add( nom ) 
{
	document.getElementById( 'quantite' + nom ).value ++;
	
	q = eval(document.getElementById( 'quantite' + nom ).value);
	p = eval(document.getElementById( 'prix' + nom ).value);
	document.getElementById( 'total' + nom ).value = q*p;
}

function substract( nom ) 
{
	document.getElementById( 'quantite' + nom ).value --;
	
	q = eval(document.getElementById( 'quantite' + nom ).value);
	p = eval(document.getElementById( 'prix' + nom ).value);
	document.getElementById( 'total' + nom ).value = q*p;
}

function isNumberKey(evt)
{
	var charCode = (evt.which) ? evt.which : event.keyCode
	if (charCode > 31 && (charCode < 48 || charCode > 57)) return false;

	return true;
}

function verifCP(form, input) 
{
	//var cp = document.forms[form].elements[input];
	var cp = document.getElementById(input);
	//alert("value :" + cp.value  + "  length : " + trim(cp.value).length + " isNan : " +isNaN(cp.value));
	
	if (isNaN(cp.value) || trim(cp.value).length < 2 || trim(cp.value).length > 5) {
	    alert("Le code postal doit \u00EAtre un nombre compos\u00E9 de 2 ou 5 chiffres.");
	    cp.focus();
	    cp.value = trim(cp.value);
	    return;
	}
	document.forms[form].submit();
}

function MM_preloadImages() { //v3.0
	  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}

	function MM_swapImgRestore() { //v3.0
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}


	function MM_findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}

	function MM_dragLayer(objName,x,hL,hT,hW,hH,toFront,dropBack,cU,cD,cL,cR,targL,targT,tol,dropJS,et,dragJS) { //v4.01
	  //Copyright 1998 Macromedia, Inc. All rights reserved.
	  var i,j,aLayer,retVal,curDrag=null,curLeft,curTop,IE=document.all,NS4=document.layers;
	  var NS6=(!IE&&document.getElementById), NS=(NS4||NS6); if (!IE && !NS) return false;
	  retVal = true; if(IE && event) event.returnValue = true;
	  if (MM_dragLayer.arguments.length > 1) {
	    curDrag = MM_findObj(objName); if (!curDrag) return false;
	    if (!document.allLayers) { document.allLayers = new Array();
	      with (document) if (NS4) { for (i=0; i<layers.length; i++) allLayers[i]=layers[i];
	        for (i=0; i<allLayers.length; i++) if (allLayers[i].document && allLayers[i].document.layers)
	          with (allLayers[i].document) for (j=0; j<layers.length; j++) allLayers[allLayers.length]=layers[j];
	      } else {
	        if (NS6) { var spns = getElementsByTagName("span"); var all = getElementsByTagName("div");
	          for (i=0;i<spns.length;i++) if (spns[i].style&&spns[i].style.position) allLayers[allLayers.length]=spns[i];}
	        for (i=0;i<all.length;i++) if (all[i].style&&all[i].style.position) allLayers[allLayers.length]=all[i];
	    } }
	    curDrag.MM_dragOk=true; curDrag.MM_targL=targL; curDrag.MM_targT=targT;
	    curDrag.MM_tol=Math.pow(tol,2); curDrag.MM_hLeft=hL; curDrag.MM_hTop=hT;
	    curDrag.MM_hWidth=hW; curDrag.MM_hHeight=hH; curDrag.MM_toFront=toFront;
	    curDrag.MM_dropBack=dropBack; curDrag.MM_dropJS=dropJS;
	    curDrag.MM_everyTime=et; curDrag.MM_dragJS=dragJS;
	    curDrag.MM_oldZ = (NS4)?curDrag.zIndex:curDrag.style.zIndex;
	    curLeft= (NS4)?curDrag.left:(NS6)?parseInt(curDrag.style.left):curDrag.style.pixelLeft;
	    if (String(curLeft)=="NaN") curLeft=0; curDrag.MM_startL = curLeft;
	    curTop = (NS4)?curDrag.top:(NS6)?parseInt(curDrag.style.top):curDrag.style.pixelTop;
	    if (String(curTop)=="NaN") curTop=0; curDrag.MM_startT = curTop;
	    curDrag.MM_bL=(cL<0)?null:curLeft-cL; curDrag.MM_bT=(cU<0)?null:curTop-cU;
	    curDrag.MM_bR=(cR<0)?null:curLeft+cR; curDrag.MM_bB=(cD<0)?null:curTop+cD;
	    curDrag.MM_LEFTRIGHT=0; curDrag.MM_UPDOWN=0; curDrag.MM_SNAPPED=false; //use in your JS!
	    document.onmousedown = MM_dragLayer; document.onmouseup = MM_dragLayer;
	    if (NS) document.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
	  } else {
	    var theEvent = ((NS)?objName.type:event.type);
	    if (theEvent == 'mousedown') {
	      var mouseX = (NS)?objName.pageX : event.clientX + document.body.scrollLeft;
	      var mouseY = (NS)?objName.pageY : event.clientY + document.body.scrollTop;
	      var maxDragZ=null; document.MM_maxZ = 0;
	      for (i=0; i<document.allLayers.length; i++) { aLayer = document.allLayers[i];
	        var aLayerZ = (NS4)?aLayer.zIndex:parseInt(aLayer.style.zIndex);
	        if (aLayerZ > document.MM_maxZ) document.MM_maxZ = aLayerZ;
	        var isVisible = (((NS4)?aLayer.visibility:aLayer.style.visibility).indexOf('hid') == -1);
	        if (aLayer.MM_dragOk != null && isVisible) with (aLayer) {
	          var parentL=0; var parentT=0;
	          if (NS6) { parentLayer = aLayer.parentNode;
	            while (parentLayer != null && parentLayer.style.position) {
	              parentL += parseInt(parentLayer.offsetLeft); parentT += parseInt(parentLayer.offsetTop);
	              parentLayer = parentLayer.parentNode;
	          } } else if (IE) { parentLayer = aLayer.parentElement;
	            while (parentLayer != null && parentLayer.style.position) {
	              parentL += parentLayer.offsetLeft; parentT += parentLayer.offsetTop;
	              parentLayer = parentLayer.parentElement; } }
	          var tmpX=mouseX-(((NS4)?pageX:((NS6)?parseInt(style.left):style.pixelLeft)+parentL)+MM_hLeft);
	          var tmpY=mouseY-(((NS4)?pageY:((NS6)?parseInt(style.top):style.pixelTop) +parentT)+MM_hTop);
	          if (String(tmpX)=="NaN") tmpX=0; if (String(tmpY)=="NaN") tmpY=0;
	          var tmpW = MM_hWidth;  if (tmpW <= 0) tmpW += ((NS4)?clip.width :offsetWidth);
	          var tmpH = MM_hHeight; if (tmpH <= 0) tmpH += ((NS4)?clip.height:offsetHeight);
	          if ((0 <= tmpX && tmpX < tmpW && 0 <= tmpY && tmpY < tmpH) && (maxDragZ == null
	              || maxDragZ <= aLayerZ)) { curDrag = aLayer; maxDragZ = aLayerZ; } } }
	      if (curDrag) {
	        document.onmousemove = MM_dragLayer; if (NS4) document.captureEvents(Event.MOUSEMOVE);
	        curLeft = (NS4)?curDrag.left:(NS6)?parseInt(curDrag.style.left):curDrag.style.pixelLeft;
	        curTop = (NS4)?curDrag.top:(NS6)?parseInt(curDrag.style.top):curDrag.style.pixelTop;
	        if (String(curLeft)=="NaN") curLeft=0; if (String(curTop)=="NaN") curTop=0;
	        MM_oldX = mouseX - curLeft; MM_oldY = mouseY - curTop;
	        document.MM_curDrag = curDrag;  curDrag.MM_SNAPPED=false;
	        if(curDrag.MM_toFront) {
	          eval('curDrag.'+((NS4)?'':'style.')+'zIndex=document.MM_maxZ+1');
	          if (!curDrag.MM_dropBack) document.MM_maxZ++; }
	        retVal = false; if(!NS4&&!NS6) event.returnValue = false;
	    } } else if (theEvent == 'mousemove') {
	      if (document.MM_curDrag) with (document.MM_curDrag) {
	        var mouseX = (NS)?objName.pageX : event.clientX + document.body.scrollLeft;
	        var mouseY = (NS)?objName.pageY : event.clientY + document.body.scrollTop;
	        newLeft = mouseX-MM_oldX; newTop  = mouseY-MM_oldY;
	        if (MM_bL!=null) newLeft = Math.max(newLeft,MM_bL);
	        if (MM_bR!=null) newLeft = Math.min(newLeft,MM_bR);
	        if (MM_bT!=null) newTop  = Math.max(newTop ,MM_bT);
	        if (MM_bB!=null) newTop  = Math.min(newTop ,MM_bB);
	        MM_LEFTRIGHT = newLeft-MM_startL; MM_UPDOWN = newTop-MM_startT;
	        if (NS4) {left = newLeft; top = newTop;}
	        else if (NS6){style.left = newLeft; style.top = newTop;}
	        else {style.pixelLeft = newLeft; style.pixelTop = newTop;}
	        if (MM_dragJS) eval(MM_dragJS);
	        retVal = false; if(!NS) event.returnValue = false;
	    } } else if (theEvent == 'mouseup') {
	      document.onmousemove = null;
	      if (NS) document.releaseEvents(Event.MOUSEMOVE);
	      if (NS) document.captureEvents(Event.MOUSEDOWN); //for mac NS
	      if (document.MM_curDrag) with (document.MM_curDrag) {
	        if (typeof MM_targL =='number' && typeof MM_targT == 'number' &&
	            (Math.pow(MM_targL-((NS4)?left:(NS6)?parseInt(style.left):style.pixelLeft),2)+
	             Math.pow(MM_targT-((NS4)?top:(NS6)?parseInt(style.top):style.pixelTop),2))<=MM_tol) {
	          if (NS4) {left = MM_targL; top = MM_targT;}
	          else if (NS6) {style.left = MM_targL; style.top = MM_targT;}
	          else {style.pixelLeft = MM_targL; style.pixelTop = MM_targT;}
	          MM_SNAPPED = true; MM_LEFTRIGHT = MM_startL-MM_targL; MM_UPDOWN = MM_startT-MM_targT; }
	        if (MM_everyTime || MM_SNAPPED) eval(MM_dropJS);
	        if(MM_dropBack) {if (NS4) zIndex = MM_oldZ; else style.zIndex = MM_oldZ;}
	        retVal = false; if(!NS) event.returnValue = false; }
	      document.MM_curDrag = null;
	    }
	    if (NS) document.routeEvent(objName);
	  } return retVal;
	}

	function MM_swapImage() { //v3.0
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}

	function MM_callJS(jsStr) { //v2.0
	  return eval(jsStr)
	}

	function MM_reloadPage(init) {  //reloads the window if Nav4 resized
	  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
	    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
	  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
	}

	function MM_showHideLayers() { //v3.0
	  var i,p,v,obj,args=MM_showHideLayers.arguments;
	  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
	    obj.visibility=v; }
	}

	function MM_jumpMenu(targ,selObj,restore){ //v3.0
	  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	  if (restore) selObj.selectedIndex=0;
	}


	function MM_openBrWindow(theURL,winName,features) { //v2.0
	  window.open(theURL,winName,features);
	}

	function openWindow(theURL,winName) {
	  window.open(theURL,winName);
	}

	function openWindow(theURL,winName,features) {
	  window.open(theURL,winName,features);
	}

	//Pour fermer les fenetres volantes
	function closewindow() {
	self.close();
	}

	// pour les checkbox
	function allchecked(field){

	  try
	  {
	    field.checked=true;
	    for( i = 0 ; i < field.length ; i ++){field[i].checked=true;}
	  }catch(e){}
	}

	// pour les checkbox
	function allunchecked(field){
	  try
	  {
	    field.checked=false;
	    for( i = 0 ; i < field.length ; i ++){ field[i].checked=false;}
	  }catch(e){}
	}

	function CheckLen(field, size, counter){
	        strLen =field.value.length;
	        if(strLen>size){
	                field.value = field.value.substring(0,size);
	                strLen = size;
	        }
	        counter.value = strLen;
	        return true;
	}

	function CheckLenAlert(field, size)
	{
	        strLen =field.value.length;
	        if(strLen>size)
	        {
	                field.value = field.value.substring(0,size);
	        }
	        return true;
	}

	//Verifie si un champs est vide
	function isEmpty(field){
	         if(field==null) return true;
	         if(field.length<1) return true;
	         for(i=0;i<field.length;i++) {
	                if(field.charAt(i)!=' ') return false;
	         }
	         return true;
	}

	//Verifie le format d'une date
	function checkDateInfDate( dj , dm , da , fj ,fm , fa )
	{
	  var amin=1900; // année mini
	  var amax=2037; // année maxi

	    if ( ((isNaN(dj))||(dj<1)||(dj>31)) )
	  {
	        return(false);
	    }

	    if ( ((isNaN(dm))||(dm<1)||(dm>12)) )
	    {
	        return(false);
	    }

	    if ( ((isNaN(da))||(da<amin)||(da>amax)) )
	    {
	        return(false);
	    }

	    if ( ((isNaN(fj))||(fj<1)||(fj>31)) )
	  {
	        return(false);
	    }

	    if ( ((isNaN(fm))||(fm<1)||(fm>12)) )
	    {
	        return(false);
	    }

	    if ( ((isNaN(fa))||(fa<amin)||(fa>amax)) )
	    {
	        return(false);
	    }

	  if( !checkDate( dj+'/'+dm+'/'+da ) )
	  {
	    return false;
	  }

	  if( !checkDate( fj+'/'+fm+'/'+fa ) )
	  {
	    return false;
	  }

	//date 1
	  //var d1=new Date(dj,dm-1,da ); correction cki 17/02/2004
	  var d1=new Date(da,dm-1,dj );
	  j2=d1.getDate();
	    m2=d1.getMonth()+1;
	    a2=d1.getFullYear();

	    if (a2<=100) {a2=1900+a2;}

	    if ( (dj!=j2)||(dm!=m2)||(da!=a2) )
	    {

	        return(false);
	    }
	//date 2
	  //var d2=new Date(fj,fm-1,fa ); correction cki 17/02/2004
	  var d2=new Date(fa,fm-1,fj );
	  j2=d2.getDate();
	    m2=d2.getMonth()+1;
	    a2=d2.getFullYear();

	    if (a2<=100) {a2=1900+a2;}

	    if ( (fj!=j2)||(fm!=m2)||(fa!=a2) )
	    {
	        return(false);
	    }

	    if (	da != fa && da > fa)
	  {
	    alert('Erreur : Date de fin < Date de début !');
	    return false;
	  }
	  else if (dm > fm && da == fa)
	  {
	    alert('Erreur : Date de fin < Date de début !');
	    return false;
	  }
	  else if (dm==fm && dj > fj)
	  {
	    alert('Erreur : Date de fin < Date de début !');
	    return false;
	  }
	  return true;
	}

	//Verifie le format d'une date
	function checkDate(thedate) {
	  var lang = 'FR';
	  var amin=1900; // année mini
	    var amax=2037; // année maxi
	    if(thedate==null) return true;
	  if(thedate.length<1) return true;
	  if(thedate.length!=10) return false;
	  for(i=0;i<10;i++) {
	     c =  thedate.charAt(i);
	     if(  (c<'0' || '9'<c || i==2 || i==5) && (c!='/' || (i!=2 && i!=5))  ) return false;
	  }
	  if(lang == 'FR') {
	     jj=thedate.substring(0,2);
	     mm=thedate.substring(3,5);
	  } else {
	     mm=thedate.substring(0,2);
	     jj=thedate.substring(3,5);
	  }
	  aa=thedate.substring(6,10);
	//ajout du test de validité de la date
	  if ( ((isNaN(jj))||(jj<1)||(jj>31)) )
	  {
	        return(false);
	    }

	    if ( ((isNaN(mm))||(mm<1)||(mm>12)) )
	    {
	        return(false);
	    }

	    if ( ((isNaN(aa))||(aa<amin)||(aa>amax)) )
	    {
	        return(false);
	    }
	    var d2=new Date(aa,mm-1,jj);
	    j2=d2.getDate();
	    m2=d2.getMonth()+1;
	    a2=d2.getFullYear();

	    if (a2<=100) {a2=1900+a2; alert(a);}

	    if ( (jj!=j2)||(mm!=m2)||(aa!=a2) )
	    {
	        return(false);
	    }
	    else
	    {
	        return(true)
	    }
	/*
	  if(jj<1 || 31<jj) return false;
	  if(mm<1 || 12<mm) return false;
	  if(aa<1900 || 9000<aa) return false;
	  return true;
	*/
	}

	//Verifie le format d'une date
	function checkDateJJMM(thedate) {
	  if(thedate==null) return true;
	  if(thedate.length<1) return true;
	  if(thedate.length!=5) return false;
	  for(i=0;i<5;i++) {
	     c =  thedate.charAt(i);
	     if(  (c<'0' || '9'<c || i==2 ) && (c!='/' || i!=2 ) ) return false;
	  }
	     jj=thedate.substring(0,2);
	     mm=thedate.substring(3,5);
	  if(jj<1 || 31<jj) return false;
	  if(mm<1 || 12<mm) return false;
	  return true;
	}

	//Veifie le format d'un temps
	function checkTime(thetime) {
	  if(thetime==null) return true;
	  if(thetime.length<1) return true;
	  if(thetime.length!=8) return false;
	  for(i=0;i<8;i++) {
	     c =  thetime.charAt(i);
	     if(  (c<'0' || '9'<c || i==2 || i==5) && (c!=':' || (i!=2 && i!=5))  ) return false;
	  }

	  hh=thetime.substring(0,2);
	  mm=thetime.substring(3,5);
	  ss=thetime.substring(6,8);
	  if(hh<0 || 24<hh) return false;
	  if(mm<0 || 60<mm) return false;
	  if(ss<0 || 60<ss) return false;
	  return true;
	}

	//Verifie le format d'un temps
	function checkTimeHHMM(thetime) {
	  if(thetime==null) return true;
	  if(thetime.length<1) return true;
	  if(thetime.length!=5) return false;
	  for(i=0;i<5;i++) {
	     c =  thetime.charAt(i);
	     if(  (c<'0' || '9'<c || i==2 || i==5) && (c!=':' || (i!=2 && i!=5))  ) return false;
	  }

	  hh=thetime.substring(0,2);
	  mm=thetime.substring(3,5);

	  if(hh<0 || 24<hh) return false;
	  if(mm<0 || 60<mm) return false;

	  return true;
	}

	//Verifie le format d'un integer pour une valeur
	function checkInt(theint) {
	  return checkInteger(theint);
	}
	function checkInteger(theint) {
	  if(theint==null) return true;
	  if(theint.length<1) return true;
	  for(i=0;i<theint.length;i++) {
	     c =  theint.charAt(i);
	     if(c<'0' || '9'<c ) return false;
	  }
	  return true;
	}

	//Verifie le format d'un integer pour un champ
	function checkIntegerChamp(thethis) {
	  if(thethis.value==null) return true;
	  if(thethis.value.length<1) return true;
	  for(i=0;i<thethis.value.length;i++) {
	     c =  thethis.value.charAt(i);
	     if(c<'0' || '9'<c ) return false;
	  }
	  return true;
	}

	//Verifie le format d'un prix ( 1000.00)
	function checkPrix(theint) {
	  if(theint==null) return true;
	  if(theint.length<1) return true;
	  for(i=0;i<theint.length;i++) {
	     c =  theint.charAt(i);
	     if((c<'0' || '9'<c )&& (c!='.')) return false;
	  }
	  return true;
	}

	function checkFloat(thefloat) {
	  if(thefloat==null) return true;
	  if(thefloat.length<1) return true;

	  var exp = /^-?[0-9]+(\.[0-9]*)?$/;

	  return exp.test(thefloat);
//		for(i=0;i<thefloat.length;i++) {
//		   c =  thefloat.charAt(i);
//		   if((c<'0' || '9'<c )&& (c!='.')) return false;
//		}
//		return true;
	}

	function list_moveOption(srcId, destId)
	{
	  /*
	  +-------------+
	  | check input |
	  +-------------+
	  */
	  var dest = document.getElementById(destId);
	  var src = document.getElementById(srcId);

	  if ( dest.length == dest.maxlength )
	  {
	    alert('Liste pleine');
	    return false;
	  }

	  if ( src.selectedIndex == -1 )
	  {
	    alert('Sélectionnez un ou plusieurs item(s)');
	    return false;
	  }



	  for ( i = 0 ; i < src.length ;  i++ )
	  {
	    if ( dest.length == dest.maxlength )
	    {
	      break;
	    }

	    if ( src[i].selected > 0  )
	    {
	      /*
	      +------------+
	      | add option |
	      +------------+
	      */

	      var o = new Option(src.options[i].text, src.options[i].value,false,false);

	      dest.options[dest.length]= o;

	      /*
	      +---------------+
	      | remove option |
	      +---------------+
	      */

	      src.options[i] = null;

	      i--;
	    }
	  }

	  return false;
	}

	//Remplace un caractere par un autre pour un champs donne
	function replaceStr(toCheck,strOld,strNew) {
	    var tmp = toCheck.value;
	    while ( tmp.indexOf(strOld) > 0) {
	        tmp=tmp.substring(0,tmp.indexOf(strOld))+strNew+tmp.substring(tmp.indexOf(strOld)+strOld.length,tmp.length);
	    }
	    toCheck.value=tmp;
	}

	//Remplace un caractere par un autre pour une chaine
	function replaceStrForChaine(toCheck,strOld,strNew) {
	    var tmp = toCheck;
	    while ( tmp.indexOf(strOld) > 0) {
	        tmp=tmp.substring(0,tmp.indexOf(strOld))+strNew+tmp.substring(tmp.indexOf(strOld)+strOld.length,tmp.length);
	    }
	    toCheck=tmp;
	}


	//Verifie si un champs email est valide : s'il est different de nul et s'il contient un @
	function isMail(field)
	{
	  if ( field.indexOf( ' ' ) >= 0 ) 	return false ;
	  if(field.length < 5 ) 		 	return false ;
	  if(field.indexOf('@') < 2 ) 	 	return false;

	  var i = field.indexOf('@');
	  if( i <= 0 ) return false;

	  field =  field.substring( i + 1 , field.length );
	  var j = field.indexOf('@');
	  if( j >= 0 ) return false ;

	  if( field.length < 1 )  return false;

	  var j = field.indexOf( '.' );
	  if ( j <= 0 ) return false;
	  if ( field.substring( 0 ,j ) <= 0 ) return false;
	  if ( field.substring( j+1 , field.length ) <= 0 ) return false;

	  return true;
	}

	//Verifie si le code postal est valide
	function isCodePostal(field)
	{
	    if (isNaN(field) || trim(field).length != 5)
	    {
	        return false;
	    }

	    return true;
	}


	function Is() {
	    var agent = navigator.userAgent.toLowerCase();
	    this.major = parseInt(navigator.appVersion);
	    this.minor = parseFloat(navigator.appVersion);
	    this.ns  = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)));
	    this.ns2 = (this.ns && (this.major == 2));
	    this.ns3 = (this.ns && (this.major == 3));
	    this.ns4b = (this.ns && (this.minor < 4.04));
	    this.ns4 = (this.ns && (this.major >= 4));
	    this.ie   = (agent.indexOf("msie") != -1);
	    this.ie3  = (this.ie && (this.major == 2));
	    this.ie4  = (this.ie && (this.major >= 4));
	    this.op3 = (agent.indexOf("opera") != -1);
	    this.win   = (agent.indexOf("win")!=-1);
	    this.mac   = (agent.indexOf("mac")!=-1);
	    this.unix  = (agent.indexOf("x11")!=-1);
	}

	var is = new Is();

	var ie = document.all ? true : false;
	var ns4 = document.layers ? true : false;
	var ns6 = document.getElementById && !document.all;
	var ie4 = (document.all && !document.getElementById)? true : false;
	var ie5 = (document.all && document.getElementById)? true : false;


	function Show_Hide(nObjet)
	{
	 if(ie) { // Internet explorer
	   eval(nObjet).style.visibility =
	    (eval(nObjet).style.visibility=='visible'?'hidden':'visible');
	 }
	 else if(ns4) { // Netscape 4.x
	  //document.eval(nObjet).visibility =
	  //(document.eval(nObjet).visibility=='show'?'hidden':'show');
	}
	 else if(ns6) { // Netscape 6 (mozilla)
	   var divns6 = document.getElementsByTagName("div")
	   divns6[nObjet].style.visibility =
	    (divns6[nObjet].style.visibility=='visible'?'hidden':'visible');
	 }
	}

	function Hide(monobjet)
	{
	  if(ie) { // Internet explorer
	    eval(monobjet).style.visibility = 'hidden';
	  }
	  else if(ns4) { // Netscape 4.x
	    //document.eval(monobjet).visibility = 'hidden';
	  }
	  else if(ns6) { // Netscape 6 (mozilla)
	    var divns6 = document.getElementsByTagName("div")
	    divns6[monobjet].style.visibility = 'hidden';
	  }
	}

	function Show(monobjet)
	{
	  if(ie) { // Internet explorer
	    eval(monobjet).style.visibility = 'visible';
	  }
	  else if(ns4) { // Netscape 4.x
	    //document.eval(monobjet).visibility = 'show';
	  }
	  else if(ns6) { // Netscape 6 (mozilla)
	    var divns6 = document.getElementsByTagName("div")
	    divns6[monobjet].style.visibility = 'visible';
	  }
	}


	function getLeft(l)
	{
	  if (l.offsetParent) return (l.offsetLeft + getLeft(l.offsetParent));
	  else return (l.offsetLeft);
	}

	//serializeRTE
	function serializeRTE(src)
	{
	  var str= src.serialize();
	  str = str.replace (/\r\n/g, " ");
	  str = str.replace (/\n/g, " ");
	  return str;
	}

	function JSlight(obj, col) { obj.bgColor=col; }

	function reloadOpener()
	{
	  try
	  {
	    self.opener.location.reload();
	    self.opener.focus();
	    self.close();
	  }catch(exception){}
	}

	//methode pour afficher les RTES
	var rtedraw	= "";
	function drawrte()
	{
	  try
	  {
	    while(true)
	    {
	      var pos = rtedraw.indexOf(',');
	      if( pos == -1 )
	        break;
	      pos = pos+1;
	      pos2 = rtedraw.indexOf(',', pos );
	      if( pos2 == -1 )
	        pos2 = rtedraw.length;
	      var tmp = rtedraw.substring( pos, pos2 );
	      rtedraw = rtedraw.substring( pos,rtedraw.length );
	      try
	      {
	        eval(tmp+'.draw();');
	      }
	      catch(e){}
	    }
	  }catch(e1){}
	}

	function goTo(u)
	{
	  document.location.href=u;
	}

	/**
	 * Determines whether the given char is a white space : space, tabulation, newline
	 */
	function isWhiteSpace(c)
	{
	  return (c == ' ' || c == '\r' || c == '\n' || c == '\t');
	}

	/**
	 * Trims the given string : remove white spaces at begin and end of the string.
	 */
	function trim(s)
	{
	  if ( typeof s != "string" )
	  {
	    return s;
	  }

	  while ( s.length > 0 && isWhiteSpace(s.charAt(0)) )
	  {
	    s = s.substring(1);
	  }

	  while ( s.length > 0 && isWhiteSpace(s.charAt(s.length - 1)) )
	  {
	    s = s.substring(0, s.length - 1);
	  }

	  return s;
	}

	/**
	 * Masque des champs de saisie
	 * ex pour date ! onKeyUp="javascript:return mask(this.value,this,'2,5','/');" onBlur="javascript:return mask(this.value,this,'2,5','/');"
	 */
	function mask(str,textbox,loc,delim){
	var locs = loc.split(',');

	for (var i = 0; i <= locs.length; i++){
		for (var k = 0; k <= str.length; k++){
		 if (k == locs[i]){
		  if (str.substring(k, k+1) != delim){
		   if (event.keyCode != 8){ //backspace
		    str = str.substring(0,k) + delim + str.substring(k,str.length);
	       }
		  }
		 }
		}
	 }
	textbox.value = str
	}
