// Javascript
var ajax_file = new Class(
{
	asynchronous: false,
	connection : null,
	initialize : function()
	{
		if (window.XMLHttpRequest)
		{
			// code for IE7+, Firefox, Chrome, Opera, Safari
			this.connection = new XMLHttpRequest();
		}
		else if (window.ActiveXObject)
		{
			// code for IE6, IE5
			this.connection = new ActiveXObject("Microsoft.XMLHTTP");
		}
		else
		{
			alert("Your browser does not support XMLHTTP!");
		}		
	},
	
	get_content : function(url, params, command) 
	{		
		if (this.connection) 
		{			
			if(this.asynchronous)
			{				
				var my_connection = this.connection;
				
				this.connection.onreadystatechange=function()
				{					
					if(my_connection.readyState==4)
					{ 	
						my_response = my_connection.responseText;	
						eval(command); 
					}
				}
				
				this.connection.open("GET", url + "?" + params,true);
				return this.connection.send(null);
			}
			else
			{
				this.connection.open("GET", url + "?" + params, false);                             
				this.connection.send(null);
		
				return this.connection.responseText;
			}
		} 
		else 
		{
		     return false;
		}
	},
			
	post_content : function(url, params, command)
	{
		if (this.connection) 
		{
			if(this.asynchronous)
			{
				var my_connection = this.connection;
				
				this.connection.onreadystatechange=function()
				{					
					if(my_connection.readyState==4)
					{ 	
						my_response = my_connection.responseText;						
						eval(command); 
					}
				}				
				
				this.connection.open("POST", url, true);
				
				this.connection.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
				this.connection.setRequestHeader("Content-length", params.length);
				this.connection.setRequestHeader("Connection", "close");
				
				return this.connection.send(params);
			}
			else
			{
				this.connection.open("POST", url, false);   
				
				this.connection.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
				this.connection.setRequestHeader("Content-length", params.length);
				this.connection.setRequestHeader("Connection", "close");
				
				this.connection.send(params);
			
				return this.connection.responseText;      
			}
		} 
		else 
		{
		    return false;
		}
	}
});
