//Load a new page of information.
function processChange(page_id, content_id)
{
	document.getElementById("ajaxfullcontents").innerHTML = "<div id='loadingpage'><p id='loadinganimation'><img src='images/loading.gif' alt='Loading' /></p></div>";
	var url="processajax.asp?page_id=" + escape(page_id) + "&content_id=" + escape(content_id);
	url=url+"&dummy="+new Date().getTime();
	request.open("GET", url, true);
	request.onreadystatechange=showConfirmation;
	request.send(null);
}
function showConfirmation()
{
	if (request.readyState == 4)
	{
		if (request.status == 200)
		{
			var response = request.responseText;
			//Find the data to be deleted on the page
			var list=document.getElementById("ajaxfullcontents");
			//Create some replacement text
			document.getElementById("ajaxfullcontents").innerHTML = response;
		}
		else
		{
			document.getElementById("ajaxfullcontents").innerHTML = "<p>There was a problem connecting to the server. Please wait a few moments and try loading the page again.</p>";
		}
	}
}

//Replace the information on the right of the page.
function halfChange(page_id, content_id)
{
	document.getElementById("rightcontents").innerHTML = "<div id='loadingarea'><p id='halfloadinganimation'><img src='images/loading.gif' alt='Loading' /></p></div>";
	var url="processajax.asp?page_id=" + escape(page_id) + "&content_id=" + escape(content_id);
	url=url+"&dummy="+new Date().getTime();
	request.open("GET", url, true);
	request.onreadystatechange=halfPage;
	request.send(null);
}
function halfPage()
{
	if (request.readyState == 4)
	{
		if (request.status == 200)
		{
			var response = request.responseText;
			//Find the data to be deleted on the page
			var list=document.getElementById("rightcontents");
			//Create some replacement text
			document.getElementById("rightcontents").innerHTML = response;
		}
		else
		{
			document.getElementById("rightcontents").innerHTML = "<p>There was a problem connecting to the server. Please wait a few moments and try loading the page again.</p>";
		}
	}
}

//Replace the information on the right of the page.
function smallChange(page_id, content_id)
{
	var url="processajax.asp?page_id=" + escape(page_id) + "&content_id=" + escape(content_id);
	url=url+"&dummy="+new Date().getTime();
	request.open("GET", url, true);
	request.onreadystatechange=smallPage;
	request.send(null);
}
function smallPage()
{
	if (request.readyState == 4)
	{
		if (request.status == 200)
		{
			var response = request.responseText;
			//Find the data to be deleted on the page
			var list=document.getElementById("smallblueinformation");
			//Create some replacement text
			document.getElementById("smallblueinformation").innerHTML = response;
		}
		else
		{
			document.getElementById("smallblueinformation").innerHTML = "<p>There was a problem connecting to the server. Please wait a few moments and try loading the page again.</p>";
		}
	}
}

//Replace the information on the right of the page.
function fleetChange(search)
{
	var url="fleetlist.asp?search=" + escape(search);
	url=url+"&dummy="+new Date().getTime();
	request.open("GET", url, true);
	request.onreadystatechange=fleetPage;
	request.send(null);
}
function fleetPage()
{
	if (request.readyState == 4)
	{
		if (request.status == 200)
		{
			var response = request.responseText;
			//Find the data to be deleted on the page
			var list=document.getElementById("rightcontents");
			//Create some replacement text
			document.getElementById("rightcontents").innerHTML = response;
		}
		else
		{
			document.getElementById("rightcontents").innerHTML = "<p>There was a problem connecting to the server. Please wait a few moments and try loading the page again.</p>";
		}
	}
}
//Replace the information on the right of the page.
function shipDetails(shipid)
{
	var url="shipdetails.asp?shipid=" + escape(shipid);
	url=url+"&dummy="+new Date().getTime();
	request.open("GET", url, true);
	request.onreadystatechange=shipInformation;
	request.send(null);
}
function shipInformation()
{
	if (request.readyState == 4)
	{
		if (request.status == 200)
		{
			var response = request.responseText;
			//Find the data to be deleted on the page
			var list=document.getElementById("leftcontents");
			//Create some replacement text
			document.getElementById("leftcontents").innerHTML = response;
		}
		else
		{
			document.getElementById("leftcontents").innerHTML = "<p>There was a problem connecting to the server. Please wait a few moments and try loading the page again.</p>";
		}
	}
}
