//////////////////////////////////////////////////////////////
//
// Use the 'navBuilder' object in the function 'initCustomNodes'
//   to add/remove/modify navigation nodes. The methods in the
//   'navBuilder' object are defined in the file 'common.js'.
//   examples of how to use the object are in 'commonNav.js'
//
// If you are writing a component, you should not modify this file.
//   Instead, override the include 'custom_finish_layout_init' with
//   the 'super' tag, and modify the 'navBuilder' object there.
//
//////////////////////////////////////////////////////////////

function initCustomNodes(navBuilder)
{

	//***** ADDING NODES *************************************
	/* Two methods exist for adding new xml nodes to the navigation hierarchy:
			navBuilder.addPrevSiblingNodeTo(siblingId, newNodeName, [attr1, attr2, ...]), and
			navBuilder.addChildNodeTo(collectionId, newNodeName, [attr1, attr2, ...]) */
	/* The first argument is the ID of the related element, the second argument is the tag name
		of the new element being created (either 'item' or 'collection'), and the following arguments
		are name/value pairs that define the attributes of the new element. Each element must contain
		at least the follwing attributes: id, label, and url; additional optional attributes may be
		added as necessary for the layout. */

	navBuilder.addChildNodeTo(
		"NAVTREE",
		"collection",
		"id==SEARCH_TRAY",
		"label==" + lc("wwSearch"),
		"url==",
		"tray_doc==" + httpLayoutRoot + "search_tray_tabs.htm");

	/* This collection node was added to use in place of the standard LIBRARY node. It's used in conjunction
		with collection_service and associated functions in layout.js to dynamically insert library
		items into nav tree as nodes are clicked. The collection_service URL is called when node icons are clicked;
		the collection_service URL is the same as the regular library link URL, with the addition of the
		parameter "lmXML=1". An override of the lm_dir_page.htm template (in LayoutManager/templates)
		contains a branch that generates an XML string instead of the regular page when this parameter
		tests true.
		Note: Any elements created at the top level of the XML tree must also have their ID
		values added to one of the diplay group arrays in order to be included in a menu display.*/
	navBuilder.addChildNodeTo(
		"BROWSE_CONTENT",
		"collection",
		"id==index",
		"label==" + lc("wwLibraryQueryFolders"),
		"url==",
		"collection_service==" + httpCgiPath +"?IdcService=GET_DYNAMIC_PAGE&PageName=index&lmXML=1");


	//***** MODIFYING ATTRIBUTES *************************************
	/* The following method exists for modifying attributes of elements in the hierarchy:
				navBuilder.setAttributeValue(nodeId, attrName, attrValue)
	/* The first argument is the ID of the menu item, the second argument is the name of the
	attribute, the third argument is the set-value for the attribute. This method can be used
	to either change the value of an existing attribute, or add a new attribute.*/

	navBuilder.setAttributeValue("MY_PERSONAL_CHECKINS", "icon", "NewItem.gif");
	navBuilder.setAttributeValue("MY_PERSONAL_SEARCHES", "icon", "QueryFolder_closed.gif");	
	navBuilder.setAttributeValue("MY_PERSONAL_URLS", "icon", "WebFolder_closed.gif");
	navBuilder.setAttributeValue("MY_SAVED_QUERIES", "icon", "QueryFolder_closed.gif");
	navBuilder.setAttributeValue("index", "icon", "QueryFolder_closed.gif");
	navBuilder.setAttributeValue("MY_PROFILE", "icon", "ScsPageItem.gif");
	navBuilder.setAttributeValue("NEW_CHECK_IN", "icon", "NewItem.gif");

	/* change the icons for personal urls, and admin links, if they exist */
	changeItemIconsTo("WebItem.gif", "MY_PERSONAL_URLS");
	changeItemIconsTo("ScsPageItem.gif", "ADMINISTRATION", true);
	navBuilder.setAttributeValue("ADMIN_SERVER", "icon", "ScsAdminItem.gif");


	//***** DELETING NODES *************************************
	/* These nodes are not needed for the "Trays" layout, so they can be removed */
	navBuilder.deleteItem("LIBRARY");
	navBuilder.deleteItem("EDIT_SAVED_QUERIES");
	navBuilder.deleteItem("EDIT_PERSONAL_URLs");
}

