function sidebar(title) {
document.write("<link rel='stylesheet' type='text/css' href='/style.css'/>")
document.write("<table>");
document.write("<tr><td width=125 valign=top>");
var rootURL= "/";

//var sendrequest = new XMLHttpRequest();

if (typeof ActiveXObject != 'undefined') {
	var sendrequest = new ActiveXObject('Microsoft.XMLHTTP');
}
else if (typeof XMLHttpRequest != 'undefined') {
	var sendrequest = new XMLHttpRequest();
}

sendrequest.open ("POST", "/adverts/randomadvert.php", false);

var sendStr = '<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>';
sendrequest.send(sendStr);
//document.write(sendrequest.responseText);
//alert(sendrequest.responseText);

var xmlDocument = sendrequest.responseXML;

var advertPath = xmlDocument.getElementsByTagName("advertPath")[0].childNodes[0].nodeValue;
var advertURL = xmlDocument.getElementsByTagName("advertURL")[0].childNodes[0].nodeValue;
//var advertPath ="pishpath";
//var advertURL ="pish";

document.write("<a href=\"" + advertURL + "\" target=\"_new\"><img src=\"" + advertPath + "\" border=\"0\"></a>");

document.write("<TABLE width=100%>");
AddMenuItem("home", "Home", rootURL + "home.html");
AddMenuItem("businesses", "Businesses", rootURL + "businesses/businesses.html");
AddMenuItem("images", "Images", rootURL + "images/imagesearch.php");
AddMenuItem("history", "History", rootURL + "history/history.html");
AddMenuItem("organisations", "Organisations", rootURL + "organisations/organisations.html");
AddMenuItem("communitycouncil", "Community Council", rootURL + "communitycouncil/cchome.html");
AddMenuItem("theblane", "The Blane", rootURL + "theblane/theblane.html");
AddMenuItem("whatson", "What's On", rootURL + "whatson.html");
AddMenuItem("greenheart", "Greenheart", rootURL + "greenheart/greenheart.html");
AddMenuItem("cdt", "CDT", rootURL + "cdt/cdt.html");
AddMenuItem("carbonneutral", "Carbon Neutral", rootURL + "carbonneutral/carbonneutral.html");
AddMenuItem("localwalks", "Local Walks", rootURL + "localwalks/localwalks.html");
AddMenuItem("localinformation", "Local Information", rootURL + "localinformation.html");
AddMenuItem("travel", "Travel", rootURL + "travel/travel.html");
AddMenuItem("miscellaneous", "Miscellaneous", rootURL + "miscellaneous/miscellaneous.html");
AddMenuItem("links", "Links", rootURL + "links.html");
document.write("</TABLE>");
document.write("</td>");
document.write("<td valign=top width=675>");
} //end function sidebar

function AddMenuItem(Location, Description, URL)
{
	if(document.location.href.search("/" + Location) != -1)
	{
		document.write("<TR><TD  class='sidebarselected' onclick='document.location.href=\"" + URL + "\"'>" + Description + "</TD></TR>");
	} else {
		document.write("<TR><TD class='sidebar' onclick='document.location.href=\"" + URL + "\"'>" + Description + "</a></TD></TR>");
	}
}//end function AddMenuItem