var target = "";
var secondary = "";

function AJAX(input, output, afterglow)
{ 
try
{
	target = output;
	secondary = afterglow;

	xmlHttp = GetXmlHttpObject()

	if (xmlHttp == null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}

	xmlHttp.onreadystatechange = stateChanged;
	xmlHttp.open("GET", input, true);
	xmlHttp.send(null);
}
catch(e)
{
//	alert("AJAX: " + e);
}
}

function stateChanged() 
{
try
{
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
	{ 
		try 
		{

			var cmd = "document.all." + target + ".innerHTML = xmlHttp.responseText;";
			eval(cmd); 
		}
		catch(e)
		{ 
			document.getElementById(target).innerHTML = xmlHttp.responseText;
		}

		if(secondary != null)
		{
			eval(secondary);
		}
	} 
}
catch(e)
{
//	alert("stCh: " + e);
}
}

function GetXmlHttpObject()
{
	var xmlHttp = null;

	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp = new XMLHttpRequest();
	}
	catch (e)
	{
		//Internet Explorer
		try
		{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}

function LoadScript(scriptname)
{
	var script = document.createElement('script');
	script.type = 'text/javascript';
	script.src = scriptname;
	document.getElementsByTagName('head')[0].appendChild(script);
}

function ShowLogin()
{
	AJAX('loginbox.php', 'loginBox', null);
}
