//Created by Sean Kane (http://celtickane.com/programming/code/ajax.php)
//Feather Ajax v1.0.1
//Trim function added by Sven Kauber from http://www.codestore.net/store.nsf/unid/BLOG-20060313
//this was needed as for some reason target div id from POST did have spaces in front of the name itself 

function AjaxObject101() {
	String.prototype.trim = function() {
		a = this.replace(/^\s+/, '');
		return a.replace(/\s+$/, '');
	}
	this.createRequestObject = function() {
		try {
			var ro = new XMLHttpRequest();
		}
		catch (e) {
			var ro = new ActiveXObject("Microsoft.XMLHTTP");
		}
		return ro;
	}
	this.sndReq = function(action, url, data) {
		if (action.toUpperCase() == "POST") {
			this.http.open(action,url,true);
			this.http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			this.http.onreadystatechange = this.handleResponse;
			this.http.send(data);
		}
		else {
			this.http.open(action,url + '?' + data,true);
			this.http.onreadystatechange = this.handleResponse;
			this.http.send(null);
		}
	}
	this.handleResponse = function() {
		if (me.http.readyState == 4) {
			if (typeof me.funcDone == 'function') { me.funcDone();}
			   var item = me.http.responseText.split("<daytarget>");
			   var before_beginning = (item[0] != '') ? item[0] : '';
			   var target = item[1].split("</daytarget>")[0];
			   var code = item[1].split("</daytarget>")[1]+(before_beginning != '' ? before_beginning : '');
    	   if(code != ''){
    	     if (code.substr(0,3) == "%V%" ) {
			       document.getElementById(target).value = item[1].substring(3);
			   	 } else {
			       document.getElementById(target.trim()).innerHTML = code;
			   	 }
			   }
		}
		if ((me.http.readyState == 1) && (typeof me.funcWait == 'function')) { me.funcWait(); }
	}
	var me = this;
	this.http = this.createRequestObject();
	
	var funcWait = null;
	var funcDone = null;
}

