/*common.js*/
//jQuery.noConflict();
function print_r(theObj){

	if(theObj.constructor == Array ||	theObj.constructor == Object) {

		document.write("<ul>")

		for(var p in theObj){

			if(theObj[p].constructor == Array || theObj[p].constructor == Object) {

				document.write("<li>["+p+"] => "+typeof(theObj)+"</li>");

				document.write("<ul>");

				print_r(theObj[p]);

				document.write("</ul>");

			} else {

				document.write("<li>["+p+"] => "+theObj[p]+"</li>");

			}

		}

		document.write("</ul>")

	}

}
//Montrer les menus de l'admin
function montre(id) {
var d = document.getElementById(id);
	for (var i = 1; i<=15; i++) {
		if (document.getElementById('smenu'+i)) {document.getElementById('smenu'+i).style.display='none';}
	}
if (d) {d.style.display='block';}
}
//******************EQUIPE ASSOCIATION******************************
//
//défilement de l'équipe de l'association
var delay=5000
var ie4=document.all
var curindex=0
var totalcontent=0
function get_total()
{
 if (ie4)
 {
  while (eval("document.all.content"+totalcontent))
	{
   totalcontent++;
  }
 }
 else
 {
  while (document.getElementById("content"+totalcontent))
	{
   totalcontent++;
	}
 }
}

function contract_all()
{
 for (y=0;y<totalcontent;y++)
 {
  if (ie4)
	{
   eval("document.all.content"+y).style.display="none";
	}
  else
	{
   document.getElementById("content"+y).style.display="none";
	}
 }
}

function expand_one(which)
{
 contract_all();
 if (ie4)
 {
  if (eval("document.all.content"+which) != undefined)
	{
   eval("document.all.content"+which).style.display="";
	}
 }
 else
 {
  if (document.getElementById("content"+which) != undefined)
	{
   document.getElementById("content"+which).style.display="";
	}
 }
}
function rotate_content()
{
 get_total();
 contract_all();
 expand_one(curindex);
 curindex=(curindex<totalcontent-1)? curindex+1: 0;
 setTimeout("rotate_content()",delay);
}
//******************EQUIPE ASSOCIATION******************************
//Permet d'ouvrir un popup
function MM_openwin(MM_file,MM_height,MM_width)
{
 MM_config=""
 MM_config+="toolbar=no,";
 MM_config+="location=no,";
 MM_config+="directories=no,";
 MM_config+="status=yes,";
 MM_config+="scrollbars=no,";
 MM_config+="copyhistory=no,";
 MM_config+="width="+MM_width+",";
 MM_config+="height="+MM_height;
 var MM_win=open(MM_file,"",MM_config);
 MM_win.focus();
}
var Handler = {};

// In DOM-compliant browsers, our functions are trivial wrappers around
// addEventListener() and removeEventListener().
if (document.addEventListener) {
    Handler.add = function(element, eventType, handler) {
        element.addEventListener(eventType, handler, false);
    };

    Handler.remove = function(element, eventType, handler) {
        element.removeEventListener(eventType, handler, false);
    };
}
// In IE 5 and later, we use attachEvent() and detachEvent(), with a number of
// hacks to make them compatible with addEventListener and removeEventListener.
else if (document.attachEvent) {
    Handler.add = function(element, eventType, handler) {
        // Don't allow duplicate handler registrations
        // _find() is a private utility function defined below.
        if (Handler._find(element, eventType, handler) != -1) return;
        
        // To invoke the handler function as a method of the
        // element, we've got to define this nested function and register
        // it instead of the handler function itself.
        var wrappedHandler = function(e) {
            if (!e) e = window.event;

            // Create a synthetic event object with partial compatibility
            // with DOM events.
            var event = {
                _event: e,    // In case we really want the IE event object
                type: e.type,           // Event type
                target: e.srcElement,   // Where the event happened
                currentTarget: element, // Where we're handling it
                relatedTarget: e.fromElement?e.fromElement:e.toElement,
                eventPhase: (e.srcElement==element)?2:3,

                // Mouse coordinates
                clientX: e.clientX, clientY: e.clientY,
                screenX: e.screenX, screenY: e.screenY,
                
                // Key state
                altKey: e.altKey, ctrlKey: e.ctrlKey,
                shiftKey: e.shiftKey, charCode: e.keyCode,

                // Event management functions
                stopPropagation: function() {this._event.cancelBubble = true;},
                preventDefault: function() {this._event.returnValue = false;}
            }

            // Invoke the handler function as a method of the element, passing
            // the synthetic event object as its single argument.
            // Use Function.call() if defined; otherwise do a hack
            if (Function.prototype.call) 
                handler.call(element, event);
            else {
                // If we don't have Function.call, fake it like this
                element._currentHandler = handler;
                element._currentHandler(event);
                element._currentHandler = null;
            }
        };

        // Now register that nested function as our event handler.
        element.attachEvent("on" + eventType, wrappedHandler);
        
        // Now we must do some record keeping to associate the user-supplied
        // handler function and the nested function that invokes it.

        // We have to do this so that we can deregister the handler with the
        // remove() method and also deregister it automatically on page unload.

        // Store all info about this handler into an object
        var h = {
            element: element,
            eventType: eventType,
            handler: handler,
            wrappedHandler: wrappedHandler
        };

        // Figure out what document this handler is part of.
        // If the element has no "document" property, it is not
        // a window or a document element, so it must be the document
        // object itself.
        var d = element.document || element;
        // Now get the window associated with that document
        var w = d.parentWindow;

        // We have to associate this handler with the window,
        // so we can remove it when the window is unloaded
        var id = Handler._uid();  // Generate a unique property name
        if (!w._allHandlers) w._allHandlers = {};  // Create object if needed
        w._allHandlers[id] = h; // Store the handler info in this object

        // And associate the id of the handler info with this element as well
        if (!element._handlers) element._handlers = [];
        element._handlers.push(id);

        // If there is not an onunload handler associated with the window,
        // register one now.
        if (!w._onunloadHandlerRegistered) {
            w._onunloadHandlerRegistered = true;
            w.attachEvent("onunload", Handler._removeAllHandlers);
        }
    };

    Handler.remove = function(element, eventType, handler) {
        // Find this handler in the element._handlers[] array.
        var i = Handler._find(element, eventType, handler);
        if (i == -1) return;  // If the handler was not registered, do nothing

        // Get the window of this element
        var d = element.document || element;
        var w = d.parentWindow;

        // Look up the unique id of this handler
        var handlerId = element._handlers[i];
        // And use that to look up the handler info
        var h = w._allHandlers[handlerId];
        // Using that info, we can detach the handler from the element
        element.detachEvent("on" + eventType, h.wrappedHandler);
        // Remove one element from the element._handlers array
        element._handlers.splice(i, 1);
        // And delete the handler info from the per-window _allHandlers object
        delete w._allHandlers[handlerId];
    };

    // A utility function to find a handler in the element._handlers array
    // Returns an array index or -1 if no matching handler is found
    Handler._find = function(element, eventType, handler) {
        var handlers = element._handlers;
        if (!handlers) return -1;  // if no handlers registered, nothing found

        // Get the window of this element
        var d = element.document || element;
        var w = d.parentWindow;

        // Loop through the handlers associated with this element, looking
        // for one with the right type and function.
        // We loop backward because the most recently registered handler
        // is most likely to be the first removed one.
        for(var i = handlers.length-1; i >= 0; i--) {
            var handlerId = handlers[i];        // get handler id
            var h = w._allHandlers[handlerId];  // get handler info
            // If handler info matches type and handler function, we found it.
            if (h.eventType == eventType && h.handler == handler) 
                return i;
        }
        return -1;  // No match found
    };

    Handler._removeAllHandlers = function() {
        // This function is registered as the onunload handler with 
        // attachEvent.  This means that the this keyword refers to the
        // window in which the event occurred.
        var w = this;

        // Iterate through all registered handlers
        for(id in w._allHandlers) {
            // Get handler info for this handler id
            var h = w._allHandlers[id]; 
            // Use the info to detach the handler
            h.element.detachEvent("on" + h.eventType, h.wrappedHandler);
            // Delete the handler info from the window
            delete w._allHandlers[id];
        }
    }

    // Private utility to generate unique handler ids
    Handler._counter = 0;
    Handler._uid = function() { return "h" + Handler._counter++; };
}
function creerBalise(tagname, attributes, children) {
    
    // If we were invoked with two arguments the attributes argument is
    // an array or string, it should really be the children arguments.
    if (arguments.length == 2 && 
        (attributes instanceof Array || typeof attributes == "string")) {
        children = attributes;
        attributes = null;
    }

    // Create the element
    var e = document.createElement(tagname);

    // Set attributes
    if (attributes) {
        for(var name in attributes) e.setAttribute(name, attributes[name]);
    }

    // Add children, if any were specified.
    if (children != null) {
        if (children instanceof Array) {  // If it really is an array
            for(var i = 0; i < children.length; i++) { // Loop through kids
                var child = children[i];
                if (typeof child == "string")          // Handle text nodes
                    child = document.createTextNode(child);
                e.appendChild(child);  // Assume anything else is a Node
            }
        }
        else if (typeof children == "string") // Handle single text child
            e.appendChild(document.createTextNode(children));
        else e.appendChild(children);         // Handle any other single child
    }

    // Finally, return the element.
    return e;
}
/**
 * maker(tagname): return a function that calls make() for the specified tag.
 * Example: var table = maker("table"), tr = maker("tr"), td = maker("td");
 */
function createurBalise(tag) {
    return function(attrs, kids) {
        if (arguments.length == 1) return creerBalise(tag, attrs);
        else return creerBalise(tag, attrs, kids);
    }
}
/**
 * getElements(classname, tagname, root):
 * Return an array of DOM elements that are members of the specified class,
 * have the specified tagname, and are descendants of the specified root.
 * 
 * If no classname is specified, elements are returned regardless of class.
 * If no tagname is specified, elements are returned regardless of tagname.
 * If no root is specified, the document object is used.  If the specified
 * root is a string, it is an element id, and the root
 * element is looked up using getElementsById()
 */
function getElements(classname, tagname, root) {
    // If no root was specified, use the entire document
    // If a string was specified, look it up
    if (!root) root = document;
    else if (typeof root == "string") root = document.getElementById(root);
    
    // if no tagname was specified, use all tags
    if (!tagname) tagname = "*";

    // Find all descendants of the specified root with the specified tagname
    var all = root.getElementsByTagName(tagname);

    // If no classname was specified, we return all tags
    if (!classname) return all;

    // Otherwise, we filter the element by classname
    var elements = [];  // Start with an emtpy array
    for(var i = 0; i < all.length; i++) {
        var element = all[i];
        if (isMember(element, classname)) // isMember() is defined below
            elements.push(element);       // Add class members to our array
    }

    // Note that we always return an array, even if it is empty
    return elements;

    // Determine whether the specified element is a member of the specified
    // class.  This function is optimized for the common case in which the 
    // className property contains only a single classname.  But it also 
    // handles the case in which it is a list of whitespace-separated classes.
    function isMember(element, classname) {
        var classes = element.className;  // Get the list of classes
        if (!classes) return false;             // No classes defined
        if (classes == classname) return true;  // Exact match

        // We didn't match exactly, so if there is no whitespace, then 
        // this element is not a member of the class
        var whitespace = /\s+/;
        if (!whitespace.test(classes)) return false;

        // If we get here, the element is a member of more than one class and
        // we've got to check them individually.
        var c = classes.split(whitespace);  // Split with whitespace delimiter
        for(var i = 0; i < c.length; i++) { // Loop through classes
            if (c[i] == classname) return true;  // and check for matches
        }

        return false;  // None of the classes matched
    }
}
function montrer_element(elem)
{
 var element=document.getElementById(elem);
 //element.style.display="block";
 if (window.opera)
 {
  setTimeout(elem + ".style.display = ''", 1);
 } 
 else
 {
  element.style.display="block";
 }
 return false;
}
function cacher_div(elem)
{
 var element=document.getElementById(elem);
 element.style.display="none";
}
function cacher_element(elem)
{
 if (elem == "fm_valide")
 {
  var DeplacerElement=document.getElementById('fm_valide');
 }
 if (elem == "rs_capacite")
 {
  var DeplacerElement=document.getElementById('fcapacite');
 }
 if (elem == "rs_mensualite")
 {
  var DeplacerElement=document.getElementById('fecheance');
 }
 var element=document.getElementById(elem);
 element.style.display="none";
 var CoordonneeElement=findPos(DeplacerElement);
 //alert(CoordonneeElement);
 alert('Des erreurs (indiquées en rouge) ont été rencontrées dans la saisie de votre formulaire, merci de les corriger !');
 scrollTo(0,CoordonneeElement); 
}
function rechercher_option_selectionnee(element)
{
 for (var i=0;i<element.childNodes.length;i++)
 {
  if (element.childNodes[i].nodeName == "OPTION")
	{
	 var optionSelected = element.childNodes[i].selected;
	 if (optionSelected == true)
	 {
	  var valeurOptionSelected = element.childNodes[i].getAttribute('value') ;
    return valeurOptionSelected;
	 }
	}
 }
}
function rechercher_radio_selectionnee(element)
{
 if(element != null)
 {
  for(var i = 0; i < element.length;i++) 
	{
   if(element[i].type == "radio")
	 {
	  if (element[i].checked == true)
		{
		 var inputRadioSelectionne=element[i].value;
		 return inputRadioSelectionne;
		}//fin if
   }//fin if
  }//fin for
 }//fin if
}
function rechercher_radio_selectionnee_3(element)
{
 if(element != null)
 {
  for(var i = 0; i < element.length;i++) 
	{
   if(element[i].type == "radio")
	 {
	  if (element[i].checked == true)
		{
		 return element[i];
		}//fin if
   }//fin if
  }//fin for
 }//fin if
}
function rechercher_radio_selectionnee_2(element)
{
 var inputRadioSelectionne=new Array();
 if(element != null)
 {
  var j=0;
  for(var i = 0; i < element.length;i++) 
	{
   if(element[i].type == "radio")
	 {
	  if (element[i].checked == true)
		{
		 inputRadioSelectionne[j]=element[i].value;
		 //alert (j);
		 //alert (inputRadioSelectionne[j]);
		 j++;
		}//fin if
   }//fin if
  }//fin for
	return inputRadioSelectionne;
 }//fin if
}
function rechercher_checkbox_selectionnee_1(element)
{
 if(element != null)
 {
	if (element.checked == true)
  {
	 return 1;
  }//fin if
	else
	{
	 return 0;
	}
 }//fin if
}
function creerListeTableauValeur(tableau)
{
 if (tableau.length > 0)
 {
  var valeurs=new Array();
  for(var i = 0; i < tableau.length; i++) 
  {
	 valeurs[i]=tableau[i].value;
  }
  liste=valeurs.join(",");
  return liste;
 }
 else
 { 
  return -1;
 }
}
function getElementsChecked(classname, tagname, root) 
{
    // If no root was specified, use the entire document
    // If a string was specified, look it up
    if (!root) root = document;
    else if (typeof root == "string") root = document.getElementById(root);
    
    // if no tagname was specified, use all tags
    if (!tagname) tagname = "*";

    // Find all descendants of the specified root with the specified tagname
    var all = root.getElementsByTagName(tagname);

    // If no classname was specified, we return all tags
    if (!classname) return all;

    // Otherwise, we filter the element by classname
    var elements = [];  // Start with an emtpy array
    for(var i = 0; i < all.length; i++) 
		{
     var element = all[i];
     if (isMember(element, classname))
		 { // isMember() is defined below
		   if (all[i].checked == true)
			 {
        elements.push(element);
			 } 
		 }// Add class members to our array
    }

    // Note that we always return an array, even if it is empty
    return elements;

    // Determine whether the specified element is a member of the specified
    // class.  This function is optimized for the common case in which the 
    // className property contains only a single classname.  But it also 
    // handles the case in which it is a list of whitespace-separated classes.
    function isMember(element, classname) {
        var classes = element.className;  // Get the list of classes
        if (!classes) return false;             // No classes defined
        if (classes == classname) return true;  // Exact match

        // We didn't match exactly, so if there is no whitespace, then 
        // this element is not a member of the class
        var whitespace = /\s+/;
        if (!whitespace.test(classes)) return false;

        // If we get here, the element is a member of more than one class and
        // we've got to check them individually.
        var c = classes.split(whitespace);  // Split with whitespace delimiter
        for(var i = 0; i < c.length; i++) { // Loop through classes
            if (c[i] == classname) return true;  // and check for matches
        }

        return false;  // None of the classes matched
    }
}
function getElementsByClassName(className, tagName) 
{
 var els = document.getElementsByTagName(tagName || (tagName = "*"));
 if (tagName === "*" && !els.length && document.all) 
 {
	els = document.all;
 }
 var res = [], re = new RegExp("(^| )" + className + "( |$)");
 for (var i = 0, el; (el = els[ i]); ++i) 
 {
	if (re.test(el.className))
	{
	 res[res.length] = el;
  }
 }
 return res;
}
function supprimer_balise_erreur(identifiant)
{
 var balise = document.getElementById(identifiant);
 if (balise != null)
 {
	balise.parentNode.removeChild(balise);
 }
}
function supprimerEnfant(parent)
{
 while (parent.hasChildNodes())
 {
	var premierEnfant=parent.firstChild;
	parent.removeChild(premierEnfant);
 }
}
function supprimerLigneTableau(balise)
{
 var baliseTd=balise.parentNode;
 var baliseTr=baliseTd.parentNode;
 var baliseTbody=baliseTr.parentNode;
 while (baliseTbody.hasChildNodes())
 {
	var premierEnfant=baliseTbody.firstChild;
	baliseTbody.removeChild(premierEnfant);
 }
}
function rechercherOptionSelectionnee(baliseSelect)
{
 var selectSite=baliseSelect;
 for (var i=0;i<selectSite.childNodes.length;i++)
 {
  if (selectSite.childNodes[i].nodeName == "OPTION")
	{
	 var option_selectionnee = selectSite.childNodes[i].selected;
	 if (option_selectionnee == true)
	 {
	  var option=new Array();
	  option["valeur"]=selectSite.childNodes[i].value ;
		option["texte"]=selectSite.childNodes[i].text ;
		return option;
	 }
	}
 }
}
var finalPosition, startPosition, step;
function GotoItem(sender)
{
    var Item = document.getElementById(sender.id.substring(1));
    finalPosition =Item.offsetTop + decalage2;
    startPosition = Math.max(GetScrollPos(),positionTop);
    step = Math.floor(Math.abs(finalPosition - startPosition)/20);
    if(finalPosition> startPosition)
		ScrollTTB(startPosition);
	else
		ScrollBTT(startPosition);	
}

function ScrollTTB(i)
{
	i+=step;
	if(i<finalPosition)
	{
        scrollTo(0,i);
		setTimeout("ScrollTTB("+i+")",30);
	}
	else
    	scrollTo(0,finalPosition);
}

function ScrollBTT(i)
{
	i-=step;
	if(i>finalPosition)
	{
        scrollTo(0,i);
		setTimeout("ScrollBTT("+i+")",30);
	}
	else
    	scrollTo(0,finalPosition);
}

function deplacer_progressif(i){
  for (i; i>0; i-- ){
    scrollTo(0,i);
  }
}
function supprimer_balise_tbody(element,type,prefixe)
{
 if(element != null)
 {
  for(var i = 0; i < element.length;i++) 
	{
   if(element[i].type == type)
	 {
	  if (element[i].checked == true)
		{
		 var valeurElement=element[i].value;
		 //modif = Page
		 var valeurId=prefixe + valeurElement;
		 var baliseTbody=document.getElementById(valeurId);
		 baliseTbody.removeChild(baliseTbody.firstChild);
		 i--;
		}//fin if
   }//fin if
  }//fin for
 }//fin if
 var tbody = document.getElementsByTagName("tbody");
 if(tbody != null)
 {
  for(var i = 0; i < tbody.length;i++)
	{
	 if (tbody[i].firstChild == null)
	 {
		tbody[i].parentNode.removeChild(tbody[i]);
		i--;
	 }
	}
 }
}
/*moteur de recherche : activite.js*/
//rechercheCategorie
function rechercheCategorie()
{
 var valeurCritere=0;
 var optionCategorie=0;
 var radioQuoi=0;
 var checkboxCritere=document.getElementById("plusDeCritere");
 if (checkboxCritere != undefined)
 {
  if (checkboxCritere.checked == true)
  {
   valeurCritere=1;
  }
 }
 //
 var selectCategorie=document.getElementById("selectCategorie");
 if (selectCategorie != undefined)
 {
  optionCategorie=rechercher_option_selectionnee(selectCategorie);
 }
 //
 var inputRadioQuoi = document.getElementsByTagName("input");
 if (inputRadioQuoi != undefined)
 {
  radioQuoi=rechercher_radio_selectionnee_2(inputRadioQuoi);
 }
 //
 sendData('POST','activite.php','inputQuoi='+radioQuoi+'&plusDeCritere='+valeurCritere+'&selectCategorie='+optionCategorie);
}
//montrerCategorie
function montrer_categorie()
{
 var plusDeCritere=document.getElementById('plusDeCritere');
 if (plusDeCritere != undefined)
 {
  var selectCategorie=document.getElementById('selectCategorie');
	var selectSousCategorie=document.getElementById('selectSousCategorie');
  if (plusDeCritere.checked == true)
	{
	 if (selectCategorie != undefined)
	 {
	  selectCategorie.disabled=false;
	 }
	 if (selectSousCategorie != undefined)
	 {
	  selectSousCategorie.disabled=false;
	 }
	}
	else if (plusDeCritere.checked == false)
	{
	 if (selectCategorie != undefined)
	 {
	  selectCategorie.disabled=true;
	 }
	 if (selectSousCategorie != undefined)
	 {
	  selectSousCategorie.disabled=true;
	 }
	}
 }
}
function traiter_activite()
{
 var inputRadioPage = document.getElementsByTagName("input");
 var radioPage=rechercher_radio_selectionnee_3(inputRadioPage);
 if (radioPage != undefined)
 {
  radioPage.checked=true;
 }
}
function lookup(inputString,type) 
{
 if(inputString.length == 0) 
 {
  if (type == "departement")
	{
	 //alert('ok');
	 // Hide the suggestion box.
	 $('#suggestions').hide();
	}
	if (type == "ville")
	{
	 //alert('ok');
	 // Hide the suggestion box.
	 $('#suggestions2').hide();
	}
 } 
 else 
 {
  if (type == "ville")
	{
	 var selectDepartement=document.getElementById("selectDepartement");
	 var valeurDepartement=selectDepartement.value;
   //alert($('#selectDepartement').value);
	 //alert(valeurDepartement);
	}
	if (type == "departement")
	{
	 var valeurDepartement="";
	}
	$.post("admin.php", {queryString: ""+inputString+"",typeInfo : type, departement : valeurDepartement }, 
	function(data)
	{
	 if(data.length >0) 
	 {
	  if (type == "departement")
		{
		 $('#suggestions').show();
		 $('#autoSuggestionsList').html(data);
		}
		if (type == "ville")
		{
		 $('#suggestions2').show();
		 $('#autoSuggestionsList2').html(data);
		}
	 }
	} );
 }
} // lookup
function fill(thisValue,type) 
{
 if (type == "departement")
 {
  $('#selectDepartement').val(thisValue);
	var selectVille=document.getElementById("selectVille");
	selectVille.value="";
	selectVille.disabled=false;
	var selectDepartement=document.getElementById("selectDepartement");
	//selectDepartement.readonly=true;
  setTimeout("$('#suggestions').hide();", 500);
 }
 if (type == "ville")
 {
  $('#selectVille').val(thisValue);
	var selectDepartement=document.getElementById("selectDepartement");
	selectDepartement.disabled=false;
  setTimeout("$('#suggestions2').hide();", 500);
 }
}
function montrer_ville()
{
 setTimeout("montrer_element('ActiviteVille')",500);
}
/*ajax.js*/
function getHTTPObject()
{
 var xmlhttp = false;
 /* Compilation conditionnelle d'IE */
 /*@cc_on
 @if (@_jscript_version >= 5)
 try
 {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 }
 catch (e)
 {
  try
  {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  }
  catch (E)
  {
   xmlhttp = false;
  }
 }
 @else
 xmlhttp = false;
 @end @*/
 /* on essaie de créer l'objet si ce n'est pas déjà fait */
 if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
 {
  try
  {
   xmlhttp = new XMLHttpRequest();
  }
  catch (e)
  {
   xmlhttp = false;
  }
 }
 if (xmlhttp)
 {
  /* on définit ce qui doit se passer quand la page répondra */
  xmlhttp.onreadystatechange=function()
  {
   if (xmlhttp.readyState == 4) /* 4 : état "complete" */
   {
    if (xmlhttp.status == 200) /* 200 : code HTTP pour OK */
    {
		 if (xmlhttp.responseText != "")
		 {
		  //ajaxActivite
			var chaineCategorie=document.getElementById('chaineCategorie');
			if (chaineCategorie != undefined)
			{
			 document.getElementById('chaineCategorie').innerHTML=xmlhttp.responseText;
			}
		 }
    }
   }
  }
 }
 return xmlhttp;
}
function sendData(method, url, data)
{
 var xmlhttp = getHTTPObject();
 if (!xmlhttp)
 {
  return false;
 }
 if(method == "GET")
 {
  if(data == 'null')
  {
   xmlhttp.open("GET", url, true); //ouverture asynchrone
  }
  else
  {
   xmlhttp.open("GET", url+"?"+data, true);
  }
  xmlhttp.send(null);
 }
 else if(method == "POST")
 {
  xmlhttp.open("POST", url, true); //ouverture asynchrone
  xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
  xmlhttp.send(data);
 }
 return true;
}
/*filtreinput.js*/
/**
 * InputFilter.js: unobtrusive filtering of keystrokes for <input> tags.
 * 
 * This module finds all <input type="text"> elements in the document that
 * have a nonstandard attribute named "allowed". It registers an onkeypress
 * event handler for any such element to restrict the user's input so that
 * only characters that appear in the value of the allowed attribute may be
 * entered. If the <input> element also has an attribute named "messageid",
 * the value of that attribute is taken to be the id of another document
 * element.  If the user types a character that is not allowed, the messageid
 * element is made visible.  If the user types a character that is allowed,
 * the messageid element is hidden.  This message id element is intended to
 * offer an explanation to the user of why her keystroke was rejected. It
 * should typically be styled with CSS so that it is initially invisible.
 *
 * Here is some example HTML that uses this module.
 *   Zipcode:
 *   <input id="zip" type="text" allowed="0123456789" messageid="zipwarn">
 *   <span id="zipwarn" style="color:red;visibility:hidden">Digits only</span>
 * 
 * In browsers such as IE do not support addEventListener(), the 
 * keypress handler registered by this module overwrites any keypress handler
 * defined in HTML.
 *
 * This module is purely unobtrusive: it does not define any symbols in
 * the global namespace.
 */
(function() {  // The entire module is within an anonymous function
    // When the document finishes loading, call the init() function below
    if (window.addEventListener) window.addEventListener("load", init, false);
    else if (window.attachEvent) window.attachEvent("onload", init);

    // Find all the <input> tags we need to register an event handler on
    function init() {
        var inputtags = document.getElementsByTagName("input");
        for(var i = 0 ; i < inputtags.length; i++) { // Loop through all tags
            var tag = inputtags[i];
            if (tag.type != "text") continue; // We only want text fields
						//--??
						//var allowed = tag.getAttribute("allowed");
            var allowed = tag.getAttribute("accesskey");
            if (!allowed) continue;  // And only if they have an allowed attr

            // Register our event handler function on this input tag
            if (tag.addEventListener)
                tag.addEventListener("keypress", filter, false);
            else {
                // We don't use attachEvent because it does not invoke the
                // handler function with the correct value of the this keyword.
                tag.onkeypress = filter;
            }
        }
    }

    // This is the keypress handler that filters the user's input
    function filter(event) {
        // Get the event object and character code in a portable way
        var e = event || window.event;         // Key event object
        var code = e.charCode || e.keyCode;    // What key was pressed

        // If this keystroke is a function key of any kind, do not filter it
        if (e.charCode == 0) return true;       // Function key (Firefox only)
        if (e.ctrlKey || e.altKey) return true; // Ctrl or Alt held down
        if (code < 32) return true;             // ASCII control character

        // Now look up information we need from this input element
				//--??
				//var allowed = this.getAttribute("allowed");     // Legal chars
        var allowed = this.getAttribute("accesskey");     // Legal chars
        var messageElement = null;                      // Message to hide/show
        var messageid = this.getAttribute("messageid"); // Message id, if any
        if (messageid)  // If there is a message id, get the element
            messageElement = document.getElementById(messageid);
        
        // Convert the character code to a character
        var c = String.fromCharCode(code);
        
        // See if the character is in the set of allowed characters
        if (allowed.indexOf(c) != -1) {
            // If c is a legal character, hide the message, if any
            if (messageElement) messageElement.style.visibility = "hidden";
            return true; // And accept the character
        }
        else {
            // If c is not in the set of allowed characters, display message
            if (messageElement) messageElement.style.visibility = "visible";
            // And reject this keypress event
            if (e.preventDefault) e.preventDefault();
            if (e.returnValue) e.returnValue = false;
            return false;
        }
    }
})(); // Finish anonymous function and invoke it.
/*chrome.js*/
//Chrome Drop Down Menu v2.01- Author: Dynamic Drive (http://www.dynamicdrive.com)
//Last updated: November 14th 06- added iframe shim technique

var cssdropdown={
disappeardelay: 0, //set delay in miliseconds before menu disappears onmouseout
disablemenuclick: false, //when user clicks on a menu item with a drop down menu, disable menu item's link?
enableswipe: 1, //enable swipe effect? 1 for yes, 0 for no
enableiframeshim: 1, //enable "iframe shim" technique to get drop down menus to correctly appear on top of controls such as form objects in IE5.5/IE6? 1 for yes, 0 for no

//No need to edit beyond here////////////////////////
dropmenuobj: null, ie: document.all, firefox: document.getElementById&&!document.all, swipetimer: undefined, bottomclip:0,

getposOffset:function(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
},

swipeeffect:function(){
if (this.bottomclip<parseInt(this.dropmenuobj.offsetHeight)){
this.bottomclip+=10+(this.bottomclip/10) //unclip drop down menu visibility gradually
this.dropmenuobj.style.clip="rect(0 auto "+this.bottomclip+"px 0)"
}
else
return
this.swipetimer=setTimeout("cssdropdown.swipeeffect()", 10)
},

showhide:function(obj, e){
if (this.ie || this.firefox)
this.dropmenuobj.style.left=this.dropmenuobj.style.top="-500px"
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover"){
if (this.enableswipe==1){
if (typeof this.swipetimer!="undefined")
clearTimeout(this.swipetimer)
obj.clip="rect(0 auto 0 0)" //hide menu via clipping
this.bottomclip=0
this.swipeeffect()
}
obj.visibility="visible"
}
else if (e.type=="click")
obj.visibility="hidden"
},

iecompattest:function(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
},

clearbrowseredge:function(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=this.ie && !window.opera? this.iecompattest().scrollLeft+this.iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetWidth
if (windowedge-this.dropmenuobj.x < this.dropmenuobj.contentmeasure)  //move menu to the left?
edgeoffset=this.dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=this.ie && !window.opera? this.iecompattest().scrollTop : window.pageYOffset
var windowedge=this.ie && !window.opera? this.iecompattest().scrollTop+this.iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
this.dropmenuobj.contentmeasure=this.dropmenuobj.offsetHeight
if (windowedge-this.dropmenuobj.y < this.dropmenuobj.contentmeasure){ //move up?
edgeoffset=this.dropmenuobj.contentmeasure+obj.offsetHeight
if ((this.dropmenuobj.y-topedge)<this.dropmenuobj.contentmeasure) //up no good either?
edgeoffset=this.dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
},

dropit:function(obj, e, dropmenuID){
if (this.dropmenuobj!=null) //hide previous menu
this.dropmenuobj.style.visibility="hidden" //hide menu
this.clearhidemenu()
if (this.ie||this.firefox){
obj.onmouseout=function(){cssdropdown.delayhidemenu()}
obj.onclick=function(){return !cssdropdown.disablemenuclick} //disable main menu item link onclick?
this.dropmenuobj=document.getElementById(dropmenuID)
this.dropmenuobj.onmouseover=function(){cssdropdown.clearhidemenu()}
this.dropmenuobj.onmouseout=function(e){cssdropdown.dynamichide(e)}
this.dropmenuobj.onclick=function(){cssdropdown.delayhidemenu()}
this.showhide(this.dropmenuobj.style, e)
this.dropmenuobj.x=this.getposOffset(obj, "left")
this.dropmenuobj.y=this.getposOffset(obj, "top")
this.dropmenuobj.style.left=this.dropmenuobj.x-this.clearbrowseredge(obj, "rightedge")+"px"
this.dropmenuobj.style.top=this.dropmenuobj.y-this.clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+1+"px"
this.positionshim() //call iframe shim function
}
},

positionshim:function(){ //display iframe shim function
if (this.enableiframeshim && typeof this.shimobject!="undefined"){
if (this.dropmenuobj.style.visibility=="visible"){
this.shimobject.style.width=this.dropmenuobj.offsetWidth+"px"
this.shimobject.style.height=this.dropmenuobj.offsetHeight+"px"
this.shimobject.style.left=this.dropmenuobj.style.left
this.shimobject.style.top=this.dropmenuobj.style.top
}
this.shimobject.style.display=(this.dropmenuobj.style.visibility=="visible")? "block" : "none"
}
},

hideshim:function(){
if (this.enableiframeshim && typeof this.shimobject!="undefined")
this.shimobject.style.display='none'
},

contains_firefox:function(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
},

dynamichide:function(e){
var evtobj=window.event? window.event : e
if (this.ie&&!this.dropmenuobj.contains(evtobj.toElement))
this.delayhidemenu()
else if (this.firefox&&e.currentTarget!= evtobj.relatedTarget&& !this.contains_firefox(evtobj.currentTarget, evtobj.relatedTarget))
this.delayhidemenu()
},

delayhidemenu:function(){
this.delayhide=setTimeout("cssdropdown.dropmenuobj.style.visibility='hidden'; cssdropdown.hideshim()",this.disappeardelay) //hide menu
},

clearhidemenu:function(){
if (this.delayhide!="undefined")
clearTimeout(this.delayhide)
},

startchrome:function(){
for (var ids=0; ids<arguments.length; ids++){
var menuitems=document.getElementById(arguments[ids]).getElementsByTagName("a")
for (var i=0; i<menuitems.length; i++){
if (menuitems[i].getAttribute("rel")){
var relvalue=menuitems[i].getAttribute("rel")
menuitems[i].onmouseover=function(e)
{
var event=typeof e!="undefined"? e : window.event
cssdropdown.dropit(this,event,this.getAttribute("rel"))
}
}
}
}
if (window.createPopup && !window.XmlHttpRequest){ //if IE5.5 to IE6, create iframe for iframe shim technique
document.write('<IFRAME id="iframeshim"  src="" style="display: none; left: 0; top: 0; z-index: 90; position: absolute; filter: progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)" frameBorder="0" scrolling="no"></IFRAME>')
this.shimobject=document.getElementById("iframeshim") //reference iframe object
}
}
/*pausescroller*/
}
function pausescroller(content, divId, divClass, delay){
this.content=content //message array content
this.tickerid=divId //ID of ticker div to display information
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
this.hiddendivpointer=1 //index of message array for hidden div
document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')
var scrollerinstance=this
if (window.addEventListener) //run onload in DOM2 browsers
window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
else if (window.attachEvent) //run onload in IE5.5+
window.attachEvent("onload", function(){scrollerinstance.initialize()})
else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
setTimeout(function(){scrollerinstance.initialize()}, 500)
}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

pausescroller.prototype.initialize=function(){
this.tickerdiv=document.getElementById(this.tickerid)
this.visiblediv=document.getElementById(this.tickerid+"1")
this.hiddendiv=document.getElementById(this.tickerid+"2")
this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}


// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

pausescroller.prototype.animateup=function(){
var scrollerinstance=this
if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
setTimeout(function(){scrollerinstance.animateup()}, 50)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}

// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------

pausescroller.prototype.swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}

pausescroller.prototype.getinline=function(div1, div2){
div1.style.top=this.visibledivtop+"px"
div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}

// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------

pausescroller.prototype.setmessage=function(){
var scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){scrollerinstance.setmessage()}, 100)
else{
var i=this.hiddendivpointer
var ceiling=this.content.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
this.animateup()
}
}

pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
if (tickerobj.currentStyle)
return tickerobj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //if DOM2
return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
else
return 0
}
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	//return [curleft,curtop];
	return curtop;
}
//====================== VERSION 3 - AVRIL 2008 ================================
//Formulaire de contact
function Verifier_Formulaire_Contact()
{
 var Formulaire=document.getElementById("femprunt");
 xajax_AfficherErreurs(xajax.getFormValues(Formulaire));
}
function Verifier_Longueur_Chaine(Element_Entree,Maximum_Entree,Message_Entree)
{
 var Valeur=document.getElementById(Element_Entree).value;
 var Longueur_Chaine=Valeur.length;
 var Caracteres_Restant=Maximum_Entree - Longueur_Chaine;
 if (Longueur_Chaine > Maximum_Entree)
 {
	Valeur.substr(0, Maximum_Entree);
	document.getElementById(Element_Entree).value=document.getElementById(Element_Entree).value.substr(0, Maximum_Entree); 
	Caracteres_Restant=0;
	alert ('Vous ne pouvez pas saisir plus de ' + Maximum_Entree + ' caractères !');
 }
 if (Message_Entree != "null")
 {
	document.getElementById(Message_Entree).innerHTML=Caracteres_Restant + " caractères restant";
 }
}
function Afficher_Formulaire_Contact()
{
 var Url_Courante = self.location.href;
 setTimeout("window.location.replace('"+Url_Courante+"')",3000);
}
function Montrer_Balise(Element_Entree)
{
 var Element=document.getElementById(Element_Entree);
 if (window.opera)
 {
  setTimeout(Element_Entree + ".style.display = ''", 1);
 } 
 else
 {
  Element.style.display="block";
 }
 return false;
}
function Cacher_Balise(Element_Entree)
{
 var Element=document.getElementById(Element_Entree);
 Element.style.display="none";
}
function Signaler_Erreur_Formulaire()
{
 var Elements=getElements('error','span');
 if (Elements.length > 0)
 {
  var Position_Element_X=Obtenir_X(Elements[0]);
  var Position_Element_Y=Obtenir_Y(Elements[0]);
	window.scrollTo(0,(Position_Element_Y-300));
	alert('Des erreurs (indiquées en rouge) ont été rencontrées dans la saisie de votre formulaire, merci de les corriger !');
 }
}
function Obtenir_X(Element_Entree)
{
 var x=0;
 while(Element_Entree)
 {
  x+=Element_Entree.offsetLeft;
	Element_Entree=Element_Entree.offsetParent;
 }
 return x;
}
function Obtenir_Y(Element_Entree)
{
 var y=0;
 for (var e=Element_Entree ; e ; e=e.offsetParent)
 {
  y+=e.offsetTop;
 }
 for (e=Element_Entree.parentNode ; e && e != document.body ; e=e.parentNode)
 {
  if (e.srollTop)
	{
	 y-=e.scrollTop;
	}
 }
 return y;
}
//====================== VERSION 3 - AVRIL 2008 ================================