////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//   This computer program is protected by copyright law and international treaties.                                                      //
//   Unauthorized reproduction or distribution of the program, or any portion of it, may result in severe civil and criminal penalties,   //
//   and will be prosecuted to the maximum extent possible under law.                                                                     //
//   Copyright(c) Digitomi Corp. All Right Reserved.                                                                                      //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//   Last Update 2005_03_16 17:19:45 by tews                                                                                              //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 function Navigator2(argControl){this.id="oNavigator2";this.NavigatorControl=argControl;this.ActiveBar=null;this.iOffsetPos=0;this.iPointPos=0;this.ControlPosition=0;this.CurrentPage=0;this.StartPage=0;this.EndPage=oBookInfo.iPageCount-2;this.iControlWidth=this.NavigatorControl.width;this.iNavigationWidth=this.NavigatorControl.parentElement.clientWidth;this.iPointCaptured=false;if(arguments[1]){this.ActiveBar=arguments[1];}this.oNavigatorInit=oNavigatorInit;this.oNavigatorGotoPage=oNavigatorGotoPage;this.RePosition=RePosition;this.GetCurrentPageNo=GetCurrentPageNo;this.GetControlPosition=GetControlPosition;this.oNavigatorInit();}function oNavigatorInit(argObj){this.iControlWidthCenter=parseInt(this.iControlWidth / 2);this.NavigatorControl.style.left=-this.iControlWidthCenter;if(this.EndPage < 2)return false;this.iPointCaptured=false;this.NavigatorControl.onmousedown=oNavigatorSetCapture;this.NavigatorControl.onmouseup=oNavigatorReleaseCapture;this.NavigatorControl.onmousemove=oNavigatorControlMove;this.NavigatorControl.parentElement.onclick=oNavigatorbarClick;this.NavigatorControl.parentElement.onmouseover=oNavigatorPageDisplay;this.NavigatorControl.parentElement.onmousemove=oNavigatorPageMove;this.NavigatorControl.parentElement.onmouseout=oNavigatorPageVisible;var tmpHTMLElement=document.createElement("DIV");document.body.appendChild(tmpHTMLElement);tmpHTMLElement.outerHTML="<div id=\"oNavigationPage\"></div>";this.oNavigationPage=oNavigationPage;delete tmpHTMLElement;oNavigatorPageNoSet(this.oNavigationPage);if(this.ActiveBar){this.ActiveBarHeight=this.ActiveBar.height;this.ActiveBar.width=0;}}function oNavigatorPageNoSet(argObj){with(argObj.style){position="absolute";width="30px";height="16px";paddingTop="2px";backgroundColor="#eeeeaa";border="1 solid #666666";visibility="hidden";zIndex=101;fontSize="9pt";textAlign="center";}}function GetCurrentPageNo(argPosition){var PageNo=Math.round(argPosition / this.iNavigationWidth * this.EndPage);return PageNo;}function GetControlPosition(argPage){var PositionNo=Math.round((argPage / this.EndPage)* this.iNavigationWidth);return PositionNo;}function oNavigatorGotoPage(){oBook.GotoPage(this.CurrentPage);}function oNavigatorPageDisplay(){var PageNo=oNavigator2.GetCurrentPageNo(window.event.x);if(PageNo >=0 && PageNo <=oNavigator2.EndPage){oNavigator2.oNavigationPage.innerText=oNavigator2.GetCurrentPageNo(window.event.x);oNavigator2.oNavigationPage.style.visibility="visible";}else{oNavigator2.oNavigationPage.style.visibility="hidden";}}function oNavigatorPageVisible(){oNavigator2.oNavigationPage.style.visibility="hidden";}function oNavigatorPageMove(){with(oNavigator2.oNavigationPage.style){left=event.clientX-Math.round(parseInt(width)/ 2);top=event.clientY-parseInt(height)-5;}oNavigatorPageDisplay();}function RePosition(argCurrPage){if(this.EndPage < 2)return false;this.CurrentPage=Math.ceil(argCurrPage);if(this.CurrentPage % 2 !=0)this.CurrentPage-=1;this.ControlPosition=this.GetControlPosition(this.CurrentPage);this.NavigatorControl.style.left=this.ControlPosition-this.iControlWidthCenter;if(this.ActiveBar){this.ActiveBar.height=this.ActiveBarHeight;this.ActiveBar.width=this.ControlPosition;}}function oNavigatorSetCapture(){oNavigator2.NavigatorControl.setCapture();oNavigator2.iPointCaptured=true;oNavigator2.iOffsetPos=event.clientX-oNavigator2.ControlPosition;}function oNavigatorReleaseCapture(){oNavigator2.NavigatorControl.releaseCapture();oNavigator2.iPointCaptured=false;var CurrentPage=oNavigator2.GetCurrentPageNo(oNavigator2.ControlPosition);oNavigator2.RePosition(CurrentPage);oNavigator2.oNavigatorGotoPage();}function oNavigatorControlMove(){var PosX=event.clientX-oNavigator2.iOffsetPos;if(oNavigator2.iPointCaptured){switch(true){case PosX <=0 : oNavigator2.NavigatorControl.style.left=-oNavigator2.iControlWidthCenter;oNavigator2.ControlPosition=0;break;case PosX >=oNavigator2.iNavigationWidth : oNavigator2.NavigatorControl.style.left=oNavigator2.iNavigationWidth-oNavigator2.iControlWidthCenter;oNavigator2.ControlPosition=oNavigator2.iNavigationWidth;break;default: oNavigator2.NavigatorControl.style.left=PosX-oNavigator2.iControlWidthCenter;oNavigator2.ControlPosition=event.clientX-oNavigator2.iOffsetPos;}}if(oNavigator2.ActiveBar){oNavigator2.ActiveBar.height=oNavigator2.ActiveBarHeight;oNavigator2.ActiveBar.width=oNavigator2.ControlPosition;}}function oNavigatorbarClick(){if(oNavigator2.iPointCaptured==false && window.event.x >=0 && window.event.x <=oNavigator2.iNavigationWidth){oNavigator2.NavigatorControl.style.left=window.event.x;oNavigator2.ControlPosition=window.event.x;var CurrentPage=oNavigator2.GetCurrentPageNo(oNavigator2.ControlPosition);oNavigator2.RePosition(CurrentPage);oNavigator2.oNavigatorGotoPage();}}
