function ConnectToServer()
{
		
	try {
		  this.objectActivex = new ActiveXObject("Msxml2.XMLHTTP");
		}
		 catch (e) 
		{
			try {
				this.objectActivex = new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e2) 
				{
				this.objectActivex = false;
				}	
		}
	if(!this.objectActivex && typeof XMLHttpRequest != 'undefined')
	{
	  this.objectActivex = new XMLHttpRequest();
	}
	this.url;
	this.content;
	this.goAndDo=xgoAndDo;
	this.display=responseDisplay;
	this.goAndDoSync=xgoAndDoSync;
	this.x_custom_function='';
	
}
function ConnectToServer(url,content,custom_function)
{
	try {
		  this.objectActivex = new ActiveXObject("Msxml2.XMLHTTP");
		}
		 catch (e) 
		{
			try {
				this.objectActivex = new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e2) 
				{
				this.objectActivex = false;
				}	
		}
	if(!this.objectActivex && typeof XMLHttpRequest != 'undefined')
	{
	  this.objectActivex = new XMLHttpRequest();
	}	
	this.url=url;
	this.content=content;
	this.goAndDo=xgoAndDo;
	this.goAndDoSync=xgoAndDoSync;
	this.display=responseDisplay;
	if(ConnectToServer.arguments.length<=2)
	{
		this.x_custom_function='';
	}
	else
	{
		this.x_custom_function=custom_function;
	}
}

function xgoAndDo()
{
	try
	{
	this.objectActivex.open("GET",this.url,true);
	}
	catch(e)
	{
	alert(e.description)	
	}
	var x=this;

	this.objectActivex.onreadystatechange = function(){x.display()};
	this.objectActivex.send(null);
	//alert(this.content);
}
function xgoAndDoSync()
{
	try
	{
	this.objectActivex.open("GET",this.url,false);
	}
	catch(e)
	{
	alert(e.description)	
	}
	this.objectActivex.send(null);
	var httpStatus;
	try 
	 { 	if(this.objectActivex.status !== 'undefined' && this.objectActivex.status != 0)
		{    httpStatus = this.objectActivex.status;                } 
		else
		{  httpStatus = 13030;} //some custom code especially for some mozilla browsers } 
	 } 
	 catch(e){ httpStatus = 13030; } //some custom code especially for some mozilla browsers   } 
	 if(httpStatus != 200 || httpStatus==13030) 
	 {
		alert(" You could not connect to requested page !\n * The page may not be found or Your internet connection is lost! ")	 
		return;
	 }
	if(httpStatus==200)
	{
		var response=this.objectActivex.responseText;
	
		try	{ document.getElementById(this.content).innerHTML=response;	}catch(e){};
		try
		{
			closeLoadingImage();
		}
		catch(e){};
		if(typeof this.x_custom_function!='undefined' && this.x_custom_function!='')
		{
			this.x_custom_function(response);
		}
	}
}
function responseDisplay()
{
	
	if(this.objectActivex.readyState==4)
	{
		var httpStatus;
		try 
		 { 	if(this.objectActivex.status !== 'undefined' && this.objectActivex.status != 0)
			{    httpStatus = this.objectActivex.status;                } 
			else
			{  httpStatus = 13030;} //some custom code especially for some mozilla browsers } 
		 } 
		 catch(e)
		 {
			 httpStatus = 13030; 
			 
		 } //some custom code especially for some mozilla browsers   } 
		if(httpStatus != 200 || httpStatus==13030) 
		{
		alert(" You could not connect to requested page !\n * The page may not be found or Your internet connection is lost! ")	 
		return;
		}
		if(httpStatus==200)
		{
				var response=this.objectActivex.responseText;
				if(this.content!='')
				{
					try	{ document.getElementById(this.content).innerHTML=response;	}catch(e){};
				}
				try
				{
					closeLoadingStatusDiv();
				}catch(e){};
				if(typeof this.x_custom_function!='undefined' && this.x_custom_function!='' )
				{
					this.x_custom_function(response);
					
				}
		}
	}
	//alert(response);  
}

