// FUNCTIONS TO CREATE NAVIGATION LINKS W/ YELLOW BUTTON

function sideBarLinkWithSpace(labelText, url, line) {
	var doc = document.forms[0];

	document.writeln("<tr>");
	if (line < 1 ) line = 1;
	pheight= (line + 1 ) * 13;
	document.writeln("  <td width='10' height='" + pheight + "' class='sideMenu'>");
	document.writeln("  </td>");
	document.writeln("  <td width='180' class='sideMenu'>");
	document.writeln("    <a href=\"" + url + "\" onMouseOver=\"window.status='" + labelText + "';return true\" onMouseOut=\"window.status='';return true\">");
	document.writeln(      labelText);
	document.writeln("    </a>");
	document.writeln("  </td>");
	document.writeln("</tr>");
}

function sideBarCheckWithSpace(labelText, line) {

	document.writeln("<tr>");
	document.writeln("  <td height='2' colspan='2' >");
	document.writeln("  </td>");
	document.writeln("<tr>")
	if (line < 1 ) line = 1;
	pheight= (line + 1 ) * 13;
	document.writeln("  <td width='10' height='" + pheight + "' class='sideMenu'>");
	document.writeln("  </td>")
	document.writeln("  <td width='180' class='sideMenuBold'>")
	document.writeln(   labelText)
	document.writeln("  </td>")
	document.writeln("</tr>")
}

function buildSideBarLinks() {

	var doc = document.forms[0];	
	// if this person is a mail user, add the My Organizer link
	var eMail = doc.DispEmail.value;
	if ( eMail != "No" ) {
		// user has mail; send the sideBarLink() method the My Organizer
		var mailRealm = doc.MailRealm.value;
		var mailPath = doc.MailFile.value;
		var mailURL = "/" + mailRealm + "/" + mailPath + "/myOrganizer?OpenForm";
		sideBarLink("My Organizer", mailURL, 1);
	}
	// get the SideBarLinks field, which will have all of the menu items in the format
	// Title~URL*Title~URL*Title~URL
	var linkText = doc.SideBarLinks.value;
	
	// explode into an array of title/url string pairs
	var linkArray = linkText.split("*");
	
	// loop through the linkArray and pass data to the sideBarLink function
	for ( i=0; i < linkArray.length; i++ ) {
		dataArray = linkArray[i].split("~");
		linkTitle = dataArray[0];
		linkURL = dataArray[1];
		sideBarLink(linkTitle, linkURL, (i + 1));
	}
	
}

function sideBarLink(labelText, url, linkNum) {
	var doc = document.forms[0];

	document.writeln("<tr>");
	document.writeln("  <td width='10' height='26' class='sideMenu'>");
	document.writeln("  </td>");
	document.writeln("  <td width='180' class='sideMenu'>");
	document.writeln("    <a href=\"" + url + "\" onMouseOver=\"window.status='" + labelText + "';return true\" onMouseOut=\"window.status='';return true\">");
	document.writeln(      labelText);
	document.writeln("    </a>");
	document.writeln("  </td>");
	document.writeln("</tr>");
}

function sideBarCheck(labelText) {

	document.writeln("<tr>")
	document.writeln("  <td width='10' height='26' class='sideMenu'>")
	document.writeln("  </td>")
	document.writeln("  <td width='180' class='sideMenuBold'>")
	document.writeln(   labelText)
	document.writeln("  </td>")
	document.writeln("</tr>")
}