function BrowseLC()
{
}

BrowseLC.prototype = new EventController();
BrowseLC.superclass = EventController.prototype;

BrowseLC.prototype.handleEvent = function (source)
{
	if (!BrowseLC.superclass.handleEvent.call(this, source))
	{
		if (source.getEvent() == "E_TOCNODE_CLICKED" || source.getEvent() == "E_REFNODE_CLICKED")
		{
			var targetFrame = document.getElementById("rightFrame");
			var currentDoc;
			var subDocLink;
			if (source.getEvent() == "E_TOCNODE_CLICKED")
			{
				currentDoc = source.getSelectedDocumentId();
				subDocLink = source.getSelectedSubDocLink();
			}
			else
			{
				currentDoc = source.getSelectedNodeId();
				subDocLink = "";
			}
			
			if (targetFrame.contentWindow.location.href.indexOf(currentDoc) != -1)
			{
				var targetElement = top.getElementFromDocument(subDocLink, rightFrame.docFrame.document);
				rightFrame.xWinScrollTo(rightFrame.docFrame, 0, rightFrame.xPageY(targetElement), 1000)
			}
			else
			{
				if (source.tocTile.isSelectedNodeHitDoc())
				{
					targetFrame.contentWindow.location.href = "template.htm?view=document&doc_action=sethitdoc&doc_keytype=tocid&doc_key=" + currentDoc + "&hash=" + subDocLink;
				}
				else
				{
					targetFrame.contentWindow.location.href = "template.htm?view=document&doc_action=setdoc&doc_keytype=tocid&doc_key=" + currentDoc + "&hash=" + subDocLink;
				}
			}
			return true;
		}
		else if (source.getEvent() == "E_SYNC_TO_TOC")
		{
			leftFrame.LCO.tocTile.syncToId(source.docoptionsTile.getElement());
			return true;
		}
		else if (source.getEvent() == "E_CANCEL_EMAIL")
		{
			var targetFrame = document.getElementById("rightFrame");
			targetFrame.contentWindow.location.href = "template.htm?view=document";
			return true;
		}
		return false;
	}
}

var LCO = new BrowseLC();
