GetRequest = Class.create();
GetRequest.prototype = {
   initialize: function(options) {
   this.options = {
	url: document.URL,
	func: false
	};
	Object.extend (this.options, options || {});
      this.url = this.options.url;
      this.func = this.options.func;
      this.request = false;
   },
   send: function(params){
   	this.request = false;
   	this.request = this.request;
	var page = '' + this.url+'?'+params;
	if(window.XMLHttpRequest)
	{
		try {
			this.request = new XMLHttpRequest();

		}catch (e){
			this.request = false;
		}
	}
	else if(window.ActiveXObject)
	{
		try
		{
			this.request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try
			{
				this.request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				this.request = false;
			}
		}
	}
	if(!this.request)
	{
		//alert('Error: could not create XMLHTTP object.');
		return false;
	}

	this.request.onreadystatechange = this.onResponse.bind(this);
	this.request.open('GET', page, true);
	this.request.send("");
   },
   onResponse:function(){
	   	if (this.request)
		if(this.request.readyState == 4)
		{
			if(this.request.status == 200)
			{
				if(this.func)
				this.func(this.request.responseText);
	//window.setTimeout("requestajax()", 700);
			}
			else
			{
				//alert('Error: got a not-OK status code...\\ncode : '+ this.request.status +' Code Text :' +this.request.statusText +'\\n Received data :' + this.request.responseText);
			}
		}
	}
};

/**
 * POST REQUEST
 *
 */

PostRequest = Class.create();
PostRequest.prototype = {
   initialize: function(options) {
   this.options = {
	url: document.URL,
	func: false
	};
	Object.extend (this.options, options || {});
      this.url = this.options.url;
      this.func = this.options.func;
      this.request = false;
   },
   send: function(params){
   	this.params = params;
   	this.request = false;
   	this.request = this.request;
	if(window.XMLHttpRequest)
	{
		try {
			this.request = new XMLHttpRequest();

		}catch (e){
			this.request = false;
		}
	}
	else if(window.ActiveXObject)
	{
		try
		{
			this.request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try
			{
				this.request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				this.request = false;
			}
		}
	}
	if(!this.request)
	{
		alert('Error: could not create XMLHTTP object.');
		return false;
	}

	this.request.onreadystatechange = this.onResponse.bind(this);
	this.request.open('post',  this.url, true);
	this.request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
	this.request.setRequestHeader("Content-length", this.params.length);
	this.request.setRequestHeader("Connection", "close");
	this.request.send(this.params);
   },
   onResponse:function(){
   		if (this.request)
		if(this.request.readyState == 4)
		{
			if(this.request.status == 200)
			{
				if(this.func)
				this.func(this.request.responseText);
	//window.setTimeout("requestajax()", 700);
			}
			else
			{
				alert('Error: got a not-OK status code...\\ncode : '+ this.request.status +' Code Text :' +this.request.statusText +'\\n Received data :' + this.request.responseText);
			}
		}
	}
};