//var strSiteUrl = 'http://dev01/Strategy/';
var strSiteUrl = 'http://www.src.co.nz/';

var arrMenu = new Array(0);
var arrMenuCount = 0;

function addMenuItem(strText, strUrl, strTarget)
{
	var arrMenuItem = new Array(3);
	
	arrMenuItem[0] = strText;
	arrMenuItem[1] = strUrl;
	arrMenuItem[2] = strTarget;
		
	arrMenu[arrMenu.length] = arrMenuItem;
}

function buildMenu()
{
	var intCount;
	var strRequestUrl = new String(document.location.href);
	
	// Strip request URL of any query string parameters.
	var intPos = strRequestUrl.indexOf('?');
	
	if (intPos > -1)
		strRequestUrl = strRequestUrl.substring(0, intPos);
	
	var strMenu = '<table width="174" border="0" cellspacing="0" cellpadding="0">\n';
	strMenu += '<tr>\n<td width="142" height="15">&nbsp;</td>\n';
	strMenu += '<td width="32" height="15">&nbsp;</td>\n</tr>\n';

	for (intCount = 1; intCount <= arrMenu.length; intCount++)
	{			
		strMenuText   = arrMenu[intCount - 1][0];
		strMenuUrl    = arrMenu[intCount - 1][1];
		strMenuTarget = arrMenu[intCount - 1][2];

		strMenu += '<tr>\n';
		strMenu += '<td width="142" align="right">';
		strMenu += '<a href="' + strSiteUrl + strMenuUrl + '" target="' + strMenuTarget + '">' + strMenuText + '</a></td>\n';
		
		if ((strMenuUrl == 'Search.aspx') &&
			((strRequestUrl == (strSiteUrl + "SearchResults.aspx")) ||
			 (strRequestUrl == (strSiteUrl + "JobSpec.aspx")) ||
			 (strRequestUrl == (strSiteUrl + "Apply.aspx"))))
		{
			strMenu += '<td width="32" height="22"><img src="' + strSiteUrl + 'Images/circle.gif" width="32" height="22"></td>\n';
			
			if (strRequestUrl != (strSiteUrl + "Apply.aspx"))
				strMenu += '<tr><td width="142" align="right"><a href="Search.aspx"><img src="Images/new_search.gif" border="0"></a>&nbsp;&nbsp;&nbsp;&nbsp;</td>\n</tr>';
		}
		else
		{
			if ((strRequestUrl == (strSiteUrl + strMenuUrl)) ||
				((strRequestUrl == strSiteUrl) && (strMenuUrl == 'Default.aspx')))
				strImage = 'circle.gif';
			else
				strImage = 'spacer.gif';
		
			strMenu += '<td width="32" height="22"><img src="' + strSiteUrl + 'Images/' + strImage + '" width="32" height="22"></td>\n';
		}
		
		strMenu += '</tr>\n';
	}
	
	strMenu += '</table>\n';
	document.write(strMenu);
}

// ****************************************************************************************
// ADD MENU ITEMS HERE!
addMenuItem('Home',               'Default.aspx',      '_self');
addMenuItem('Services',           'Services.aspx',     '_self');
addMenuItem('Search for jobs',    'Search.aspx',       '_self');
//addMenuItem('Permanent Admin Roles',    'PermRoles.aspx',   '_self');
addMenuItem('Contact Us',         'ContactUs.aspx',    '_self');
addMenuItem('Time Sheets',        'Time_Sheet.aspx',   '_self');
addMenuItem('About Strategy',     'About.aspx',        '_self');
//addMenuItem('Why Use an Agency?', 'Recruitment.aspx', '_self');
// End add menu items.
// ****************************************************************************************