function Ajax()
{
	 this.req =null;
	 this.url = null;
	 this.method ='GET';
	 this.async = true;
	 this.status = null;
	 this.statusText ='';
	 this.postData =null;
	 this.readyState = null;
	 this.responseText = null;
	 this.responseXML=null;
	 this.handleResp =null;
	 this.responseFormat ='text'; //
	 this.mimeType =null;
	
	  this.init =function()
		 {
			  if(!this.req)
				  {
					   try{
					   		this.req=new XMLHttpRequest();
					   	  }catch(e)
					   	  	{
						   	  	try
						   	  	{
						   	  	 this.req = new ActiveXObject('MSXML2.XMLHTTP');
						   	  	}
						   	  	catch(e)
							   	  	{
							   	  		try
							   	  		{
							   	  			this.req = new ActiveXObject('Microsoft.XMLHTTP');
							   	  		}
							   	  		catch(e)
							   	  		{
							   	  			return false;
							   	  		}
							   	    }
						   }
				  }
			  return this.req;
		 };
	this.doReq =function()
		 {
				if(!this.init())
				{
				 alert('failure');
				 return;
				}
				
				this.req.open(this.method,this.url,this.async);
				
				if(this.mimeType)
				{
				 	 try
				 	 {
				 	 	req.overrideMimeType(this.mimeType);
				 	 }
				 	 catch(e)
				 	 {
				 	  
				 	  alert('hi');
				 	 }
				 
				}
				
				var self =this;
			
					this.req.onreadystatechange=function()
						{
						   var resp =null;
							if(self.req.readyState==4)
								{
								
								
									switch(self.responseFormat)
										{
											case 'text':
												resp = self.req.responseText;
												break;
											case 'xml':
												resp = self.req.responseXML;
												break;
											case 'object':
												 resp = req;
											     break;
										

										}
										if(self.req.status>=200&&self.req.status<=299)
										{
											self.handleResp(resp);
										}
										else
										{
											 self.handleErr(resp);
										}
								}
						};
					
				this.req.send(this.postData);
				
		 };
	this.handleErr =function()
		{
				var errorWin;
				try
				{
					errorWin = window.open('','errorWin');
					errorWin.document.body.innerHTML= this.responseText;
				
				}
				catch(e)
				{
					alert(' an error occured');
				}
		};
	this.setHandlerBoth =function(funcRef)
		{
		   this.handleResp = funcRef;
		   this.handleErr = funcRef;
		   
		};
	this.doGet = function(url,hand,format)
		{
			
			this.url =url;
			this.handleResp = hand;
			alert(hand);
			this.responseFormat = format||'text';
			 
			this.doReq();
		};
	
}
