/*
** Class Name	 : XmlHttpDataAdapter
** Parameters	 : 
**				   string : the XMLData parsed in the following Formate
**							<ListItem Value="">Text</ListItem>
** Depandancies  : it require the ListBox.js File
**
** Description	 : handle all functionality for ListBox Control
** Author		 : elhussein
*/
function XmlHttpDataAdapter()
{
	// Class Properties
	this.Method = "POST";
	this.Url;
	this.WaitingMessage = "Please Wait ...";
	this.ResponseText;	// Get Only
	
	// Overridable Methods
	this.OnWaiting;
	this.OnFinish;
	
	// Class Method
	// Send
	this.Send = function(){
		var objectRefrence = this;	// to avoid inner "this refrence" in the inner function xmlhttp.onreadystatechange

		var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		xmlhttp.open( this.Method , this.Url , true);
		xmlhttp.onreadystatechange = function(){
			if ( xmlhttp.readyState == 4 ){
				window.status = "";
				objectRefrence.ResponseText = xmlhttp.responseText;

				if( objectRefrence.OnFinish != null )
					objectRefrence.OnFinish();
			}else{
				window.status = objectRefrence.WaitingMessage;

				if( objectRefrence.OnWaiting != null )
					objectRefrence.OnWaiting();
			}
		}
		
		xmlhttp.send("");
	}
}

