/*********************************************************
 * ajax module
 */
var ajax = function(objname)
{
	this.objname = objname;
	this.req;
	this.debug_mode = false;

	this.loadXMLDoc = function(url) {

		this.req = false;
		if (window.XMLHttpRequest) {
			try {
				this.req = new XMLHttpRequest();
			}
			catch(e) {
				this.req = false;
			}

		} else if (window.ActiveXObject) {
			try {
				this.req = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e) {
				try {
					this.req = new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch(e) {
					this.req = false;
				}
			}

		}
		if (this.req) {
			var str = ''; str += 'function(){\n';
			str += ' if('+this.objname+'.req.readyState == 4){\n';
			str += '  if('+this.debug_mode+'){\n';
			str += '    document.write('+this.objname+'.req.responseText);\n';
			str += '  }\n';
			str += '  eval('+this.objname+'.req.responseText);\n';
			//          str += '  alert('+ this.objname +'.req.responseText);';
			str += ' }\n';
			str += '}';

			eval(this.objname+ '.getdata = ' + str);
			this.req.onreadystatechange = this.getdata;

			this.req.open("GET", url, true);
			this.req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
			this.req.send("");
		}
	}
		this.loadXMLDocPost = function(url, queryString) {
			this.req = false;
			if (window.XMLHttpRequest) {
				try {
					this.req = new XMLHttpRequest();
				}
				catch(e) {
					this.req = false;
				}
			}
			else if (window.ActiveXObject) {
				try {
					this.req = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e) {
					try {
						this.req = new ActiveXObject("Microsoft.XMLHTTP");
					}
					catch(e) {
						this.req = false;
					}
				}
			}
			if (this.req) {
				this.req.open("POST", url, true);
				var str = ''; str += 'function(){\n';
				str += ' if('+this.objname+'.req.readyState == 4){\n';
				str += '  if('+this.debug_mode+'){\n';
				str += '    document.write('+this.objname+'.req.responseText);\n';
				str += '  }\n';
				str += '  eval('+this.objname+'.req.responseText);\n';
				//          str += '  alert('+ this.objname +'.req.responseText);';
				str += ' }\n';
				str += '}';

				eval(this.objname+ '.getdata = ' + str);
				this.req.onreadystatechange = this.getdata;
				this.req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; Charset=utf-8");
				this.req.send(queryString);
			}
		}
	}


