// JavaScript Document

var Ajax = {}
Ajax.xmlHttp = null;

Ajax.getXmlHttp = function()
{
	try
	{    this.xmlHttp = new XMLHttpRequest();	}// Firefox, Opera 8.0+, Safari
	catch (e)
	{    // Internet Explorer
		try
		{	this.xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");	}
		catch (e)
		{
			try
			{	this.xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");	}
			catch (e)
			{
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
}

Ajax.Request = function ( url , obj )
{
	this.getXmlHttp();
	
	var xh = this.xmlHttp

	this.xmlHttp.onreadystatechange = function()
    {
		if(xh.readyState == 4)
        {	
			if( obj.complete )obj.complete( xh );	
		}

    }

    this.xmlHttp.open( "GET" , url ,true);
    this.xmlHttp.send( null );
}

Ajax.PostRequest = function( url , param , obj )
{
	this.getXmlHttp();	
	var xh = this.xmlHttp
	
	this.xmlHttp.open("POST", url );

	this.xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	this.xmlHttp.send( param );	
	this.xmlHttp.onreadystatechange = function()
    {
		if(xh.readyState == 4)
        {	
			if( obj && obj.complete )obj.complete( xh );	
		}

    }
}

Ajax.formVariables = function( f )
{
	var param = "";
	for( x = 0 ; x < f.elements.length ; x++ )
	{
		param += "&"+f.elements[x].name+"="+f.elements[x].value;
	}
	return param;
}