function getData(filename)
{
	var readerobj;
	
	readerobj = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
	readerobj.open("GET", filename, false);
	readerobj.send();
	return readerobj.responseText;
	
}

function showMenu(address)
{
	var txtDoc;					// initial direct file input
	var txtTemp = new Array();	// array used to temporarily hold items while parsing splits
	var txtArray = new Array();	// array used to assemble the final output
	var i, g;					// iteration integers
	
	txtDoc = getData("turkey_swamp_top.menu");
	txtDoc = txtDoc.split("@");
	
	g = 0;
	for (i = 0; i < txtDoc.length; i++) 
	{
		txtTemp = txtDoc[i];
		txtTemp = txtTemp.split("|");
		txtArray[g] = txtTemp[0];
		g++;
		txtArray[g] = txtTemp[1];
		g++;
	}
	
	document.writeln("<div id=\"menu\">");
	document.writeln("<ul>");
	
	g = 1;
	for (i = 0; i < txtArray.length; i++) 
	{
		document.writeln("<li>");
		if (txtArray[g] == address)
		{
			document.writeln("<a id='selected' href='" + txtArray[g] + "'>" + txtArray[i] + "</a>");
		}
		else
		{
			document.writeln("<a href='" + txtArray[g] + "'>" + txtArray[i] + "</a>");
		}	
		document.writeln("</li>");
		i++;
		g = g + 2;
	}
	
	document.writeln("</ul></div>");
}	

function showLinks()
{
	var txtDoc;					// initial direct file input
	var txtTemp = new Array();	// array used to temporarily hold items while parsing splits
	var txtArray = new Array();	// array used to assemble the final output
	var i, g;					// iteration integers
	
	txtDoc = getData("turkey_swamp_links.menu");
	txtDoc = txtDoc.split("@");
	
	g = 0;
	for (i = 0; i < txtDoc.length; i++) 
	{
		txtTemp = txtDoc[i];
		txtTemp = txtTemp.split("|");
		txtArray[g] = txtTemp[0];
		g++;
		txtArray[g] = txtTemp[1];
		g++;
	}
	
	document.writeln("<ul>");
	
	g = 1;
	for (i = 0; i < txtArray.length; i++) 
	{
		document.writeln("<li>");
		document.writeln("<a href='javascript:void(0);' onclick='window.open(\"" + txtArray[g] + "\");'>" + txtArray[i] + "</a>");
		document.writeln("</li>");
		i++;
		g = g + 2;
	}
	
	document.writeln("</ul>");
}	

function showUpdates()
{
	var txtDoc;
	var i;
	
	txtDoc = getData("turkey_swamp_updates.menu");
	txtDoc = txtDoc.split("|");
	
	for (i = 0; i < txtDoc.length; i++)
	{
		document.writeln(txtDoc[i]);
	}
	
}

function showOther()
{
	var txtDoc;
	var i;
	
	txtDoc = getData("turkey_swamp_other.menu");
	txtDoc = txtDoc.split("|");
	
	for (i = 0; i < txtDoc.length; i++)
	{
		document.writeln(txtDoc[i]);
	}	
}

