<!--
	
	/****
	    
		 ==                           ==
	    ==   Classe < AjaxLoader >   ==
		 ==                           ==
		 
	****/
	
	
	//    ###  Classe  ###
	
	
	AjaxLoader = function(fParams) {
		
		this.classname = fParams["name"];
		
		this.loadFunction = "onLoad";
		this.defaultMethod = "get";
		this.varsList = new Array();
		
		this.addVar = function(fParams) {
			
			if (fParams) {
				
				if (fParams["name"] && fParams["value"]) {
					
					this.varsList.push( { name:fParams["name"], value:encodeURIComponent(fParams["value"]) } );
					
				}
				
			}
			
		};
		
		this.loadFile = function(fParams) {
			
			if (fParams) {
				
				if (fParams["file"]) {
					
					// Définition des paramètres
					
					var myMethod = (fParams["method"]) ? fParams["method"] : this.defaultMethod ;
					var myBoundary = (fParams["boundary"]) ? fParams["boundary"] : false ;
					
					// Listing des variables
					
					if (this.varsList.length > 0) {
						
						var i = -1;
						var myVariables = "";
						while (i < this.varsList.length) {
							i++;
							if (this.varsList[i]) {
								if (myVariables != "") myVariables += "&";
								myVariables += this.varsList[i]["name"] + "=" + this.varsList[i]["value"];
							}
						}
						
					} else {
						
						var myVariables = null;
						
					}
					
					if (myBoundary != "" && myBoundary != false) {
						
						if (myVariables == null || myVariables == "") {
							myVariables = "AX_BOUNDARY=" + myBoundary;
						} else {
							myVariables += "&AX_BOUNDARY=" + myBoundary;
						}
						
					}
					
					// Appel Ajax
					
					var axReq = null;
					
					if (window.XMLHttpRequest) {
						axReq = new XMLHttpRequest();
						if (axReq.overrideMimeType) axReq.overrideMimeType('text/xml');
					} else if (window.ActiveXObject) {
						try {
							axReq = new ActiveXObject("Msxml2.XMLHTTP");
						} catch (e) {
							try { axReq = new ActiveXObject("Microsoft.XMLHTTP"); }
							catch (e) {}
						}
					}
					
					eval("axReq.onreadystatechange = function() { " + this.classname + "._CheckResult_( '" + this.classname + "', axReq, '" + myBoundary + "', '" + this.loadFunction + "' ) }");
					
					axReq.open(myMethod,fParams["file"],true);
					axReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
					axReq.send(myVariables);
					
				}
				
			}
			
		};
		
		this._CheckResult_ = function(myClass,myReq,myBoundary,myFunction) {
			
			if(myReq.readyState == 4) {
				if (myReq.status == 200) {
					myRes = myReq.responseText.split("<scripter>").join("").split("</scripter>").join("");
					myResult = (myBoundary != false && myBoundary != "") ? myRes.split(myBoundary) : myRes ;
					eval(myClass + "." + myFunction)(myResult);
				} else {
					eval(myClass + "." + myFunction)(false);
				}
			}
			
		};
		
	};
	
-->
