jpc2006 = new Object();
jpc2006.xmlhttp = null;
jpc2006.current = "";

jpc2006.load = function( lib )
{
    if( this.current )
    {
	
    }
}

jpc2006.request = function( file, param )
{
	if( jpc2006.xmlhttp )
	{
		alert( "Connection busy" );
		return;
	}
	
	//FIXME check if file has an extension or not
	file += ".pl";
	
	if ( window.XMLHttpRequest )
	{
		jpc2006.xmlhttp = new XMLHttpRequest();
	}
	else if ( window.ActiveXObject )
	{
		jpc2006.xmlhttp = new ActiveXObject( "Microsoft.XMLHTTP" );
	}
	
	if( jpc2006.xmlhttp )
	{
		jpc2006.xmlhttp.onreadystatechange = jpc2006.process;
		jpc2006.xmlhttp.open( "POST",  file, true );
		jpc2006.xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		jpc2006.xmlhttp.send( param );
	}
	else
	{
		alert( "Remote asynchronous request not supported by your browser" );
	}
}

jpc2006.process = function()
{
	if ( jpc2006.xmlhttp.readyState == 4 )
	{
		if ( jpc2006.xmlhttp.status == 200 )
		{
			eval( jpc2006.xmlhttp.responseText );
			jpc2006.xmlhttp = null;
		}
		else
		{
			alert( "Problems receiving data:" + jpc2006.xmlhttp.statusText );
		}
	}
}
