	/**************************************************
	This is a simple JS file which handles the ajax 
	calls made as a part of the the chat function
	**************************************************/
	var xmlhttp;
	
	function createAjaxObject()
	{
		if(window.XMLHttpRequest)
		{
    		try 
			{
				xmlhttp = new XMLHttpRequest();
				xmlhttp.overrideMimeType('text/xml');
        	} 
			catch(e)
			{
				//xmlhttp = false;
				//May be IE7 simulation....
				try
				{
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				} 
				catch(e) 
				{
					
					xmlhttp = false;
				}
			}
	    // branch for IE/Windows ActiveX version
		} 
		else if(window.ActiveXObject)
		{
			try 
			{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch(e)
			{
				try
				{
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				} 
				catch(e) 
				{
					
					xmlhttp = false;
				}
			}
		}
		else
		{
			//This definitely is IE7 issue
			try
			{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch(e) 
			{
				
				xmlhttp = false;
			}
		}
		//alert("HA HA HA HA Ha");
	}
	
	
	function post_msg_to_srv(path, poststr)
	{
		//var xmlhttp;
		//Create the ajax object
		createAjaxObject();
		
		//Make a call to the server
		//alert(path);
		xmlhttp.open("POST", path, true); 
		xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xmlhttp.send(poststr);
		xmlhttp.onreadystatechange = function() 
		{ 
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) 
			{
				//Do nothing because we are not outputting anything here
				//element.innerHTML = xmlhttp.responseText;
			} 
		}
		//xmlhttp = null;
	}
	
	function get_msg_array(path)
	{
		//var xmlhttp;
		var retVal;
		//Create the ajax object
		createAjaxObject();
		
		//Make a call to the server
		//alert(path);
		xmlhttp.open("GET", path); 
		xmlhttp.onreadystatechange = function() 
		{ 
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) 
			{
				retVal = xmlhttp.responseText;
				//alert(retVal);
				//Executes the array in the client side
				msg_arr = new Array();
				eval(retVal);
			} 
		} 

		xmlhttp.send(null);
		//xmlhttp = null;
	}
	
	//The following function is just a simple AJAX call to the server for general purpose
	function send_request_to_server(path, poststr)
	{
		//alert(poststr);
		//var xmlhttp;
		//Create the ajax object
		createAjaxObject();
		
		//Make a call to the server
		xmlhttp.open("POST", path, true); 
		xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xmlhttp.send(poststr);
		xmlhttp.onreadystatechange = function() 
		{ 
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) 
			{
				//Do nothing because we are not outputting anything here
				//element.innerHTML = xmlhttp.responseText;
			} 
		}
		//xmlhttp = null;
	}
	
	//The following function returns pure javascript from the server and executes it in the current context
	function getJSFromServer(path, poststr, show_alert)
	{
		show_alert = show_alert || false;
		//var xmlhttp;
		var retVal;
		//Create the ajax object
		createAjaxObject();
		
		//Make a call to the server
		xmlhttp.open("POST", path); 
		xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xmlhttp.send(poststr);
		xmlhttp.onreadystatechange = function() 
		{ 
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) 
			{
				retVal = xmlhttp.responseText;
				if(show_alert)
				{
					alert(retVal);
				}
				if(retVal != "")
				{
					eval(retVal);
				}
			} 
		}
	}