function treeMove(node, oLink, level, prefix)
{
	if (node != '')
	{
		nodetest = document.getElementById('inner_'+node);
		if (nodetest.innerHTML != '')
		{
			// HIDE NODE
			oLink.childNodes[0].src = "/site_images/sitemap/plus.gif";
			nodetest.innerHTML = '';
		}
		else 
		{
			// SHOW NODE
			oLink.childNodes[0].src = "/site_images/sitemap/minus.gif";
			fnAjaxRequest_sitemapBranch('inner_'+node, 'prefix='+prefix+'&fromPage='+node+'&level='+level);
		}
	}
}


var ieversion = ['Msxml2.XMLHTTP.5.0','Msxml2.XMLHTTP.4.0', 'Msxml2.XMLHTTP.3.0','Msxml2.XMLHTTP', 'Microsoft.XMLHTTP']; 
var oXMLObj_sitemapBranch = false;
for(var i=0; !oXMLObj_sitemapBranch && i<ieversion.length; i++) 
{ 
	try{ oXMLObj_sitemapBranch = new ActiveXObject(ieversion[i]); } catch(e) { oXMLObj_sitemapBranch = false; }
};

var sResponseElement_sitemapBranch;

function fnAjaxRequest_sitemapBranch(sResponseElement, sQueryString)
{
	oXMLObj_sitemapBranch.open('GET', '/sitemap.aspx?' + sQueryString, true);
	oXMLObj_sitemapBranch.onreadystatechange=fnAjaxResponse_sitemapBranch;
	sResponseElement_sitemapBranch = sResponseElement;
	oXMLObj_sitemapBranch.send('');
} 

function fnAjaxResponse_sitemapBranch() 
{
	if (oXMLObj_sitemapBranch.readyState==4) 
	{
		if (!document.getElementById(sResponseElement_sitemapBranch)) 
		{
			//alert('AJAX Error : AJAX_GetCodeBlock requires element <DIV id="'+sResponseElement_sitemapBranch+'"> in your HTML.');
		}
		document.getElementById(sResponseElement_sitemapBranch).innerHTML=oXMLObj_sitemapBranch.responseText;
	} 
	else 
	{
		document.getElementById(sResponseElement_sitemapBranch).innerHTML='<br />Loading ...';
	}
}

function DisplaySearchBox()
{
	// Do NOT pass through the "__VIEWSTATE" variable...(terminate the initial form)
	document.write('</form>');	// Terminate the .NET form

	// Create the search fragment form...
	document.write('<form method="post" action="http://search.rochdale.gov.uk/scripts/semaphoreserver.exe">');
	document.write('<label for="simplesearch">Search:</label>');
	document.write('<input type="text" class="text" name="QUERY00" onfocus="if (this.value == \'Enter search\') this.value = \'\';" onkeydown="return doSearch(this.form);" id="simplesearch" size="10" value="Enter search" />');
	document.write('<input type="hidden" name="SAVEDB" value="rochdale" />');
	document.write('<input type="hidden" name="ORGANISE_CODED" value=":f9" />');
	document.write('<input type="hidden" name="STYPE" value="simple" />');
	document.write('<input type="image" class="Button" id="btnSearch" onClick="this.form.submit();" title="Search the Rochdale website" src="/site_images/btn_go.gif" />');
	document.write('</form>');

	// In case there is anything after this that needs to be processed by .NET...
	// (use same definition from initial form fragment)
	document.write('<form method="' + document.forms[0].method + '" action="' + document.forms[0].action + '" id="' + document.forms[0].id + '">');
	document.write('<input type="hidden" name="__VIEWSTATE" value="' + document.forms[0].__VIEWSTATE.value + '">');
}

function doSearch(me)
{
	if (event.keyCode==13)
	{
		me.submit();
		return false;
	}
}
