function jsAJAX(URL, AJAXName){
	//Defult Types
	this.URL = URL;
	this.method = 'POST';
	this.aSync = false;
	this.param = 'AJAX='+escape(AJAXName);
	this.targetDIV = null;
	this.output=null;
	this.reqHeadCdef = "Content-Type";
	this.reqHeadCval = "application/x-www-form-urlencoded";
	//methods
	//addParam: build parameter string
	this.addParam = function(k,v) {
	if (this.param==''){
		this.param = '?';
	}else{
		this.param = this.param + '&';
	}
		this.param = this.param + k + '=';
		this.param = this.param + encodeURIComponent(v);
	};
	//doAJAX: send request and handle return
	this.doAJAX = function (x){
		x = x || null;
		this.hReq = SetAJAXObject();
		this.hReq.open(this.method, this.URL, this.aSync);
		this.hReq.setRequestHeader(this.reqHeadCdef, this.reqHeadCval);
		this.hReq.send(this.param);
		if (x=='x'){ 
			if(this.output = this.hReq.responseXML){
				return true;
			}else{
				return false;
			}
		}else{
			this.output = this.hReq.responseText;
			if (String(this.output).substring(0,12)=="[AJAX ERROR]"){
				alert(String(this.output).substring(12));		
				return false;
			} else {
				if (this.targetDIV&&document.getElementById(this.targetDIV)) {
					document.getElementById(this.targetDIV).innerHTML=this.output;
				}
				return true;
			}
		}
	};
} 

function SetAJAXObject(){
	var httpRequest;
		if (window.XMLHttpRequest) { // Mozilla, Safari, ...
		httpRequest = new XMLHttpRequest();
		if (httpRequest.overrideMimeType) {
			httpRequest.overrideMimeType("text/xml");	
		}
	} else if (window.ActiveXObject) { // IE
		try {
			httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) {
		try {
		httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch (e) {}
		}
	 }
	if (httpRequest) {
		return httpRequest;
	}else{
		alert("Giving up :( Cannot create an XMLHTTP instance");
		return false;
	}
}


function stripslashes(str) {
	str=str.replace(/\\'/g,'\'');
	str=str.replace(/\\"/g,'"');
	str=str.replace(/\\0/g,'\0');
	str=str.replace(/\\\\/g,'\\');
	return str;
}

function proper(str) {
	var TempProper, c, OldC, Mac, NewC;
	OldC = " ";
	TempProper = ""
	
	str=str.toString().toLowerCase();
	while(str.match("  ")){
		str=str.replace(/  /," ");
	}
	
	if(str.substr(0,1)==" "){
		str = str.substr(1);
	}
	if(str.substr(str.length-1,1)==" "){
		str = str.substr(0,str.length-1);
	}
	
	for(i=0;i<str.length;i++){
		c = str.substr(i, 1);
		NewC = str.substr(i + 1, 1);
		if(c=="s" && OldC=="'" && NewC.match(/[^a-z]/)){
			TempProper=TempProper+c;
		}else if( c.match(/[a-z]/) && OldC.match(/[^a-z0-9]/)!=null){
			TempProper=TempProper+(c.toUpperCase());
		}else{
			TempProper=TempProper+c;
		}
	OldC = c;
	}
	
	if(TempProper.substr(0,2)=="Mc") {
  	TempProper = "Mc" + proper(TempProper.substr(2))
  }
	Mac=TempProper.indexOf(TempProper.match(/[^a-zA-Z]Mc/));
	if(Mac>0){
		TempProper=TempProper.substr(0,Mac)+TempProper.match(/[^a-zA-Z]Mc/)+proper(TempProper.substr(Mac+3));
	}
	TempProper=TempProper.replace("Van Der ","Van der ");
	TempProper=TempProper.replace(" Von "," von ");
	if (TempProper.substr(0,4)=="Von "){
		TempProper="v"+TempProper.substr(1);
	}
	
	
	return TempProper;
}


