
{function ContentsPanePage()
{}
ContentsPanePage.ElementIDs={ContentsTabStripID:"contentsTabStrip",ContentsPageSwitcherID:"contentsPageSwitcher",PaneListContentsInternalID:"paneListContentsInternal",ThumbnailsPageId:"pagesThumbnailsItem",FeaturedPagesPageId:"featuredPagesItem",DocToc:"ctrlDocToc",DocThumbnailsId:"ctrlDocThumbnails",DocFeaturedPages:"ctrlDocFeaturedPages"};ContentsPanePage.ResourceStrings={TabItem_TOC:"TabItem_TOC",TabItem_PageThumbnails:"TabItem_PageThumbnails",TabItem_FeaturedPages:"TabItem_FeaturedPages",TocPane_NoDocument:"TocPane_NoDocument"};ContentsPanePage.DeclareType=function ContentsPanePage_DeclareType()
{this.DeclareField("m_toc",null);this.DeclareField("m_pageThumbnails",null);this.DeclareField("m_featuredPages",null);this.DeclareField("m_oPaneListContentsInternal",null);this.DeclareField("m_thumbnailsPage",null);this.DeclareField("m_featuredPagesPage",null);this.OverrideMethod("postInitialize",ContentsPanePage_postInitialize);this.DeclareMethod("BindDocViewerParts",ContentsPanePage_BindDocViewerParts);this.DeclareMethod("_updateThumbnailsPageItem",ContentsPanePage_updateThumbnailsPageItem);this.DeclareMethod("_updateThumbnailsPageItemIfActive",ContentsPanePage_updateThumbnailsPageItemIfActive);this.DeclareMethod("_onPageItemActivated",ContentsPanePage_onPageItemActivated);this.DeclareMethod("onIcLinkClicked",ContentsPanePage_onIcLinkClicked);this.DeclareMethod("_findControls",ContentsPanePage_findControls);this.DeclareMethod("_expandFirstTocSection",null);};ContentsPanePage.ApplyPrototype=function ContentsPanePage_ApplyPrototype(classProto)
{};function ContentsPanePage_postInitialize(popupArguments)
{for(var res_str in ContentsPanePage.ResourceStrings)
this.WebApplication.setResString(window.document,res_str);this._findControls();var oContentsTabs=OwcGetControl(ContentsPanePage.ElementIDs.ContentsTabStripID);this.m_oContentsTabs=oContentsTabs;var oContentsPageSwitcher=OwcGetControl(ContentsPanePage.ElementIDs.ContentsPageSwitcherID);if(oContentsTabs&&oContentsPageSwitcher)
Olive.Binding.SyncActiveItems.BindControls(oContentsTabs,oContentsPageSwitcher);this.m_thumbnailsPage.attachOwcEventHandler("stateChanged",this._updateThumbnailsPageItem,this);this.m_featuredPagesPage.attachOwcEventHandler("stateChanged",this._updateThumbnailsPageItem,this);if(this.m_magnifierControl)
{this.m_magnifierControl.setMaxWidth(this.WebApplication.m_nMagnifierMaxWidth);this.m_magnifierControl.setMaxHeight(this.WebApplication.m_nMagnifierMaxHeight);this.m_magnifierControl.setMagPercent(this.WebApplication.m_nMagnifierMagPercent);}
this.m_bInitialized=true;this.WebApplication.onContentsPaneLoaded();if(this.WebApplication.getPreferenceBoolean("expand-first-toc-section",false))
{JScript.Type.DeclareMethod(this,"_expandFirstTocSection",ContentsPanePage_expandFirstTocSection);Olive.EventSource.RegisterEventHandler("","dataProcessed",false,this._expandFirstTocSection,this);}}
function ContentsPanePage_BindDocViewerParts(docViewerAgg,thumbnailContainers)
{docViewerAgg.set_TocControl(this.m_toc);docViewerAgg.m_oBindTocToDocViewer.setHighlightICOnly(!this.WebApplication.m_bHighlightOnTocSection);docViewerAgg.set_PageThumbnailsControl(this.m_pageThumbnails);docViewerAgg.set_FeaturedPagesControl(this.m_featuredPages);this.m_featuredPages.set_CreateCoverBack(this.WebApplication.m_bCreateCoverBack);if(thumbnailContainers)
{var index,count=thumbnailContainers.length;for(index=0;index<count;++index)
{var container=thumbnailContainers[index];if(container)
container.attachOwcEventHandler("stateChanged",this._updateThumbnailsPageItemIfActive,this);}}}
function ContentsPanePage_findControls()
{this.m_toc=OwcGetControl(ContentsPanePage.ElementIDs.DocToc);if(!this.m_toc)
{this.reportError(DHTML.newError(ContentsPanePage.ErrorCodes.TocAbsence,"Internal error: Cannot find Olive.Controls.Toc control on HTML page"));return;}
this.m_pageThumbnails=OwcGetControl(ContentsPanePage.ElementIDs.DocThumbnailsId);this.m_featuredPages=OwcGetControl(ContentsPanePage.ElementIDs.DocFeaturedPages);;this.m_thumbnailsPage=OwcGetControl(ContentsPanePage.ElementIDs.ThumbnailsPageId);this.m_featuredPagesPage=OwcGetControl(ContentsPanePage.ElementIDs.FeaturedPagesPageId);this.m_magnifier=this.findControlByType(Olive.Controls.controlTypeNames.Magnifier);this.m_oPaneListContentsInternal=OwcGetControl(ContentsPanePage.ElementIDs.PaneListContentsInternalID);}
function ContentsPanePage_updateThumbnailsPageItem(eventArgs)
{var srcThumbnailList=(eventArgs.srcObject==this.m_thumbnailsPage)?this.m_pageThumbnails:this.m_featuredPages;if(srcThumbnailList.m_oContentItem)
return;if(((eventArgs.newState&Olive.IState.State.ActiveMask)!=Olive.IState.State.Active))
return;srcThumbnailList.contentLoadItem(this.WebApplication.get_DocViewSource());}
function ContentsPanePage_updateThumbnailsPageItemIfActive(eventArgs)
{if(this.m_pageThumbnails.m_oContentItem||this.m_featuredPages.m_oContentItem)
return;var sSrcId=eventArgs.srcObject.m_sId;var bUpdate=((sSrcId=="pageItemContents")||(sSrcId=="ctrlAllContents"));if(!bUpdate||((eventArgs.newState&Olive.IState.State.ActiveMask)!=Olive.IState.State.Active))
return;if(this.m_thumbnailsPage&&this.m_thumbnailsPage.isStateSet(Olive.IState.State.Active)&&!this.m_pageThumbnails.m_oContentItem)
this.m_pageThumbnails.contentLoadItem(this.WebApplication.get_DocViewSource());if(this.m_featuredPagesPage&&this.m_featuredPagesPage.isStateSet(Olive.IState.State.Active))
this.m_featuredPages.contentLoadItem(this.WebApplication.get_DocViewSource());}
function ContentsPanePage_onPageItemActivated(eventArgs)
{if(this.m_oPaneListContentsInternal&&this.m_oPaneListContentsInternal.recalcLayout)
this.m_oPaneListContentsInternal.recalcLayout();}
function ContentsPanePage_expandFirstTocSection(eventArgs)
{if(eventArgs.srcObject.getControlType()==Olive.Controls.controlTypeNames.TOC)
{if(this.m_toc)
{var oTocRoot=this.m_toc.findControlsImplementing(Olive.ITreeNode);if(oTocRoot&&oTocRoot.length>0)
{var arrTocSection=oTocRoot[0].findControlsByType(Olive.Controls.controlTypeNames.TocSection);if(arrTocSection&&arrTocSection.length>0)
{arrTocSection[0].nodeExpand(OwcTreeNodeExpand_Expand);}}}}}
function ContentsPanePage_onIcLinkClicked(eventArg)
{if(!eventArg||!eventArg.sEntityId)
return;var oContentItem=Olive.ContentItem.CreateByType(OwcContentItem_Entity);oContentItem.m_sDocHRef=this.WebApplication.m_sDocHRef;oContentItem.m_sEntityId=eventArg.sEntityId;oContentItem.expando=true;oContentItem.viewMode=this.WebApplication.m_sICViewMode;this.WebApplication.OpenComponent(oContentItem);}
JScript.Type.RegisterClass("ContentsPanePage",ContentsPanePage,Olive.Page);}
Olive.WindowBinder.RegisterPageClass(window,ContentsPanePage);