home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 130 / MOBICLIC130.ISO / pc / DATA / HOTE / libs / LivreFeuilletable / LivreFeuilletable.swf / scripts / FFlippingBookSymbol.as
Text File  |  2010-12-13  |  95KB  |  2,895 lines

  1. function FFlippingBookConstants()
  2. {
  3.    this.version = "1.8.5";
  4.    this.DELIMITER = "%!!!%";
  5.    this.INVALID_XML_MSG = "FFlippingBookError: Incorrect XML source..";
  6.    this.MEDIA_INTERVAL = 300;
  7.    this.MEDIA_TIMEOUT = 3000;
  8.    this.PAGE_TIMEOUT = 3000;
  9.    this.DEF_PAGE_NAME = "fpage";
  10.    this.PAGE_SHADOW_LAYER_NAME = "shadows";
  11.    this.PAGE_BG_NAME = "bg";
  12.    this.PAGE_HOLDER_NAME = "holder";
  13.    this.PAGE_HOLDER_PARENT_NAME = "parent";
  14.    this.PAGE_PRELOADER_NAME = "loader";
  15.    this.PAGE_MEDIA_NAME = "media";
  16.    this.PAGE_MASK_NAME = "pmask";
  17.    this.SYMBOL_PRELOADER_NAME = "FBStandardPreloader";
  18.    this.PRELOADER_BAR_NAME = "bar_mc";
  19.    this.MAIN_OBJ_ID = "MAIN";
  20.    this.MODEL_OBJ_ID = "MODEL";
  21.    this.CACHE_OBJ_ID = "CACHE";
  22.    this.CONSTANTS_OBJ_ID = "CONSTANTS";
  23.    this.LOADER_OBJ_ID = "LOADER";
  24.    this.VIEW_OBJ_ID = "VIEW";
  25.    this.WIDTH_NODE_NAME = "WIDTH";
  26.    this.HEIGHT_NODE_NAME = "HEIGHT";
  27.    this.ALWAYS_OPENED_NODE_NAME = "ALWAYSOPENED";
  28.    this.SCALE_CONTENT_NODE_NAME = "SCALECONTENT";
  29.    this.AUTOFLIP_NODE_NAME = "AUTOFLIP";
  30.    this.FLIP_ON_CLICK_NODE_NAME = "FLIPONCLICK";
  31.    this.MOVE_SPEED_NODE_NAME = "MOVESPEED";
  32.    this.CLOSE_SPEED_NODE_NAME = "CLOSESPEED";
  33.    this.GOTO_SPEED_NODE_NAME = "GOTOSPEED";
  34.    this.FLIP_SOUND_NODE_NAME = "FLIPSOUND";
  35.    this.PAGE_BACK_NODE_NAME = "PAGEBACK";
  36.    this.LOAD_ON_DEMAND_NODE_NAME = "LOADONDEMAND";
  37.    this.CACHE_PAGES_NODE_NAME = "CACHEPAGES";
  38.    this.USE_PRELOADER_NODE_NAME = "USEPRELOADER";
  39.    this.USER_PRELOADER_NODE_NAME = "USERPRELOADERID";
  40.    this.CACHE_SIZE_NODE_NAME = "CACHESIZE";
  41.    this.PRELOADER_TYPE_NODE_NAME = "PRELOADERTYPE";
  42.    this.PAGES_NODE_NAME = "PAGES";
  43.    this.FIRST_PAGE_NODE_NAME = "FIRSTPAGE";
  44.    this.STATIC_SHADOWS_DEPTH_NODE_NAME = "STATICSHADOWSDEPTH";
  45.    this.DYNAMIC_SHADOWS_DEPTH_NODE_NAME = "DYNAMICSHADOWSDEPTH";
  46.    this.PAGE_STATIC_SHADOW1_NAME = "STATICSH1";
  47.    this.PAGE_STATIC_SHADOW2_NAME = "STATICSH2";
  48.    this.FLIP_SOUND_SYMBOL_NAME = "FFlippingBookSound";
  49.    this.NUM_TYPE_NAME = "number";
  50.    this.BOOL_TYPE_NAME = "boolean";
  51.    this.BOOL_TRUE_VAL = "TRUE";
  52.    this.BOOL_FALSE_VAL = "FALSE";
  53.    this.PRELOADER_WIDTH_SCALE = 2;
  54.    this.PRELOADER_HEIGHT_SCALE = 30;
  55.    this.MIN_PAGE_OFFSET = 0.99;
  56.    this.MIN_PAGE_OFFSET2 = 0.99;
  57.    this.DEF_PRELOADER_TYPE = "Progress Bar";
  58.    this.DEF_CACHE_SIZE = 4;
  59.    this.DEF_WIDTH = 100;
  60.    this.DEF_HEIGHT = 100;
  61.    this.DEF_FIRST_PAGE = 0;
  62.    this.DEF_SHADOWS_DEPTH = 1;
  63.    this.DEF_MOVE_SPEED = 2;
  64.    this.DEF_CLOSE_SPEED = 3;
  65.    this.DEF_GOTO_SPEED = 3;
  66.    this.DEF_ALWAYS_OPENED = false;
  67.    this.DEF_FLIP_ON_CLICK = true;
  68.    this.DEF_LOAD_ON_DEMAND = true;
  69.    this.DEF_CACHE_PAGES = true;
  70.    this.DEF_USE_PRELOADER = true;
  71.    this.DEF_PAGEBACK = 11447982;
  72.    this.DEF_SCALE_CONTENT = true;
  73.    this.DEF_SOUND = "default";
  74.    this.DEF_NO_SOUND = "";
  75.    this.DEF_AUTOFLIP = 50;
  76.    this.EMPTY_PAGE = "_empty";
  77.    this.TRANSPARENT_PAGE1 = "_transp1";
  78.    this.TRANSPARENT_PAGE2 = "_transp2";
  79.    this.INIT_STATE = 0;
  80.    this.UNACTIVE_STATE = 1;
  81.    this.FLIPPING_STATE = 2;
  82.    this.FLIPOVER_STATE = 3;
  83.    this.FLIPBACK_STATE = 4;
  84.    this.AUTOFLIP_STATE = 5;
  85.    this.GOTOPAGE_STATE = 6;
  86.    this.FLIP_GOTOPAGE_STATE = 7;
  87.    this.FLIP_CORNER_STATE = 8;
  88.    this.START_FLIP_CORNER_STATE = 9;
  89.    this.CACHE_DEPTH = 100;
  90.    this.BOOK_DEPTH = 10000;
  91.    this.PAGE_01_MC_NAME = "p01";
  92.    this.PAGE_02_MC_NAME = "p02";
  93.    this.PAGE_03_MC_NAME = "p03";
  94.    this.PAGE_04_MC_NAME = "p04";
  95.    this.MASK_03_MC_NAME = "m03";
  96.    this.MASK_12_MC_NAME = "m12";
  97.    this.SHADOW_03_MC_NAME = "s03";
  98.    this.SHADOW_04_MC_NAME = "s04";
  99.    this.SH_MASK_03_MC_NAME = "shm03";
  100.    this.SH_MASK_04_MC_NAME = "shm04";
  101.    this.PAGES_SH_MC_NAME = "s12";
  102.    this.PAGES_SHM_MC_NAME = "shm12";
  103.    this.STATIC_SHADOW_MC_NAME = "shStatic";
  104.    this.PAGE01_DEPTH = 8;
  105.    this.PAGE02_DEPTH = 5;
  106.    this.PAGE03_DEPTH = 4;
  107.    this.PAGE04_DEPTH = 0;
  108.    this.SH12_SCALE = 0.4;
  109.    this.SH3_SCALE = 1.6;
  110.    this.SPEED_DIV = 10;
  111. }
  112. function FFlippingBookBroker()
  113. {
  114.    this.objects = new Array();
  115. }
  116. function FFlippingBookCache(broker, usePreloader, cachePages, loadOnDemand, bgColor)
  117. {
  118.    this._broker = broker;
  119.    this._const = new FFlippingBookConstants();
  120.    this._broker.registerObject(this._const.CACHE_OBJ_ID,this);
  121.    this._baseObject = this._broker.objects[this._const.MAIN_OBJ_ID];
  122.    this._pagesDepth = this._const.CACHE_DEPTH;
  123.    this.usePreloader = usePreloader;
  124.    this.cachePages = cachePages;
  125.    this.loadOnDemand = loadOnDemand;
  126.    this.bgColor = bgColor;
  127.    this.__pagesLinks = new Array();
  128.    this.__pagesProcess = new Array();
  129.    this.__pagesHolders = new Array();
  130.    this.__pagesLoaders = new Array();
  131.    this.__pagesTimeouts = new Array();
  132.    this.__pagesLoading = new Array();
  133.    this.__pagesExt = new Array();
  134.    this.__pagesDepths = new Array();
  135.    this.__pagesBacks = new Array();
  136.    this.__pagesMasks = new Array();
  137.    this.__checkCompleted = new Array();
  138.    this.__pagesShadows1 = new Array();
  139.    this.__pagesShadows2 = new Array();
  140.    this._sound = new Sound(this._baseObject);
  141.    this._isSound = true;
  142.    this._soundTimeout = this._const.MEDIA_TIMEOUT;
  143.    this.sd = this._baseObject.shadowsDepth;
  144.    this.ssd = this._baseObject.staticShadowsDepth;
  145.    this._mediaComplete = false;
  146.    this._soundComplete = false;
  147.    this._pagesComplete = false;
  148.    this.extXML = new XML();
  149.    this.extXML.ignoreWhite = true;
  150.    this.extXML._parentObj = this;
  151.    this.extXML.onLoad = this.onXMLComplete;
  152. }
  153. function FFlippingBookModel(pagesSet, firstPage, alwaysOpened, broker)
  154. {
  155.    this._broker = broker;
  156.    this._const = new FFlippingBookConstants();
  157.    this._broker.registerObject(this._const.MODEL_OBJ_ID,this);
  158.    this._cache = this._broker.objects[this._const.CACHE_OBJ_ID];
  159.    this._baseObj = this._broker.objects[this._const.MAIN_OBJ_ID];
  160.    this._userPages = pagesSet;
  161.    this._curPageNumbers = new Array(4);
  162.    this._markEqual();
  163.    this._realPages = this._copyArray(pagesSet);
  164.    this.alwaysOpened = alwaysOpened;
  165.    this.__direction = -1;
  166.    this._makeItReal();
  167.    this.addProperty("_userCurrentPage2",this.getUserCurrentPage2,null);
  168.    this._userCurrentPage = firstPage;
  169.    this._currentPage = this._realPageNumber(firstPage);
  170. }
  171. function FFlippingBookClass()
  172. {
  173.    this._constants = new FFlippingBookConstants();
  174.    this._broker = new FFlippingBookBroker();
  175.    this._broker.registerObject(this._constants.MAIN_OBJ_ID,this);
  176.    this.usePreloader = this.preloaderType != "None";
  177.    this._cache = new FFlippingBookCache(this._broker,this.usePreloader,this.cachePages,this.loadOnDemand,this.pageBack);
  178.    this.pageParameters = new Array();
  179.    this.pageIndexes = new Array();
  180.    this.addProperty("enabledProp",this.getEnabledProp,this.setEnabledProp);
  181.    this.addProperty("totalPages",this.getTotalPages,null);
  182.    this.addProperty("leftPageNumber",this.getLeftPageNumber,null);
  183.    this.addProperty("rightPageNumber",this.getRightPageNumber,null);
  184.    this.addProperty("autoFlipProp",this.getAutoFlipProp,this.setAutoFlipProp);
  185.    this.addProperty("flipOnClickProp",this.getFlipOnClick,this.setFlipOnClick);
  186.    this.addProperty("moveSpeedProp",this.getMoveSpeedProp,this.setMoveSpeedProp);
  187.    this.addProperty("closeSpeedProp",this.getCloseSpeedProp,this.setCloseSpeedProp);
  188.    this.addProperty("gotoSpeedProp",this.getGotoSpeedProp,this.setGotoSpeedProp);
  189.    this.addProperty("width",this.getWidth,this.setWidth);
  190.    this.addProperty("height",this.getHeight,this.setHeight);
  191.    this.addProperty("alwaysOpenedProp",this.getAlwaysOpenedProp,null);
  192.    this.enabledProp = true;
  193.    this._a = Math.abs(this._rotation / 180 * 3.141592653589793);
  194.    this._sina = Math.sin(this._a);
  195.    this._cosa = Math.cos(this._a);
  196.    this._W = this._width;
  197.    this._H = this._height;
  198.    this._w = (this._H * this._sina - this._W * this._cosa) / (this._sina * this._sina - this._cosa * this._cosa);
  199.    this._h = (this._H * this._cosa - this._W * this._sina) / (this._cosa * this._cosa - this._sina * this._sina);
  200.    this.setSize(this._w,this._h);
  201.    this.box_mc._visible = false;
  202.    if(this.extXML != "")
  203.    {
  204.       this._cache.loadExternalXML(this.extXML);
  205.    }
  206.    else
  207.    {
  208.       this._getMedia();
  209.    }
  210. }
  211. function FFlippingBookView(bw, bh, autoFlip, flipOnClick, broker)
  212. {
  213.    this._const = new FFlippingBookConstants();
  214.    this._end = false;
  215.    this._broker = broker;
  216.    this._broker.registerObject(this._const.VIEW_OBJ_ID,this);
  217.    this._baseObj = this._broker.objects[this._const.MAIN_OBJ_ID];
  218.    this._cache = this._broker.objects[this._const.CACHE_OBJ_ID];
  219.    this._model = this._broker.objects[this._const.MODEL_OBJ_ID];
  220.    this._pageWidth = this._baseObj._bookWidth / 2;
  221.    this._pageHeight = this._baseObj._bookHeight;
  222.    this._autoFlip = this._baseObj.autoFlip;
  223.    this._flipOnClick = this._baseObj.flipOnClick;
  224.    this._pageSpeed = this._baseObj.moveSpeed / this._const.SPEED_DIV;
  225.    this._closeSpeed = this._baseObj.closeSpeed / this._const.SPEED_DIV;
  226.    this._gotoSpeed = this._baseObj.gotoSpeed / this._const.SPEED_DIV;
  227.    this._minOffset = this._const.MIN_PAGE_OFFSET;
  228.    this._flipSound = this._cache._sound;
  229.    this._bookState = this._const.INIT_STATE;
  230.    this._depth = this._const.BOOK_DEPTH;
  231.    this.radIndex = 57.29577951308232;
  232.    this._transpPage = 0;
  233.    this.__ox = 0;
  234.    this.__oy = 0;
  235.    this.__oldX = 0;
  236.    this.__oldY = 0;
  237.    this.__p4Empty = false;
  238.    this.__shadowHeight = 2 * Math.sqrt(this._pageHeight * this._pageHeight + this._pageWidth * this._pageWidth);
  239.    this.__pagesShadowHeight = 2 * Math.sqrt(4 * this._pageHeight * this._pageHeight + this._pageWidth * this._pageWidth);
  240.    this._radIndex = 57.29577951308232;
  241.    this.__gotoPageIndex = 0;
  242.    this.sd = this._baseObj.shadowsDepth;
  243.    this._drawBook();
  244.    this._baseObj.onMouseDown = this.__onMouseDown;
  245.    this._baseObj.onMouseUp = this.__onMouseUp;
  246.    this._baseObj.onEnterFrame = this.__onEnterFrame;
  247.    this._model.putPage();
  248. }
  249. FFlippingBookBroker.prototype.registerObject = function(id, obj)
  250. {
  251.    this.objects[id] = obj;
  252. };
  253. FFlippingBookCache.prototype._stripItem = function(str)
  254. {
  255.    var _loc2_ = str.indexOf(this._const.DELIMITER) + this._const.DELIMITER.length;
  256.    return str.substr(_loc2_);
  257. };
  258. FFlippingBookCache.prototype.loadExternalXML = function(src)
  259. {
  260.    if(src != "")
  261.    {
  262.       this.extXML.load(src);
  263.    }
  264.    else
  265.    {
  266.       this._baseObject._onXMLComplete(false);
  267.    }
  268. };
  269. FFlippingBookCache.prototype.onXMLComplete = function(success)
  270. {
  271.    if(success && this.status == 0)
  272.    {
  273.       this._parentObj._baseObject._onXMLComplete();
  274.    }
  275.    else if(this.status != 0)
  276.    {
  277.       trace(this._parentObj._const.INVALID_XML_MSG);
  278.    }
  279. };
  280. FFlippingBookCache.prototype.loadMedia = function(pagesSet, flipSound, pageBack, w, h)
  281. {
  282.    this._soundSrc = flipSound;
  283.    this._bgColor = pageBack;
  284.    this._realPages = pagesSet;
  285.    this._pageWidth = w / 2;
  286.    this._pageHeight = h;
  287.    this._loadFlipSound();
  288.    this._loadPages();
  289.    if(!this.loadOnDemand)
  290.    {
  291.       this._baseObject.progress = 0;
  292.       this.__placeOverallPreloader();
  293.    }
  294.    this._mediaInterval = setInterval(this.__checkMedia,this._const.MEDIA_INTERVAL,this);
  295. };
  296. FFlippingBookCache.prototype._loadFlipSound = function()
  297. {
  298.    this._soundComplete = false;
  299.    if(this._soundSrc == this._const.DEF_NO_SOUND || this._soundSrc == undefined)
  300.    {
  301.       this._isSound = false;
  302.       this._soundComplete = true;
  303.    }
  304.    else
  305.    {
  306.       this._sound.attachSound(this._soundSrc);
  307.       if(this._sound.duration == undefined)
  308.       {
  309.          this._sound.loadSound(this._soundSrc,false);
  310.       }
  311.       this._soundComplete = false;
  312.       this._isSound = false;
  313.    }
  314. };
  315. FFlippingBookCache.prototype._getProgress = function()
  316. {
  317.    var _loc2_ = 0;
  318.    var _loc3_ = 0;
  319.    for(var _loc4_ in this.__pagesProcess)
  320.    {
  321.       if(this.__pagesExt[_loc4_])
  322.       {
  323.          if(!isNaN(this.__pagesProcess[_loc4_]))
  324.          {
  325.             _loc2_ += this.__pagesProcess[_loc4_];
  326.          }
  327.          _loc3_ = _loc3_ + 1;
  328.       }
  329.    }
  330.    return _loc2_ / _loc3_;
  331. };
  332. FFlippingBookCache.prototype.__checkMedia = function(obj)
  333. {
  334.    if(!obj._soundComplete)
  335.    {
  336.       if(obj._sound.getBytesLoaded() == obj._sound.getBytesTotal() || obj._sound.getBytesTotal() == undefined)
  337.       {
  338.          if(obj._sound.getBytesTotal == 0 && obj._soundTimeout > 0)
  339.          {
  340.             obj._soundTimeout -= obj._const.MEDIA_INTERVAL;
  341.          }
  342.          else if(obj._sound.getBytesTotal == undefined && obj._soundTimeout <= 0)
  343.          {
  344.             obj._isSound = false;
  345.             obj._soundComplete = true;
  346.          }
  347.          else
  348.          {
  349.             obj._isSound = true;
  350.             obj._soundComplete = true;
  351.          }
  352.       }
  353.    }
  354.    if(!obj._pagesComplete && !obj.loadOnDemand)
  355.    {
  356.       obj._pagesComplete = true;
  357.       for(src in obj.__pagesProcess)
  358.       {
  359.          if(obj.__pagesProcess[src] < 100 || obj.__checkCompleted[src] == 1 || isNaN(obj.__pagesProcess[src]))
  360.          {
  361.             var _loc2_ = obj.__pagesHolders[src].getBytesLoaded() / obj.__pagesHolders[src].getBytesTotal() * 100;
  362.             if(obj.usePreloader)
  363.             {
  364.                obj.__pagesLoaders[src].setProgress(_loc2_);
  365.             }
  366.             obj.__pagesProcess[src] = _loc2_;
  367.             obj.__pagesHolders[src].progress = _loc2_;
  368.             obj._baseObject.progress = obj._getProgress();
  369.             obj.preloader.setProgress(obj._baseObject.progress);
  370.             obj.__pagesTimeouts[src] -= obj._const.MEDIA_INTERVAL;
  371.             if(_loc2_ == 100 && obj.__pagesHolders[src].getBytesLoaded() > 4 && obj.__checkCompleted[src] == 1)
  372.             {
  373.                obj._baseObject._setPageParameters(obj.__pagesHolders[src],src,true);
  374.                obj.__pagesBacks[src]._visible = false;
  375.                obj._baseObject._setVisible();
  376.                obj.__pagesHolders[src].progress = 100;
  377.                obj.__pagesLoaders[src].removeMovieClip();
  378.                if(obj._baseObject.scaleContent)
  379.                {
  380.                   obj.__pagesHolders[src]._width = obj._pageWidth;
  381.                   obj.__pagesHolders[src]._height = obj._pageHeight;
  382.                }
  383.                else
  384.                {
  385.                   obj.__pagesHolders[src].setMask(obj.__pagesMasks[src]);
  386.                }
  387.                obj.__pagesHolders[src]._parent._visible = true;
  388.                obj.__pagesProcess[src] = _loc2_;
  389.                if(obj._model == undefined)
  390.                {
  391.                   obj._model = obj._broker.objects[obj._const.MODEL_OBJ_ID];
  392.                }
  393.                obj._baseObject.onPageLoad(obj._stripItem(src),obj.__pagesHolders[src].pageNumber);
  394.             }
  395.             else
  396.             {
  397.                obj._pagesComplete = false;
  398.             }
  399.             if(_loc2_ == 100 && obj.__pagesHolders[src].getBytesLoaded() > 4)
  400.             {
  401.                obj.__checkCompleted[src] = 1;
  402.             }
  403.          }
  404.       }
  405.    }
  406.    if(obj._soundComplete && (obj._pagesComplete || obj.loadOnDemand))
  407.    {
  408.       clearInterval(obj._mediaInterval);
  409.       obj._baseObject._onMediaComplete();
  410.       if(obj._pagesComplete)
  411.       {
  412.          obj._baseObject.progress = 100;
  413.          obj.preloader.removeMovieClip();
  414.       }
  415.    }
  416. };
  417. FFlippingBookCache.prototype._loadPages = function()
  418. {
  419.    var _loc6_ = this._realPages.length;
  420.    var _loc2_ = 0;
  421.    while(_loc2_ < _loc6_)
  422.    {
  423.       if(this.__pagesLinks[this._realPages[_loc2_]] == undefined)
  424.       {
  425.          this.__pagesLinks[this._realPages[_loc2_]] = this.__createPage(this._const.DEF_PAGE_NAME + "_" + _loc2_,this._realPages[_loc2_]);
  426.          this.__pagesLinks[this._realPages[_loc2_]]._y = (- this._pageHeight) / 2;
  427.          this.__pagesLinks[this._realPages[_loc2_]]._visible = false;
  428.       }
  429.       _loc2_ = _loc2_ + 1;
  430.    }
  431.    for(src in this.__pagesLinks)
  432.    {
  433.       this.__pagesLoading[src] = false;
  434.       var _loc4_ = this._baseObject.pageParameters[this._baseObject.pageIndexes[src]];
  435.       var _loc5_ = this.__pagesHolders[src].attachMovie(this._stripItem(src),this._const.PAGE_MEDIA_NAME,0);
  436.       if(_loc5_ == undefined && src != this._const.TRANSPARENT_PAGE1 && src != this._const.TRANSPARENT_PAGE2 && src != this._const.EMPTY_PAGE)
  437.       {
  438.          _loc4_ = this._baseObject.pageParameters[this._baseObject.pageIndexes[src]];
  439.          this.__pagesHolders[src]._parent.params = new Object();
  440.          this.__pagesHolders[src]._parent.params = _loc4_;
  441.          this._baseObject._setPageParameters(this.__pagesHolders[src],src,false);
  442.          this.__pagesProcess[src] = 0;
  443.          this.__pagesExt[src] = true;
  444.          this.__pagesTimeouts[src] = this._const.PAGE_TIMEOUT;
  445.          if(!this.loadOnDemand)
  446.          {
  447.             this.__pagesHolders[src]._parent._visible = false;
  448.             this.__pagesHolders[src].loadMovie(this._stripItem(src));
  449.          }
  450.          if(this.usePreloader)
  451.          {
  452.             var _loc3_ = this.__pagesLinks[src];
  453.             this.__placePreloader(_loc3_);
  454.             this.__pagesLoaders[src] = _loc3_[this._const.PAGE_PRELOADER_NAME];
  455.          }
  456.          this.__pagesHolders[src].progress = 0;
  457.       }
  458.       else
  459.       {
  460.          this.__pagesExt[src] = false;
  461.          this.__pagesProcess[src] = 100;
  462.          this.__pagesHolders[src].progress = 100;
  463.          this.__pagesHolders[src].params = new Object();
  464.          this.__pagesHolders[src].params = _loc4_;
  465.          this._baseObject._setPageParameters(this.__pagesHolders[src].media,src,true);
  466.          this._baseObject._setVisible();
  467.          if(src != this._const.TRANSPARENT_PAGE1 && src != this._const.TRANSPARENT_PAGE2 && src != this._const.EMPTY_PAGE)
  468.          {
  469.             this.__pagesBacks[src]._visible = false;
  470.          }
  471.          if(this._baseObject.scaleContent)
  472.          {
  473.             this.__pagesHolders[src]._width = this._pageWidth;
  474.             this.__pagesHolders[src]._height = this._pageHeight;
  475.          }
  476.          else
  477.          {
  478.             this.__pagesHolders[src].setMask(this.__pagesMasks[src]);
  479.          }
  480.       }
  481.    }
  482. };
  483. FFlippingBookCache.prototype.__createPage = function(src, id)
  484. {
  485.    var _loc3_ = this._baseObject.createEmptyMovieClip(src,this._pagesDepth++);
  486.    var _loc4_ = _loc3_.createEmptyMovieClip(this._const.PAGE_HOLDER_PARENT_NAME,1);
  487.    if(id != this._const.TRANSPARENT_PAGE1 && id != this._const.TRANSPARENT_PAGE2)
  488.    {
  489.       var _loc5_ = _loc3_.createEmptyMovieClip(this._const.PAGE_BG_NAME,0);
  490.       var _loc6_ = _loc3_.createEmptyMovieClip(this._const.PAGE_SHADOW_LAYER_NAME,100);
  491.       this.__drawBack(_loc5_);
  492.       this.__pagesBacks[id] = _loc5_;
  493.       if(id != this._const.EMPTY_PAGE)
  494.       {
  495.          this.__pagesHolders[id] = _loc4_.createEmptyMovieClip(this._const.PAGE_HOLDER_NAME,0);
  496.          this.__pagesProcess[id] = 0;
  497.          if(!this._baseObject.scaleContent)
  498.          {
  499.             this.__pagesMasks[id] = _loc4_.createEmptyMovieClip(this._const.PAGE_MASK_NAME,100);
  500.             this.__drawBack(this.__pagesMasks[id]);
  501.          }
  502.       }
  503.       else
  504.       {
  505.          this.__pagesProcess[id] = 100;
  506.       }
  507.       var _loc0_ = null;
  508.       var _loc8_ = this.__pagesShadows1[id] = _loc6_.createEmptyMovieClip(this._const.PAGE_STATIC_SHADOW1_NAME,10);
  509.       var _loc0_ = null;
  510.       var _loc7_ = this.__pagesShadows2[id] = _loc6_.createEmptyMovieClip(this._const.PAGE_STATIC_SHADOW2_NAME,11);
  511.       this.__drawStaticShadows(_loc8_,_loc7_);
  512.    }
  513.    else
  514.    {
  515.       this.__pagesHolders[id] = 100;
  516.    }
  517.    return _loc3_;
  518. };
  519. FFlippingBookCache.prototype.__drawStaticShadows = function(mc1, mc2)
  520. {
  521.    var pw = this._pageWidth;
  522.    var sw = pw / 3;
  523.    var sh = this._pageHeight;
  524.    var colors = [0,0];
  525.    var ratios = [0,255];
  526.    var alphas = [0,20 * this.ssd];
  527.    var matrix = {matrixType:"box",x:pw - sw,y:0,w:sw,h:sh,r:0};
  528.    with(mc1)
  529.    {
  530.       moveTo(pw - sw,0);
  531.       beginGradientFill("linear",colors,alphas,ratios,matrix);
  532.       lineTo(pw,0);
  533.       lineTo(pw,sh);
  534.       lineTo(pw - sw,sh);
  535.       lineTo(pw - sw,0);
  536.       endFill();
  537.    }
  538.    colors = [0,0];
  539.    ratios = [0,255];
  540.    alphas = [20 * this.ssd,0];
  541.    matrix = {matrixType:"box",x:0,y:0,w:sw,h:sh,r:0};
  542.    with(mc2)
  543.    {
  544.       moveTo(0,0);
  545.       beginGradientFill("linear",colors,alphas,ratios,matrix);
  546.       lineTo(sw,0);
  547.       lineTo(sw,sh);
  548.       lineTo(0,sh);
  549.       lineTo(0,0);
  550.       endFill();
  551.    }
  552. };
  553. FFlippingBookCache.prototype.__placePreloader = function(mc)
  554. {
  555.    var _loc2_ = undefined;
  556.    switch(this._baseObject.preloaderType)
  557.    {
  558.       case "Progress Bar":
  559.          _loc2_ = "FBStandardPreloader";
  560.          break;
  561.       case "Round":
  562.          _loc2_ = "FBRoundPreloader";
  563.          break;
  564.       case "User Defined":
  565.          _loc2_ = this._baseObject.userPreloaderId;
  566.    }
  567.    var _loc3_ = mc.attachMovie(_loc2_,this._const.PAGE_PRELOADER_NAME,2);
  568.    var _loc5_ = this._pageWidth / 2;
  569.    var _loc4_ = this._pageHeight / 2;
  570.    _loc3_._x = Math.round(_loc5_);
  571.    _loc3_._y = Math.round(_loc4_);
  572.    _loc3_.setProgress(0);
  573. };
  574. FFlippingBookCache.prototype.__placeOverallPreloader = function()
  575. {
  576.    var _loc2_ = undefined;
  577.    switch(this._baseObject.preloaderType)
  578.    {
  579.       case "Progress Bar":
  580.          _loc2_ = "FBStandardPreloader";
  581.          break;
  582.       case "Round":
  583.          _loc2_ = "FBRoundPreloader";
  584.          break;
  585.       case "User Defined":
  586.          _loc2_ = this._baseObject.userPreloaderId;
  587.    }
  588.    this.preloader = this._baseObject.createEmptyMovieClip("overall_preloader",20);
  589.    this.preloader = this.preloader.attachMovie(_loc2_,this._const.PAGE_PRELOADER_NAME,2);
  590.    loader._x = 0;
  591.    loader._y = 0;
  592. };
  593. FFlippingBookCache.prototype.__drawBack = function(mc)
  594. {
  595.    with(mc)
  596.    {
  597.       moveTo(0,0);
  598.       beginFill(this.bgColor,100);
  599.       lineTo(this._pageWidth,0);
  600.       lineTo(this._pageWidth,this._pageHeight);
  601.       lineTo(0,this._pageHeight);
  602.       lineTo(0,0);
  603.       endFill();
  604.    }
  605. };
  606. FFlippingBookCache.prototype.getPage = function(src)
  607. {
  608.    var _loc3_ = this.__pagesLinks[src];
  609.    if(!this.loadOnDemand)
  610.    {
  611.       return _loc3_;
  612.    }
  613.    if(!this.__pagesLoading[src] && this.__pagesProcess[src] == 0 || !this.cachePages && this.__pagesExt[src] && this.__pagesProcess[src] == 100)
  614.    {
  615.       this.__pagesHolders[src]._parent._visible = false;
  616.       this.__pagesHolders[src].loadMovie(this._stripItem(src));
  617.       this.__pagesLoading[src] = true;
  618.       this.__pagesBacks[src]._visible = true;
  619.       this.__pagesLoaders[src]._visible = true;
  620.       if(!this._pagesInterval)
  621.       {
  622.          this._pagesInterval = setInterval(this.__checkPages,this._const.MEDIA_INTERVAL,this);
  623.       }
  624.    }
  625.    return _loc3_;
  626. };
  627. FFlippingBookCache.prototype.__checkPages = function(obj)
  628. {
  629.    var _loc3_ = true;
  630.    for(src in obj.__pagesLoading)
  631.    {
  632.       if(obj.__pagesLoading[src])
  633.       {
  634.          var _loc2_ = obj.__pagesHolders[src].getBytesLoaded() / obj.__pagesHolders[src].getBytesTotal() * 100;
  635.          if(obj.usePreloader)
  636.          {
  637.             obj.__pagesLoaders[src].setProgress(_loc2_);
  638.          }
  639.          obj.__pagesTimeouts[src] -= obj._const.MEDIA_INTERVAL;
  640.          obj.__pagesProcess[src] = _loc2_;
  641.          obj.__pagesHolders[src].progress = _loc2_;
  642.          if(_loc2_ == 100 && obj.__pagesHolders[src].getBytesLoaded() > 4 && obj.__checkCompleted[src] == 1 && !isNaN(_loc2_))
  643.          {
  644.             obj._baseObject._setPageParameters(obj.__pagesHolders[src],src,true);
  645.             obj.__pagesBacks[src]._visible = false;
  646.             obj._baseObject._setVisible();
  647.             if(obj.cachePages)
  648.             {
  649.                obj.__pagesLoaders[src]._visible = false;
  650.                obj.__pagesProcess[src] = 100;
  651.             }
  652.             else
  653.             {
  654.                obj.__pagesLoaders[src]._visible = false;
  655.                obj.__pagesLoaders[src].setProgress(0);
  656.                obj.__checkCompleted[src] = undefined;
  657.             }
  658.             if(obj._baseObject.scaleContent)
  659.             {
  660.                obj.__pagesHolders[src]._width = obj._pageWidth;
  661.                obj.__pagesHolders[src]._height = obj._pageHeight;
  662.             }
  663.             else
  664.             {
  665.                obj.__pagesHolders[src].setMask(obj.__pagesMasks[src]);
  666.             }
  667.             obj.__pagesHolders[src]._parent._visible = true;
  668.             obj.__pagesLoading[src] = false;
  669.             if(obj._model == undefined)
  670.             {
  671.                obj._model = obj._broker.objects[obj._const.MODEL_OBJ_ID];
  672.             }
  673.             obj._baseObject.onPageLoad(obj._stripItem(src),obj.__pagesHolders[src].pageNumber);
  674.          }
  675.          else
  676.          {
  677.             _loc3_ = false;
  678.          }
  679.          if(_loc2_ == 100 && obj.__pagesHolders[src].getBytesLoaded() > 4)
  680.          {
  681.             obj.__checkCompleted[src] = 1;
  682.          }
  683.       }
  684.    }
  685.    if(_loc3_)
  686.    {
  687.       clearInterval(obj._pagesInterval);
  688.       obj._pagesInterval = undefined;
  689.    }
  690. };
  691. FFlippingBookCache.prototype.setPage = function(page, src, i, pageNum, dir)
  692. {
  693.    if(this._baseObject.loadOnDemand)
  694.    {
  695.       if(i == 1 || i == 3)
  696.       {
  697.          var _loc10_ = this._baseObject.cacheSize;
  698.          var _loc6_ = new Array();
  699.          var _loc5_ = new Array();
  700.          var _loc7_ = this._baseObject._model._realPages.length;
  701.          var _loc15_ = 0;
  702.          var _loc3_ = pageNum - _loc10_;
  703.          while(_loc3_ <= pageNum + _loc10_)
  704.          {
  705.             if(_loc3_ >= 0 && _loc3_ < _loc7_)
  706.             {
  707.                _loc15_;
  708.                _loc6_[_loc15_++] = _loc3_;
  709.             }
  710.             _loc3_ = _loc3_ + 1;
  711.          }
  712.          var _loc14_ = _loc6_[0];
  713.          var _loc16_ = _loc6_[_loc15_ - 1];
  714.          _loc15_ = 0;
  715.          _loc3_ = 0;
  716.          while(_loc3_ < _loc7_)
  717.          {
  718.             var _loc2_ = this._baseObject._model._realPages[_loc3_];
  719.             if((_loc3_ < _loc14_ || _loc3_ > _loc16_) && this.__pagesExt[_loc2_] && (this.__pagesLoading[_loc2_] || this.__checkCompleted[_loc2_] == 1))
  720.             {
  721.                _loc15_;
  722.                _loc5_[_loc15_++] = _loc3_;
  723.             }
  724.             _loc3_ = _loc3_ + 1;
  725.          }
  726.          var _loc4_ = 0;
  727.          while(_loc4_ < _loc6_.length)
  728.          {
  729.             _loc2_ = this._baseObject._model._realPages[_loc6_[_loc4_]];
  730.             if(this.__pagesExt[_loc2_] && !this.__pagesLoading[_loc2_] && this.__pagesProcess[_loc2_] == 0)
  731.             {
  732.                this.getPage(_loc2_);
  733.                this.__pagesLoading[_loc2_] = true;
  734.             }
  735.             _loc4_ = _loc4_ + 1;
  736.          }
  737.          _loc4_ = 0;
  738.          while(_loc4_ < _loc5_.length)
  739.          {
  740.             if(_loc5_[_loc4_] > 0 && _loc5_[_loc4_] < _loc7_)
  741.             {
  742.                _loc2_ = this._baseObject._model._realPages[_loc5_[_loc4_]];
  743.                this.__pagesProcess[_loc2_] = 0;
  744.                this.__pagesLoading[_loc2_] = false;
  745.                this.__checkCompleted[_loc2_] = 0;
  746.                var _loc8_ = this.__pagesHolders[_loc2_].pageNumber;
  747.                this.__pagesHolders[_loc2_].loaded = false;
  748.                unloadMovie(this.__pagesHolders[_loc2_]);
  749.                this._baseObject.onPageUnload(_loc8_);
  750.             }
  751.             _loc4_ = _loc4_ + 1;
  752.          }
  753.       }
  754.    }
  755.    if(this._view == undefined)
  756.    {
  757.       this._view = this._broker.objects[this._const.VIEW_OBJ_ID];
  758.    }
  759.    var _loc11_ = this.getPage(src);
  760.    var _loc17_ = page;
  761.    this.__pagesDepths[i] = _loc11_.getDepth();
  762.    _loc17_.swapDepths(_loc11_);
  763.    _loc11_._x = _loc17_._x;
  764.    _loc11_._y = _loc17_._y;
  765.    _loc11_._rotation = _loc17_._rotation;
  766.    _loc17_._visible = false;
  767.    if(i < 3)
  768.    {
  769.       _loc11_._visible = true;
  770.    }
  771.    if((i == 1 || i == 2) && (src == this._const.TRANSPARENT_PAGE1 || src == this._const.TRANSPARENT_PAGE2))
  772.    {
  773.       this._view._transpPage = i;
  774.    }
  775.    if(i == 4 && (src == this._const.TRANSPARENT_PAGE1 || src == this._const.TRANSPARENT_PAGE2))
  776.    {
  777.       this._view._transpPage04 = true;
  778.    }
  779.    else
  780.    {
  781.       this._view._transpPage04 = false;
  782.    }
  783.    switch(i)
  784.    {
  785.       case 1:
  786.          this._view.__page01 = _loc11_;
  787.          this.__pagesShadows1[src]._visible = true;
  788.          this.__pagesShadows2[src]._visible = false;
  789.          break;
  790.       case 2:
  791.          this._view.__page02 = _loc11_;
  792.          this.__pagesShadows1[src]._visible = false;
  793.          this.__pagesShadows2[src]._visible = true;
  794.          break;
  795.       case 3:
  796.          this._view.__page03 = _loc11_;
  797.          if(this._view.__ox > 0)
  798.          {
  799.             this.__pagesShadows1[src]._visible = true;
  800.             this.__pagesShadows2[src]._visible = false;
  801.          }
  802.          else
  803.          {
  804.             this.__pagesShadows1[src]._visible = false;
  805.             this.__pagesShadows2[src]._visible = true;
  806.          }
  807.          break;
  808.       case 4:
  809.          this._view.__page04 = _loc11_;
  810.          if(this._view.__ox < 0)
  811.          {
  812.             this.__pagesShadows1[src]._visible = true;
  813.             this.__pagesShadows2[src]._visible = false;
  814.          }
  815.          else
  816.          {
  817.             this.__pagesShadows1[src]._visible = false;
  818.             this.__pagesShadows2[src]._visible = true;
  819.          }
  820.    }
  821. };
  822. FFlippingBookCache.prototype.setSize = function(w, h)
  823. {
  824.    this._pageWidth = w / 2;
  825.    this._pageHeight = h;
  826.    for(link in this.__pagesHolders)
  827.    {
  828.       if(this._baseObject.scaleContent && this.__pagesProcess[link] == 100)
  829.       {
  830.          this.__pagesHolders[link]._width = w / 2;
  831.          this.__pagesHolders[link]._height = h;
  832.       }
  833.       this.__pagesHolders[link]._parent._parent._y = (- h) / 2;
  834.    }
  835.    for(id in this.__pagesShadows1)
  836.    {
  837.       this.__pagesShadows1[id]._width = w / 6;
  838.       this.__pagesShadows1[id]._height = h;
  839.    }
  840.    for(id in this.__pagesShadows2)
  841.    {
  842.       this.__pagesShadows2[id]._width = w / 6;
  843.       this.__pagesShadows2[id]._height = h;
  844.    }
  845.    for(id in this.__pagesBacks)
  846.    {
  847.       this.__pagesBacks[id]._width = w / 2;
  848.       this.__pagesBacks[id]._height = h;
  849.    }
  850.    for(id in this.__pagesLoaders)
  851.    {
  852.       loader;
  853.       var loader = this.__pagesLoaders[id];
  854.       var _loc5_ = w / 4;
  855.       var _loc4_ = h / 2;
  856.       loader._x = _loc5_ - loader._width / 2;
  857.       loader._y = _loc4_ - loader._height / 2;
  858.    }
  859.    for(mask in this.__pagesMasks)
  860.    {
  861.       this.__pagesMasks[mask]._width = w / 2;
  862.       this.__pagesMasks[mask]._height = h;
  863.    }
  864. };
  865. FFlippingBookCache.prototype.restoreDirectGotoPages = function()
  866. {
  867.    this._view.__page01.setMask(null);
  868.    this._view.__page02.setMask(null);
  869.    this._view.__mask12.clear();
  870.    this._view.__page01._visible = false;
  871.    this._view.__page02._visible = false;
  872.    this._view.__page01.swapDepths(this.__pagesDepths[1]);
  873.    this._view.__page02.swapDepths(this.__pagesDepths[2]);
  874.    this._view.__page01 = this._view.tmp01;
  875.    this._view.__page02 = this._view.tmp02;
  876.    this._view._transpPage = 0;
  877. };
  878. FFlippingBookCache.prototype.showUnderlyingPages = function(direction, _pageNumber)
  879. {
  880.    var _loc2_ = this._baseObject;
  881.    var _loc3_ = _loc2_.leftPageNumber;
  882.    var _loc4_ = _loc2_.rightPageNumber;
  883.    var _loc8_ = _loc2_.totalPages;
  884.    var _loc7_ = _loc2_._view._bookState == _loc2_._constants.GOTOPAGE_STATE;
  885.    if(_loc7_ && direction == undefined)
  886.    {
  887.       return undefined;
  888.    }
  889.    if(!this.misNaN(this.lv_n) && this.lv_n != _loc3_ && !(_loc7_ && this.lv_n == _loc3_ - 2))
  890.    {
  891.       var _loc5_ = _loc2_.getPageLink(this.lv_n);
  892.       if(_loc5_._parent.media != undefined)
  893.       {
  894.          _loc5_ = _loc5_._parent;
  895.       }
  896.       var _loc6_ = _loc5_._parent._parent;
  897.       _loc6_._visible = false;
  898.    }
  899.    if(!this.misNaN(this.rv_n) && this.rv_n != _loc4_ && !(_loc7_ && this.rv_n == _loc4_ + 2))
  900.    {
  901.       _loc5_ = _loc2_.getPageLink(this.rv_n);
  902.       if(_loc5_._parent.media != undefined)
  903.       {
  904.          _loc5_ = _loc5_._parent;
  905.       }
  906.       _loc6_ = _loc5_._parent._parent;
  907.       _loc6_._visible = false;
  908.    }
  909.    this.lv_n = this.rv_n = undefined;
  910.    if(_loc3_ != undefined && _loc3_ - 2 >= 0)
  911.    {
  912.       this.lv_n = _loc3_ - 2;
  913.    }
  914.    if(_loc4_ != undefined && _loc3_ + 2 <= _loc8_ - 1)
  915.    {
  916.       this.rv_n = _loc4_ + 2;
  917.    }
  918.    if(direction == "left")
  919.    {
  920.       this.lv_n = _pageNumber;
  921.    }
  922.    else if(direction == "right")
  923.    {
  924.       this.rv_n = _pageNumber;
  925.    }
  926.    if(!this.misNaN(this.lv_n))
  927.    {
  928.       _loc5_ = _loc2_.getPageLink(this.lv_n);
  929.       if(_loc5_._parent.media != undefined)
  930.       {
  931.          _loc5_ = _loc5_._parent;
  932.       }
  933.       _loc6_ = _loc5_._parent._parent;
  934.       _loc6_._visible = true;
  935.       _loc6_._x = - this._pageWidth;
  936.       _loc6_.shadows.STATICSH2._visible = false;
  937.    }
  938.    if(!this.misNaN(this.rv_n))
  939.    {
  940.       _loc5_ = _loc2_.getPageLink(this.rv_n);
  941.       if(_loc5_._parent.media != undefined)
  942.       {
  943.          _loc5_ = _loc5_._parent;
  944.       }
  945.       _loc6_ = _loc5_._parent._parent;
  946.       _loc6_._visible = true;
  947.       _loc6_._x = 0;
  948.       _loc6_.shadows.STATICSH1._visible = false;
  949.    }
  950. };
  951. FFlippingBookCache.prototype.misNaN = function(val)
  952. {
  953.    if(isNaN(val) || val == undefined)
  954.    {
  955.       return true;
  956.    }
  957.    return false;
  958. };
  959. FFlippingBookCache.prototype.restorePages = function()
  960. {
  961.    this._view.__page01.setMask(null);
  962.    this._view.__page02.setMask(null);
  963.    this._view.__page03.setMask(null);
  964.    this._view.__page04.setMask(null);
  965.    this._view._drawShadow03();
  966.    this._view.__mask03.clear();
  967.    this._view.__mask12.clear();
  968.    this._view.__page01._visible = false;
  969.    this._view.__page02._visible = false;
  970.    this._view.__page01.swapDepths(this.__pagesDepths[1]);
  971.    this._view.__page02.swapDepths(this.__pagesDepths[2]);
  972.    this._view.__page03.swapDepths(this.__pagesDepths[3]);
  973.    this._view.__page04.swapDepths(this.__pagesDepths[4]);
  974.    this._view.__page03._x = - this._view._pageWidth;
  975.    this._view.__page03._y = (- this._view._pageHeight) / 2;
  976.    this._view.__page03._rotation = 0;
  977.    this._view.__page04._x = 0;
  978.    this._view.__page04._y = (- this._view._pageHeight) / 2;
  979.    this._view.__page04._rotation = 0;
  980.    this._view.__page01 = this._view.tmp01;
  981.    this._view.__page02 = this._view.tmp02;
  982.    this._view.__page03 = this._view.tmp03;
  983.    this._view.__page04 = this._view.tmp04;
  984.    this._view._transpPage = 0;
  985. };
  986. FFlippingBookCache.prototype.restoreWorkPages = function()
  987. {
  988.    this._view.__page01.setMask(null);
  989.    this._view.__page02.setMask(null);
  990.    this._view.__mask03.clear();
  991.    this._view.__mask12.clear();
  992.    this._view._drawShadow12();
  993.    this._view._drawShadow03();
  994.    this._view._drawShadow04();
  995.    this._view.__page03._visible = false;
  996.    this._view.__page04._visible = false;
  997.    this._view.__page03.swapDepths(this.__pagesDepths[3]);
  998.    this._view.__page04.swapDepths(this.__pagesDepths[4]);
  999.    this._view.__page03._x = - this._view._pageWidth;
  1000.    this._view.__page03._y = (- this._view._pageHeight) / 2;
  1001.    this._view.__page03._rotation = 0;
  1002.    this._view.__page04._x = 0;
  1003.    this._view.__page04._y = (- this._view._pageHeight) / 2;
  1004.    this._view.__page04._rotation = 0;
  1005.    this._view.__page03 = this._view.tmp03;
  1006.    this._view.__page04 = this._view.tmp04;
  1007.    this.showUnderlyingPages();
  1008. };
  1009. FFlippingBookModel.prototype.getUserPageNumber = function(src)
  1010. {
  1011.    var _loc4_ = this._userPages.length;
  1012.    var _loc2_ = 0;
  1013.    while(_loc2_ < _loc4_)
  1014.    {
  1015.       var _loc3_ = this._userPages[_loc2_];
  1016.       if(_loc3_ == src)
  1017.       {
  1018.          return _loc2_;
  1019.       }
  1020.       _loc2_ = _loc2_ + 1;
  1021.    }
  1022.    if(src == this._const.EMPTY_PAGE)
  1023.    {
  1024.       return _loc4_;
  1025.    }
  1026. };
  1027. FFlippingBookModel.prototype._markEqual = function()
  1028. {
  1029.    var _loc10_ = this._const.DELIMITER;
  1030.    var _loc7_ = this._userPages.length;
  1031.    var _loc5_ = new Array(_loc7_);
  1032.    var _loc6_ = 0;
  1033.    while(_loc6_ < _loc7_)
  1034.    {
  1035.       _loc5_[_loc6_] = false;
  1036.       _loc6_ = _loc6_ + 1;
  1037.    }
  1038.    var _loc4_ = 0;
  1039.    while(_loc4_ < _loc7_)
  1040.    {
  1041.       var _loc9_ = this._userPages[_loc4_];
  1042.       var _loc11_ = _loc4_;
  1043.       var _loc8_ = 0;
  1044.       var _loc2_ = 0;
  1045.       while(_loc2_ < _loc7_)
  1046.       {
  1047.          var _loc3_ = this._userPages[_loc2_];
  1048.          if(_loc3_ == _loc9_ && !_loc5_[_loc2_])
  1049.          {
  1050.             _loc8_;
  1051.             this._userPages[_loc2_] = _loc8_++ + _loc10_ + this._userPages[_loc2_];
  1052.             _loc5_[_loc2_] = true;
  1053.          }
  1054.          _loc2_ = _loc2_ + 1;
  1055.       }
  1056.       _loc4_ = _loc4_ + 1;
  1057.    }
  1058. };
  1059. FFlippingBookModel.prototype.getUserCurrentPage2 = function()
  1060. {
  1061.    var _loc2_ = this._userCurrentPage;
  1062.    if(this._view.__ox > 0)
  1063.    {
  1064.       _loc2_ += 1;
  1065.    }
  1066.    return _loc2_;
  1067. };
  1068. FFlippingBookModel.prototype.__addPage = function(index, pageSrc)
  1069. {
  1070.    this._realPages.splice(index,0,pageSrc);
  1071. };
  1072. FFlippingBookModel.prototype._copyArray = function(src)
  1073. {
  1074.    var _loc3_ = new Array();
  1075.    var _loc1_ = 0;
  1076.    while(_loc1_ < src.length)
  1077.    {
  1078.       _loc3_[_loc1_] = src[_loc1_];
  1079.       _loc1_ = _loc1_ + 1;
  1080.    }
  1081.    return _loc3_;
  1082. };
  1083. FFlippingBookModel.prototype._makeItReal = function()
  1084. {
  1085.    this._realPages = this._copyArray(this._userPages);
  1086.    var _loc2_ = true;
  1087.    if(this._realPages.length % 2 == 0)
  1088.    {
  1089.       _loc2_ = false;
  1090.    }
  1091.    if(_loc2_)
  1092.    {
  1093.       this.__addPage(this._realPages.length,this._const.EMPTY_PAGE);
  1094.    }
  1095.    if(!this.alwaysOpened)
  1096.    {
  1097.       this.__addPage(0,this._const.TRANSPARENT_PAGE1);
  1098.       this.__addPage(this._realPages.length,this._const.TRANSPARENT_PAGE2);
  1099.    }
  1100. };
  1101. FFlippingBookModel.prototype._realPageNumber = function(n)
  1102. {
  1103.    if(n < 0)
  1104.    {
  1105.       n = 0;
  1106.    }
  1107.    else if(n >= this._userPages.length)
  1108.    {
  1109.       n = this._userPages.length - 1;
  1110.       if(!this.alwaysOpened && this._userPages.length % 2 != 0)
  1111.       {
  1112.          n = n + 1;
  1113.       }
  1114.    }
  1115.    if(!this.alwaysOpened)
  1116.    {
  1117.       n = n + 1;
  1118.    }
  1119.    if(this._userPages.length == 0)
  1120.    {
  1121.       n = 0;
  1122.    }
  1123.    if(n % 2 != 0)
  1124.    {
  1125.       n = n - 1;
  1126.    }
  1127.    return n;
  1128. };
  1129. FFlippingBookModel.prototype.putPage = function(isDirect, direct_dir)
  1130. {
  1131.    if(this._view == undefined)
  1132.    {
  1133.       this._view = this._broker.objects[this._const.VIEW_OBJ_ID];
  1134.    }
  1135.    var _loc4_ = this.__direction;
  1136.    this.__direction = -1;
  1137.    switch(_loc4_)
  1138.    {
  1139.       case 0:
  1140.          this._currentPage -= 2;
  1141.          this._userCurrentPage -= 2;
  1142.          break;
  1143.       case 1:
  1144.          this._currentPage += 2;
  1145.          this._userCurrentPage += 2;
  1146.    }
  1147.    this._cache.setPage(this._view.__page01,this._realPages[this._currentPage],1,this._currentPage,_loc4_);
  1148.    this._cache.setPage(this._view.__page02,this._realPages[this._currentPage + 1],2,this._currentPage + 1,_loc4_);
  1149.    this._curPageNumbers[0] = this.getUserPageNumber(this._realPages[this._currentPage]);
  1150.    this._curPageNumbers[1] = this.getUserPageNumber(this._realPages[this._currentPage + 1]);
  1151.    if(this._realPages[this._currentPage] == this._const.EMPTY_PAGE)
  1152.    {
  1153.       this._curPageNumbers[0] = this._userPages.length;
  1154.    }
  1155.    vsrc = this._baseObj.pagesSet[this._userCurrentPage];
  1156.    if(this._view._bookState != this._const.FLIP_GOTOPAGE_STATE)
  1157.    {
  1158.       if(_loc4_ == 1)
  1159.       {
  1160.          this._baseObj._setVisible();
  1161.          if(this._cache.__pagesExt[vsrc] == true)
  1162.          {
  1163.             this._baseObj.onPutPage(this._curPageNumbers[0],this._cache.__pagesHolders[this._userPages[this._curPageNumbers[0]]]);
  1164.          }
  1165.          else
  1166.          {
  1167.             this._baseObj.onPutPage(this._curPageNumbers[0],this._cache.__pagesHolders[this._userPages[this._curPageNumbers[0]]].media);
  1168.          }
  1169.       }
  1170.       else
  1171.       {
  1172.          var _loc3_ = this._cache.__pagesHolders[this._userPages[this._curPageNumbers[1]]];
  1173.          if(isDirect && direct_dir == 1)
  1174.          {
  1175.             _loc3_ = this._cache.__pagesHolders[this._userPages[this._curPageNumbers[0]]];
  1176.          }
  1177.          if(this._cache.__pagesExt[vsrc] == false)
  1178.          {
  1179.             _loc3_ = _loc3_.media;
  1180.          }
  1181.          var _loc2_ = this._curPageNumbers[1];
  1182.          if(_loc2_ == undefined)
  1183.          {
  1184.             _loc2_ = this._curPageNumbers[0] + 1;
  1185.          }
  1186.          if(isDirect && direct_dir == 1)
  1187.          {
  1188.             _loc2_ = _loc2_ - 1;
  1189.          }
  1190.          if(!(_loc2_ % 2))
  1191.          {
  1192.             this._userCurrentPage = _loc2_;
  1193.          }
  1194.          else if(this._baseObj.alwaysOpened)
  1195.          {
  1196.             this._userCurrentPage = _loc2_ - 1;
  1197.          }
  1198.          else
  1199.          {
  1200.             this._userCurrentPage = _loc2_ + 1;
  1201.          }
  1202.          this._baseObj._setVisible();
  1203.          this._baseObj.onPutPage(_loc2_,_loc3_);
  1204.       }
  1205.    }
  1206.    this._view.onSetPages(1,2);
  1207.    if(this._currentPage + 2 > this._realPages.length - 1)
  1208.    {
  1209.       this._baseObj.onLastPage();
  1210.    }
  1211.    else if(this._currentPage - 2 < 0)
  1212.    {
  1213.       this._baseObj.onFirstPage();
  1214.    }
  1215.    this._cache.showUnderlyingPages();
  1216. };
  1217. FFlippingBookModel.prototype.flipGotoForward = function(n)
  1218. {
  1219.    var _loc2_ = n - this._currentPage;
  1220.    if(this._currentPage != this._realPages.length - 2 && this._currentPage >= 0)
  1221.    {
  1222.       this._cache.setPage(this._view.__page03,this._realPages[this._currentPage + _loc2_],3,this._currentPage + _loc2_,1);
  1223.       this._cache.setPage(this._view.__page04,this._realPages[this._currentPage + _loc2_ + 1],4,this._currentPage + _loc2_ + 1,1);
  1224.       this._curPageNumbers[2] = this.getUserPageNumber(this._realPages[this._currentPage + _loc2_]);
  1225.       this._curPageNumbers[3] = this.getUserPageNumber(this._realPages[this._currentPage + _loc2_ + 1]);
  1226.       this.__direction = 1;
  1227.       if(this._curPageNumbers[3] == undefined)
  1228.       {
  1229.          var _loc3_ = undefined;
  1230.       }
  1231.       else
  1232.       {
  1233.          _loc3_ = this._curPageNumbers[3] + 2;
  1234.       }
  1235.       this._cache.showUnderlyingPages("right",_loc3_);
  1236.    }
  1237.    else
  1238.    {
  1239.       this._view._bookState = this._const.UNACTIVE_STATE;
  1240.    }
  1241. };
  1242. FFlippingBookModel.prototype.goForward = function()
  1243. {
  1244.    if(this._currentPage != this._realPages.length - 2 && this._currentPage >= 0)
  1245.    {
  1246.       this._cache.setPage(this._view.__page03,this._realPages[this._currentPage + 2],3,this._currentPage + 2,1);
  1247.       this._cache.setPage(this._view.__page04,this._realPages[this._currentPage + 3],4,this._currentPage + 3,1);
  1248.       this._curPageNumbers[2] = this.getUserPageNumber(this._realPages[this._currentPage + 2]);
  1249.       this._curPageNumbers[3] = this.getUserPageNumber(this._realPages[this._currentPage + 3]);
  1250.       this._cache.showUnderlyingPages("right",this._baseObj.rightPageNumber + 4);
  1251.       this.__direction = 1;
  1252.    }
  1253.    else
  1254.    {
  1255.       this._view._bookState = this._const.UNACTIVE_STATE;
  1256.    }
  1257. };
  1258. FFlippingBookModel.prototype.flipGotoBack = function(n)
  1259. {
  1260.    var _loc2_ = this._currentPage - n - 1;
  1261.    if(this._currentPage > 0)
  1262.    {
  1263.       this._cache.setPage(this._view.__page03,this._realPages[this._currentPage - _loc2_],3,this._currentPage - _loc2_,0);
  1264.       this._cache.setPage(this._view.__page04,this._realPages[this._currentPage - _loc2_ - 1],4,this._currentPage - _loc2_ - 1,0);
  1265.       this._curPageNumbers[2] = this.getUserPageNumber(this._realPages[this._currentPage - _loc2_]);
  1266.       this._curPageNumbers[3] = this.getUserPageNumber(this._realPages[this._currentPage - _loc2_ - 1]);
  1267.       this.__direction = 0;
  1268.       if(this._curPageNumbers[3] == undefined)
  1269.       {
  1270.          var _loc3_ = undefined;
  1271.       }
  1272.       else
  1273.       {
  1274.          _loc3_ = this._curPageNumbers[3] - 2;
  1275.       }
  1276.       this._cache.showUnderlyingPages("left",_loc3_);
  1277.    }
  1278.    else
  1279.    {
  1280.       this._view._bookState = this._const.UNACTIVE_STATE;
  1281.    }
  1282. };
  1283. FFlippingBookModel.prototype.goBack = function()
  1284. {
  1285.    if(this._currentPage > 0)
  1286.    {
  1287.       this._cache.setPage(this._view.__page03,this._realPages[this._currentPage - 1],3,this._currentPage - 1,0);
  1288.       this._cache.setPage(this._view.__page04,this._realPages[this._currentPage - 2],4,this._currentPage - 2,0);
  1289.       this._curPageNumbers[2] = this.getUserPageNumber(this._realPages[this._currentPage - 1]);
  1290.       this._curPageNumbers[3] = this.getUserPageNumber(this._realPages[this._currentPage - 2]);
  1291.       this._cache.showUnderlyingPages("left",this._baseObj.leftPageNumber - 4);
  1292.       this.__direction = 0;
  1293.    }
  1294.    else
  1295.    {
  1296.       this._view._bookState = this._const.UNACTIVE_STATE;
  1297.    }
  1298. };
  1299. FFlippingBookModel.prototype.getFlipGotoPage = function(n, state)
  1300. {
  1301.    if(state)
  1302.    {
  1303.       this._view._bookState = this._const.UNACTIVE_STATE;
  1304.       this._currentPage = this._last_current_page;
  1305.       this._view.directGotoPage(n);
  1306.       return undefined;
  1307.    }
  1308.    if(this._currentPage > n)
  1309.    {
  1310.       this.flipGotoBack(n);
  1311.    }
  1312.    else if(this._currentPage < n)
  1313.    {
  1314.       this.flipGotoForward(n);
  1315.    }
  1316.    else
  1317.    {
  1318.       this._view._bookState = this._const.UNACTIVE_STATE;
  1319.    }
  1320. };
  1321. FFlippingBookModel.prototype.getNextGotoPage = function(n)
  1322. {
  1323.    if(this._currentPage > n)
  1324.    {
  1325.       this.goBack();
  1326.    }
  1327.    else if(this._currentPage < n)
  1328.    {
  1329.       this.goForward();
  1330.    }
  1331.    else
  1332.    {
  1333.       this._baseObj.onEndGoto();
  1334.       this._view._bookState = this._const.UNACTIVE_STATE;
  1335.    }
  1336. };
  1337. FFlippingBookClass.prototype = new MovieClip();
  1338. FFlippingBookClass.prototype.getEnabledProp = function()
  1339. {
  1340.    return this.enabled;
  1341. };
  1342. FFlippingBookClass.prototype.setEnabledProp = function(v)
  1343. {
  1344.    this.enabled = v;
  1345. };
  1346. FFlippingBookClass.prototype.getTotalPages = function()
  1347. {
  1348.    return this.pagesSet.length;
  1349. };
  1350. FFlippingBookClass.prototype.getLeftPageNumber = function()
  1351. {
  1352.    var _loc2_ = 0;
  1353.    if(this.alwaysOpened)
  1354.    {
  1355.       _loc2_ = this._model._userCurrentPage;
  1356.    }
  1357.    else
  1358.    {
  1359.       _loc2_ = this._model._userCurrentPage - 1;
  1360.    }
  1361.    if(_loc2_ < 0)
  1362.    {
  1363.       _loc2_ = undefined;
  1364.    }
  1365.    return _loc2_;
  1366. };
  1367. FFlippingBookClass.prototype.getRightPageNumber = function()
  1368. {
  1369.    var _loc2_ = 0;
  1370.    if(!this.alwaysOpened)
  1371.    {
  1372.       _loc2_ = this._model._userCurrentPage;
  1373.    }
  1374.    else
  1375.    {
  1376.       _loc2_ = this._model._userCurrentPage + 1;
  1377.    }
  1378.    if(_loc2_ >= this.totalPages)
  1379.    {
  1380.       _loc2_ = undefined;
  1381.    }
  1382.    return _loc2_;
  1383. };
  1384. FFlippingBookClass.prototype.getAlwaysOpenedProp = function()
  1385. {
  1386.    return this.alwaysOpened;
  1387. };
  1388. FFlippingBookClass.prototype.getAutoFlipProp = function()
  1389. {
  1390.    return this.autoFlip;
  1391. };
  1392. FFlippingBookClass.prototype.setAutoFlipProp = function(v)
  1393. {
  1394.    this.autoFlip = v;
  1395.    if(this._view != undefined)
  1396.    {
  1397.       this._view._autoFlip = v;
  1398.    }
  1399. };
  1400. FFlippingBookClass.prototype.getFlipOnClick = function()
  1401. {
  1402.    return this.flipOnClick;
  1403. };
  1404. FFlippingBookClass.prototype.setFlipOnClick = function(v)
  1405. {
  1406.    this.flipOnClick = v;
  1407.    if(this._view != undefined)
  1408.    {
  1409.       this._view._flipOnClick = v;
  1410.    }
  1411. };
  1412. FFlippingBookClass.prototype.getMoveSpeedProp = function()
  1413. {
  1414.    return this.moveSpeed;
  1415. };
  1416. FFlippingBookClass.prototype.setMoveSpeedProp = function(v)
  1417. {
  1418.    this.moveSpeed = v;
  1419.    if(this._view != undefined)
  1420.    {
  1421.       this._view._pageSpeed = v / this._constants.SPEED_DIV;
  1422.    }
  1423. };
  1424. FFlippingBookClass.prototype.getCloseSpeedProp = function()
  1425. {
  1426.    return this.closeSpeed;
  1427. };
  1428. FFlippingBookClass.prototype.setCloseSpeedProp = function(v)
  1429. {
  1430.    this.closeSpeed = v;
  1431.    if(this._view != undefined)
  1432.    {
  1433.       this._view._closeSpeed = v / this._constants.SPEED_DIV;
  1434.    }
  1435. };
  1436. FFlippingBookClass.prototype.getGotoSpeedProp = function()
  1437. {
  1438.    return this.gotoSpeed;
  1439. };
  1440. FFlippingBookClass.prototype.setGotoSpeedProp = function(v)
  1441. {
  1442.    this.gotoSpeed = v;
  1443.    if(this._view != undefined)
  1444.    {
  1445.       this._view._gotoSpeed = v / this._constants.SPEED_DIV;
  1446.    }
  1447. };
  1448. FFlippingBookClass.prototype.getWidth = function()
  1449. {
  1450.    return this._bookWidth;
  1451. };
  1452. FFlippingBookClass.prototype.setWidth = function(w)
  1453. {
  1454.    var _loc2_ = this._bookHeight;
  1455.    this.setSize(w,_loc2_);
  1456. };
  1457. FFlippingBookClass.prototype.getHeight = function()
  1458. {
  1459.    return this._bookHeight;
  1460. };
  1461. FFlippingBookClass.prototype.setHeight = function(h)
  1462. {
  1463.    var _loc2_ = this._bookWidth;
  1464.    this.setSize(_loc2_,h);
  1465. };
  1466. FFlippingBookClass.prototype.getPageLink = function(pageNumber)
  1467. {
  1468.    var _loc2_ = this.pagesSet[pageNumber];
  1469.    if(this._cache.__pagesExt[_loc2_])
  1470.    {
  1471.       return this._cache.__pagesHolders[_loc2_];
  1472.    }
  1473.    return this._cache.__pagesHolders[_loc2_].media;
  1474. };
  1475. FFlippingBookClass.prototype.isPageVisible = function(pageNumber)
  1476. {
  1477.    var _loc2_ = this.getPageLink(pageNumber);
  1478.    return _loc2_.visible;
  1479. };
  1480. FFlippingBookClass.prototype.isPageLoaded = function(pageNumber)
  1481. {
  1482.    var _loc2_ = this.getPageLink(pageNumber);
  1483.    return _loc2_.loaded;
  1484. };
  1485. FFlippingBookClass.prototype.getPageURL = function(pageNumber)
  1486. {
  1487.    var _loc2_ = this.getPageLink(pageNumber);
  1488.    return _loc2_.URL;
  1489. };
  1490. FFlippingBookClass.prototype.getPageParams = function(pageNumber)
  1491. {
  1492.    var _loc2_ = this.getPageLink(pageNumber);
  1493.    return _loc2_.params;
  1494. };
  1495. FFlippingBookClass.prototype.isLeftPage = function(pageNumber)
  1496. {
  1497.    var _loc2_ = this.getPageLink(pageNumber);
  1498.    return _loc2_.isLeftPage;
  1499. };
  1500. FFlippingBookClass.prototype.isRightPage = function(pageNumber)
  1501. {
  1502.    var _loc2_ = this.getPageLink(pageNumber);
  1503.    return _loc2_.isRightPage;
  1504. };
  1505. FFlippingBookClass.prototype.flipCorner = function(cornerPosition)
  1506. {
  1507.    if(this._view != undefined)
  1508.    {
  1509.       this._view.flipCorner(cornerPosition);
  1510.    }
  1511. };
  1512. FFlippingBookClass.prototype.flipForward = function()
  1513. {
  1514.    if(this._view != undefined)
  1515.    {
  1516.       var _loc2_ = this._model._currentPage + 2;
  1517.       this._view.gotoPage(_loc2_);
  1518.    }
  1519. };
  1520. FFlippingBookClass.prototype.flipBack = function()
  1521. {
  1522.    if(this._view != undefined)
  1523.    {
  1524.       var _loc2_ = this._model._currentPage - 2;
  1525.       this._view.gotoPage(_loc2_);
  1526.    }
  1527. };
  1528. FFlippingBookClass.prototype.setSize = function(w, h)
  1529. {
  1530.    this._bookWidth = w;
  1531.    this._bookHeight = h;
  1532.    this._xscale = 100;
  1533.    this._yscale = 100;
  1534.    if(this._view != undefined && (this._view._bookState == this._constants.UNACTIVE_STATE || this._view._bookState == this._constants.INIT_STATE))
  1535.    {
  1536.       this._view.setSize(w,h);
  1537.    }
  1538.    this._cache.setSize(w,h);
  1539.    var _loc3_ = this._cache.__pagesHolders;
  1540.    for(var _loc4_ in _loc3_)
  1541.    {
  1542.       var _loc2_ = _loc3_[_loc4_];
  1543.       if(_loc2_.media != undefined)
  1544.       {
  1545.          _loc2_ = _loc2_.media;
  1546.       }
  1547.       this._setPageParameters(_loc2_,_loc4_,_loc2_.loaded);
  1548.    }
  1549. };
  1550. FFlippingBookClass.prototype._initLibraryPages = function()
  1551. {
  1552.    if(this.__alreadyInitialized)
  1553.    {
  1554.       return undefined;
  1555.    }
  1556.    var _loc3_ = this._cache.__pagesHolders;
  1557.    for(var _loc4_ in _loc3_)
  1558.    {
  1559.       var _loc2_ = _loc3_[_loc4_].media;
  1560.       if(_loc2_)
  1561.       {
  1562.          _loc2_.onInit();
  1563.          _loc2_.onPageLoad();
  1564.          this.onPageLoad(_loc2_.URL,_loc2_.pageNumber);
  1565.       }
  1566.    }
  1567.    this.__alreadyInitialized = true;
  1568. };
  1569. FFlippingBookClass.prototype._setPageParameters = function(page_mc, src, isLoaded)
  1570. {
  1571.    page_mc.params = this.pageParameters[this.pageIndexes[src]];
  1572.    page_mc.isExternal = this._cache.__pagesExt[src];
  1573.    page_mc.book = this;
  1574.    page_mc.URL = this._cache._stripItem(src);
  1575.    page_mc.pageNumber = this.pageIndexes[src];
  1576.    if(!page_mc.loaded && isLoaded)
  1577.    {
  1578.       page_mc.onPageLoad();
  1579.    }
  1580.    page_mc.loaded = isLoaded;
  1581.    if(page_mc.visible == undefined)
  1582.    {
  1583.       page_mc.visible = false;
  1584.    }
  1585.    page_mc.width = this._bookWidth / 2;
  1586.    page_mc.height = this._bookHeight;
  1587.    var _loc3_ = false;
  1588.    var _loc4_ = page_mc.pageNumber;
  1589.    if(this.alwaysOpened && !(_loc4_ % 2) || !this.alwaysOpened && _loc4_ % 2)
  1590.    {
  1591.       _loc3_ = true;
  1592.    }
  1593.    page_mc.isLeftPage = _loc3_;
  1594.    page_mc.isRightPage = !_loc3_;
  1595.    if(page_mc.isExternal == false)
  1596.    {
  1597.       page_mc.__holder = page_mc._parent._parent._parent;
  1598.    }
  1599.    else
  1600.    {
  1601.       page_mc.__holder = page_mc._parent._parent;
  1602.    }
  1603.    page_mc.onInit();
  1604. };
  1605. FFlippingBookClass.prototype._setVisible = function()
  1606. {
  1607.    var _loc4_ = this.totalPages;
  1608.    var _loc3_ = 0;
  1609.    while(_loc3_ < _loc4_)
  1610.    {
  1611.       var _loc2_ = this.getPageLink(_loc3_);
  1612.       if(_loc2_.visible && _loc2_.pageNumber != this.leftPageNumber && _loc2_.pageNumber != this.rightPageNumber)
  1613.       {
  1614.          _loc2_.visible = false;
  1615.          _loc2_.onClose();
  1616.       }
  1617.       _loc3_ = _loc3_ + 1;
  1618.    }
  1619.    var _loc5_ = this.getPageLink(this.leftPageNumber);
  1620.    var _loc6_ = this.getPageLink(this.rightPageNumber);
  1621.    if(!_loc5_.visible)
  1622.    {
  1623.       _loc5_.visible = true;
  1624.       if(_loc5_.onOpen)
  1625.       {
  1626.          _loc5_.onOpen();
  1627.          _loc5_.onOpenCalled = true;
  1628.       }
  1629.    }
  1630.    if(!_loc6_.visible)
  1631.    {
  1632.       _loc6_.visible = true;
  1633.       if(_loc6_.onOpen)
  1634.       {
  1635.          _loc6_.onOpen();
  1636.          _loc6_.onOpenCalled = true;
  1637.       }
  1638.    }
  1639. };
  1640. FFlippingBookClass.prototype._onXMLComplete = function()
  1641. {
  1642.    this._initFromCachedXML();
  1643.    this._getMedia();
  1644.    this.onXMLComplete();
  1645. };
  1646. FFlippingBookClass.prototype._getMedia = function()
  1647. {
  1648.    var _loc9_ = this.pagesSet.length;
  1649.    var _loc5_ = 0;
  1650.    while(_loc5_ < _loc9_)
  1651.    {
  1652.       var _loc3_ = this.pagesSet[_loc5_];
  1653.       if(_loc3_.indexOf("?") != -1)
  1654.       {
  1655.          this.pageParameters[_loc5_] = new Object();
  1656.          var _loc2_ = _loc3_.substr(_loc3_.indexOf("?") + 1,_loc3_.length);
  1657.          var _loc8_ = _loc3_.slice(0,_loc3_.indexOf("?"));
  1658.          this.pagesSet[_loc5_] = _loc8_;
  1659.          do
  1660.          {
  1661.             var _loc6_ = _loc2_.substr(0,_loc2_.indexOf("="));
  1662.             var _loc4_ = _loc2_.indexOf("&") != -1 ? _loc2_.indexOf("&") : _loc2_.length;
  1663.             var _loc7_ = _loc2_.slice(_loc2_.indexOf("=") + 1,_loc4_);
  1664.             this.pageParameters[_loc5_][_loc6_] = _loc7_;
  1665.             if(_loc2_.indexOf("&") == -1)
  1666.             {
  1667.                _loc2_ = "";
  1668.             }
  1669.             _loc2_ = _loc2_.substr(_loc2_.indexOf("&") + 1,_loc2_.length);
  1670.          }
  1671.          while(_loc2_.indexOf("=") != -1);
  1672.          
  1673.       }
  1674.       _loc5_ = _loc5_ + 1;
  1675.    }
  1676.    this._model = new FFlippingBookModel(this.pagesSet,this.firstPage,this.alwaysOpened,this._broker);
  1677.    _loc5_ = 0;
  1678.    while(_loc5_ < _loc9_)
  1679.    {
  1680.       this.pageIndexes[this.pagesSet[_loc5_]] = _loc5_;
  1681.       _loc5_ = _loc5_ + 1;
  1682.    }
  1683.    this._cache.loadMedia(this._model._realPages,this.flipSound,this.pageBack,this._bookWidth,this._bookHeight);
  1684. };
  1685. FFlippingBookClass.prototype._onMediaComplete = function()
  1686. {
  1687.    if(this._model._userPages.length > 0)
  1688.    {
  1689.       this._view = new FFlippingBookView(this._bookWidth,this._bookHeight,this.autoFlip,this.flipOnClick,this._broker);
  1690.    }
  1691.    this.onInit();
  1692. };
  1693. FFlippingBookClass.prototype._initFromCachedXML = function()
  1694. {
  1695.    var _loc8_ = this._cache.extXML;
  1696.    var _loc9_ = _loc8_.firstChild;
  1697.    var _loc3_ = _loc9_.childNodes;
  1698.    var _loc2_ = 0;
  1699.    while(_loc3_[_loc2_])
  1700.    {
  1701.       var _loc7_ = _loc3_[_loc2_].nodeName.toUpperCase();
  1702.       switch(_loc7_)
  1703.       {
  1704.          case this._constants.WIDTH_NODE_NAME:
  1705.             this._bookWidth = _loc3_[_loc2_].firstChild.nodeValue;
  1706.             break;
  1707.          case this._constants.HEIGHT_NODE_NAME:
  1708.             this._bookHeight = _loc3_[_loc2_].firstChild.nodeValue;
  1709.             break;
  1710.          case this._constants.FIRST_PAGE_NODE_NAME:
  1711.             this.firstPage = _loc3_[_loc2_].firstChild.nodeValue;
  1712.             break;
  1713.          case this._constants.ALWAYS_OPENED_NODE_NAME:
  1714.             this.alwaysOpened = _loc3_[_loc2_].firstChild.nodeValue;
  1715.             break;
  1716.          case this._constants.AUTOFLIP_NODE_NAME:
  1717.             this.autoFlip = _loc3_[_loc2_].firstChild.nodeValue;
  1718.             break;
  1719.          case this._constants.FLIP_ON_CLICK_NODE_NAME:
  1720.             this.flipOnClick = _loc3_[_loc2_].firstChild.nodeValue;
  1721.             break;
  1722.          case this._constants.SCALE_CONTENT_NODE_NAME:
  1723.             this.scaleContent = _loc3_[_loc2_].firstChild.nodeValue;
  1724.             break;
  1725.          case this._constants.MOVE_SPEED_NODE_NAME:
  1726.             this.moveSpeed = _loc3_[_loc2_].firstChild.nodeValue;
  1727.             break;
  1728.          case this._constants.CLOSE_SPEED_NODE_NAME:
  1729.             this.closeSpeed = _loc3_[_loc2_].firstChild.nodeValue;
  1730.             break;
  1731.          case this._constants.GOTO_SPEED_NODE_NAME:
  1732.             this.gotoSpeed = _loc3_[_loc2_].firstChild.nodeValue;
  1733.             break;
  1734.          case this._constants.FLIP_SOUND_NODE_NAME:
  1735.             this.flipSound = this._removeWhite(_loc3_[_loc2_].firstChild.nodeValue);
  1736.             break;
  1737.          case this._constants.PAGE_BACK_NODE_NAME:
  1738.             this.pageBack = _loc3_[_loc2_].firstChild.nodeValue;
  1739.             break;
  1740.          case this._constants.LOAD_ON_DEMAND_NODE_NAME:
  1741.             this.loadOnDemand = _loc3_[_loc2_].firstChild.nodeValue;
  1742.             break;
  1743.          case this._constants.CACHE_PAGES_NODE_NAME:
  1744.             this.cachePages = _loc3_[_loc2_].firstChild.nodeValue;
  1745.             break;
  1746.          case this._constants.USE_PRELOADER_NODE_NAME:
  1747.             this.usePreloader = _loc3_[_loc2_].firstChild.nodeValue;
  1748.             break;
  1749.          case this._constants.STATIC_SHADOWS_DEPTH_NODE_NAME:
  1750.             this.staticShadowsDepth = _loc3_[_loc2_].firstChild.nodeValue;
  1751.             break;
  1752.          case this._constants.DYNAMIC_SHADOWS_DEPTH_NODE_NAME:
  1753.             this.shadowsDepth = _loc3_[_loc2_].firstChild.nodeValue;
  1754.             break;
  1755.          case this._constants.PRELOADER_TYPE_NODE_NAME:
  1756.             this.preloaderType = _loc3_[_loc2_].firstChild.nodeValue;
  1757.             break;
  1758.          case this._constants.CACHE_SIZE_NODE_NAME:
  1759.             this.cacheSize = _loc3_[_loc2_].firstChild.nodeValue;
  1760.             break;
  1761.          case this._constants.USER_PRELOADER_NODE_NAME:
  1762.             this.userPreloaderId = _loc3_[_loc2_].firstChild.nodeValue;
  1763.             break;
  1764.          case this._constants.PAGES_NODE_NAME:
  1765.             var _loc4_ = 0;
  1766.             var _loc5_ = _loc3_[_loc2_].childNodes;
  1767.             this.pagesSet = new Array();
  1768.             while(_loc5_[_loc4_])
  1769.             {
  1770.                var _loc6_ = this._removeWhite(_loc5_[_loc4_].firstChild.nodeValue);
  1771.                this.pagesSet.push(_loc6_);
  1772.                _loc4_ = _loc4_ + 1;
  1773.             }
  1774.       }
  1775.       _loc2_ = _loc2_ + 1;
  1776.    }
  1777.    this._validateParameters();
  1778. };
  1779. FFlippingBookClass.prototype._removeWhite = function(str)
  1780. {
  1781.    var _loc1_ = str;
  1782.    while(_loc1_.charAt(0) == " ")
  1783.    {
  1784.       _loc1_ = _loc1_.substr(1,_loc1_.length);
  1785.    }
  1786.    while(_loc1_.charAt(_loc1_.length - 1) == " ")
  1787.    {
  1788.       _loc1_ = _loc1_.substr(0,_loc1_.length - 1);
  1789.    }
  1790.    return _loc1_;
  1791. };
  1792. FFlippingBookClass.prototype._validateNumber = function(param, min, max, def)
  1793. {
  1794.    if(typeof param != this._constants.NUM_TYPE_NAME)
  1795.    {
  1796.       param = this._removeWhite(param);
  1797.       if(!isNaN(Number(param)))
  1798.       {
  1799.          param = Number(param);
  1800.       }
  1801.       else
  1802.       {
  1803.          param = def;
  1804.       }
  1805.    }
  1806.    if(param > max)
  1807.    {
  1808.       param = max;
  1809.    }
  1810.    if(param < min)
  1811.    {
  1812.       param = min;
  1813.    }
  1814.    return param;
  1815. };
  1816. FFlippingBookClass.prototype._validateBoolean = function(param, def)
  1817. {
  1818.    if(typeof param != this._constants.BOOL_TYPE_NAME)
  1819.    {
  1820.       param = param.toUpperCase();
  1821.       if(param.indexOf(this._constants.BOOL_TRUE_VAL) != -1)
  1822.       {
  1823.          param = true;
  1824.       }
  1825.       else if(param.indexOf(this._constants.BOOL_FALSE_VAL) != -1)
  1826.       {
  1827.          param = false;
  1828.       }
  1829.       else
  1830.       {
  1831.          param = def;
  1832.       }
  1833.    }
  1834.    return param;
  1835. };
  1836. FFlippingBookClass.prototype._validateColor = function(param)
  1837. {
  1838.    param = this._removeWhite(param);
  1839.    if(param < 0 || param > 16777215)
  1840.    {
  1841.       param = this._constants.DEF_PAGEBACK;
  1842.    }
  1843.    return param;
  1844. };
  1845. FFlippingBookClass.prototype._validateParameters = function()
  1846. {
  1847.    this._bookWidth = this._validateNumber(this._bookWidth,0,Infinity,this._constants.DEF_WIDTH);
  1848.    this._bookHeight = this._validateNumber(this._bookHeight,0,Infinity,this._constants.DEF_HEIGHT);
  1849.    this.firstPage = this._validateNumber(this.firstPage,0,Infinity,this._constants.DEF_FIRST_PAGE);
  1850.    this.moveSpeed = this._validateNumber(this.moveSpeed,0,Infinity,this._constants.DEF_MOVE_SPEED);
  1851.    this.closeSpeed = this._validateNumber(this.closeSpeed,0,Infinity,this._constants.DEF_CLOSE_SPEED);
  1852.    this.gotoSpeed = this._validateNumber(this.gotoSpeed,0,Infinity,this._constants.DEF_GOTO_SPEED);
  1853.    this.autoFlip = this._validateNumber(this.autoFlip,0,Infinity,this._constants.DEF_AUTOFLIP);
  1854.    this._cache.sd = this.shadowsDepth = this._validateNumber(this.shadowsDepth,0,Infinity,this._constants.DEF_SHADOWS_DEPTH);
  1855.    this._cache.ssd = this.staticShadowsDepth = this._validateNumber(this.staticShadowsDepth,0,Infinity,this._constants.DEF_SHADOWS_DEPTH);
  1856.    this.pageBack = this._validateColor(this.pageBack);
  1857.    this.alwaysOpened = this._validateBoolean(this.alwaysOpened,this._constants.DEF_ALWAYS_OPENED);
  1858.    this.flipOnClick = this._validateBoolean(this.flipOnClick,this._constants.DEF_FLIP_ON_CLICK);
  1859.    this.loadOnDemand = this._validateBoolean(this.loadOnDemand,this._constants.DEF_LOAD_ON_DEMAND);
  1860.    this.cachePages = this._validateBoolean(this.cachePages,this._constants.DEF_CACHE_PAGES);
  1861.    this.usePreloader = this._validateBoolean(this.usePreloader,this._constants.DEF_USE_PRELOADER);
  1862.    this.scaleContent = this._validateBoolean(this.scaleContent,this._constants.DEF_SCALE_CONTENT);
  1863.    this.preloaderType = this._removeWhite(this.preloaderType);
  1864.    if(this.preloaderType == "")
  1865.    {
  1866.       this.preloaderType = this._constants.DEF_PRELOADER_TYPE;
  1867.    }
  1868.    this.userPreloaderId = this._removeWhite(this.userPreloaderId);
  1869.    this.cacheSize = this._validateNumber(this.cacheSize,4,100,this._constants.DEF_CACHE_SIZE);
  1870.    this._cache.usePreloader = this.usePreloader;
  1871.    this._cache.cachePages = this.cachePages;
  1872.    this._cache.loadOnDemand = this.loadOnDemand;
  1873.    this._cache.bgColor = this.pageBack;
  1874. };
  1875. FFlippingBookClass.prototype.gotoPage = function(i)
  1876. {
  1877.    if(this._view != undefined)
  1878.    {
  1879.       this._view.gotoPage(i);
  1880.    }
  1881. };
  1882. FFlippingBookClass.prototype.directGotoPage = function(i)
  1883. {
  1884.    var _loc3_ = i != this.leftPageNumber && i != this.rightPageNumber;
  1885.    if(this._view != undefined && _loc3_)
  1886.    {
  1887.       this._view.directGotoPage(i);
  1888.    }
  1889. };
  1890. FFlippingBookClass.prototype.flipGotoPage = function(i)
  1891. {
  1892.    if(this._view != undefined)
  1893.    {
  1894.       this._view.flipGotoPage(i);
  1895.    }
  1896. };
  1897. FFlippingBookView.prototype.setSize = function(w, h)
  1898. {
  1899.    this._pageWidth = w / 2;
  1900.    this._pageHeight = h;
  1901.    this.tmp01._x = this.__page01._x = - this._pageWidth;
  1902.    this.tmp01._y = this.__page01._y = (- this._pageHeight) / 2;
  1903.    this.tmp02._x = this.__page02._x = 0;
  1904.    this.tmp02._y = this.__page02._y = (- this._pageHeight) / 2;
  1905.    this.tmp03._y = this.__page03._y = (- this._pageHeight) / 2;
  1906.    this.tmp04._y = this.__page04._y = (- this._pageHeight) / 2;
  1907.    this.__pagesShadowMask._x = - this._pageWidth;
  1908.    this.__pagesShadowMask._y = (- this._pageHeight) / 2;
  1909.    this.__mask03._y = (- this._pageHeight) / 2;
  1910.    this.__mask12._y = (- this._pageHeight) / 2;
  1911.    this.__shMask03._y = (- this._pageHeight) / 2;
  1912.    this.__shMask04._y = (- this._pageHeight) / 2;
  1913.    this._drawShadow12();
  1914.    this._drawShadow03();
  1915.    this._drawShadow04();
  1916. };
  1917. FFlippingBookView.prototype._drawBook = function()
  1918. {
  1919.    this.__page04 = this.tmp04 = this._baseObj.createEmptyMovieClip(this._const.PAGE_04_MC_NAME,this._depth++);
  1920.    this.__shadow04 = this._baseObj.createEmptyMovieClip(this._const.SHADOW_04_MC_NAME,this._depth++);
  1921.    this.__shMask04 = this._baseObj.createEmptyMovieClip(this._const.SH_MASK_04_MC_NAME,this._depth++);
  1922.    this.__page01 = this.tmp01 = this._baseObj.createEmptyMovieClip(this._const.PAGE_01_MC_NAME,this._depth++);
  1923.    this.__page02 = this.tmp02 = this._baseObj.createEmptyMovieClip(this._const.PAGE_02_MC_NAME,this._depth++);
  1924.    this.__staticShadow = this._baseObj.createEmptyMovieClip(this._const.STATIC_SHADOW_MC_NAME,this._depth++);
  1925.    this.__pagesShadow = this._baseObj.createEmptyMovieClip(this._const.PAGES_SH_MC_NAME,this._depth++);
  1926.    this.__pagesShadowMask = this._baseObj.createEmptyMovieClip(this._const.PAGES_SHM_MC_NAME,this._depth++);
  1927.    this.__mask12 = this._baseObj.createEmptyMovieClip(this._const.MASK_12_MC_NAME,this._depth++);
  1928.    this.__page03 = this.tmp03 = this._baseObj.createEmptyMovieClip(this._const.PAGE_03_MC_NAME,this._depth++);
  1929.    this.__mask03 = this._baseObj.createEmptyMovieClip(this._const.MASK_03_MC_NAME,this._depth++);
  1930.    this.__page03.setMask(this.__mask03);
  1931.    this.__shadow03 = this._baseObj.createEmptyMovieClip(this._const.SHADOW_03_MC_NAME,this._depth++);
  1932.    this.__shMask03 = this._baseObj.createEmptyMovieClip(this._const.SH_MASK_03_MC_NAME,this._depth++);
  1933.    this.__page01._x = - this._pageWidth;
  1934.    this.__page01._y = (- this._pageHeight) / 2;
  1935.    this.__page02._x = 0;
  1936.    this.__page02._y = (- this._pageHeight) / 2;
  1937.    this.__page03._y = (- this._pageHeight) / 2;
  1938.    this.__page04._y = (- this._pageHeight) / 2;
  1939.    this.__pagesShadowMask._x = - this._pageWidth;
  1940.    this.__pagesShadowMask._y = (- this._pageHeight) / 2;
  1941.    this.__mask03._y = (- this._pageHeight) / 2;
  1942.    this.__mask12._y = (- this._pageHeight) / 2;
  1943.    this.__shMask03._y = (- this._pageHeight) / 2;
  1944.    this.__shMask04._y = (- this._pageHeight) / 2;
  1945.    this._drawShadow12();
  1946.    this._drawShadow03();
  1947.    this._drawShadow04();
  1948. };
  1949. FFlippingBookView.prototype.__redrawBook = function()
  1950. {
  1951.    this.__drawShadow03();
  1952.    this.__mask03._x = 0;
  1953.    this.__drawShadow04();
  1954.    this.__mask12._x = 0;
  1955.    this._drawShadow12();
  1956. };
  1957. FFlippingBookView.prototype._drawShadow12 = function()
  1958. {
  1959.    this.__pagesShadow.clear();
  1960.    this.__pagesShadow._x = 0;
  1961.    this.__pagesShadow._y = 0;
  1962.    var sw = this._const.SH12_SCALE * this._pageWidth;
  1963.    var sh = this.__pagesShadowHeight;
  1964.    var colors = [0,0];
  1965.    var ratios = [0,255];
  1966.    var alphas = [0,25 * this.sd];
  1967.    var matrix = {matrixType:"box",x:- sw,y:(- sh) / 2,w:sw,h:sh,r:0};
  1968.    with(this.__pagesShadow)
  1969.    {
  1970.       moveTo(- sw,(- sh) / 2);
  1971.       beginGradientFill("linear",colors,alphas,ratios,matrix);
  1972.       lineTo(0,(- sh) / 2);
  1973.       lineTo(0,sh / 2);
  1974.       lineTo(- sw,sh / 2);
  1975.       lineTo(- sw,(- sh) / 2);
  1976.       endFill();
  1977.    }
  1978.    this.__pagesShadow._visible = false;
  1979. };
  1980. FFlippingBookView.prototype.__drawShadow12Mask = function()
  1981. {
  1982.    this.__pagesShadowMask.clear();
  1983.    var ax = 0;
  1984.    var ay = this._pageHeight;
  1985.    var bx = 0;
  1986.    var by = 0;
  1987.    var cx = 2 * this._pageWidth;
  1988.    var cy = 0;
  1989.    var dx = 2 * this._pageWidth;
  1990.    var dy = this._pageHeight;
  1991.    if(this._transpPage == 1)
  1992.    {
  1993.       ax += this._pageWidth;
  1994.       bx += this._pageWidth;
  1995.    }
  1996.    else if(this._transpPage == 2)
  1997.    {
  1998.       cx -= this._pageWidth;
  1999.       dx -= this._pageWidth;
  2000.    }
  2001.    with(this.__pagesShadowMask)
  2002.    {
  2003.       moveTo(ax,ay);
  2004.       beginFill(0,100);
  2005.       lineTo(bx,by);
  2006.       lineTo(cx,cy);
  2007.       lineTo(dx,dy);
  2008.       lineTo(ax,ay);
  2009.       endFill();
  2010.    }
  2011.    this.__pagesShadow.setMask(this.__pagesShadowMask);
  2012. };
  2013. FFlippingBookView.prototype._drawShadow03 = function()
  2014. {
  2015.    this.__shadow03._x = 0;
  2016.    this.__shadow03._y = 0;
  2017.    this.__shadow03.clear();
  2018.    var sw = this._const.SH3_SCALE * this._pageWidth;
  2019.    var sh = this.__shadowHeight;
  2020.    var colors = [0,0,0,0];
  2021.    var ratios = [0,200,242,255];
  2022.    var alphas = [0,10 * this.sd,20 * this.sd,0];
  2023.    var matrix = {matrixType:"box",x:- sw,y:(- sh) / 2,w:sw,h:sh,r:0};
  2024.    with(this.__shadow03)
  2025.    {
  2026.       moveTo(- sw,(- sh) / 2);
  2027.       beginGradientFill("linear",colors,alphas,ratios,matrix);
  2028.       lineTo(0,(- sh) / 2);
  2029.       lineTo(0,sh / 2);
  2030.       lineTo(- sw,sh / 2);
  2031.       lineTo(- sw,(- sh) / 2);
  2032.       endFill();
  2033.    }
  2034.    this.__shadow03._visible = false;
  2035. };
  2036. FFlippingBookView.prototype._drawShadow04 = function()
  2037. {
  2038.    this.__shadow04._x = 0;
  2039.    this.__shadow04._y = 0;
  2040.    this.__shadow04.clear();
  2041.    var sw = 0.6 * this._pageWidth;
  2042.    var sh = this.__shadowHeight;
  2043.    var colors = [0,0];
  2044.    var ratios = [0,255];
  2045.    var alphas = [0,35 * this.sd];
  2046.    var matrix = {matrixType:"box",x:- sw,y:(- sh) / 2,w:sw,h:sh,r:0};
  2047.    with(this.__shadow04)
  2048.    {
  2049.       moveTo(- sw,(- sh) / 2);
  2050.       beginGradientFill("linear",colors,alphas,ratios,matrix);
  2051.       lineTo(0,(- sh) / 2);
  2052.       lineTo(0,sh / 2);
  2053.       lineTo(- sw,sh / 2);
  2054.       lineTo(- sw,(- sh) / 2);
  2055.       endFill();
  2056.    }
  2057.    this.__shadow04._visible = false;
  2058. };
  2059. FFlippingBookView.prototype.__isCorner = function(x, y)
  2060. {
  2061.    if(x > this._pageWidth - this._autoFlip)
  2062.    {
  2063.       if(x < this._pageWidth)
  2064.       {
  2065.          if(y > this._pageHeight / 2 - this._autoFlip)
  2066.          {
  2067.             if(y < this._pageHeight / 2)
  2068.             {
  2069.                return true;
  2070.             }
  2071.          }
  2072.       }
  2073.    }
  2074.    return false;
  2075. };
  2076. FFlippingBookView.prototype.__onMouseUp = function()
  2077. {
  2078.    if(!this._visible || !this.enabled)
  2079.    {
  2080.       return undefined;
  2081.    }
  2082.    var _loc2_ = this._view;
  2083.    if(_loc2_._bookState == this._constants.FLIPPING_STATE)
  2084.    {
  2085.       var _loc4_ = _loc2_.__isCorner(Math.abs(_loc2_._baseObj._xmouse),Math.abs(_loc2_._baseObj._ymouse));
  2086.       if(_loc2_._flipOnClick || !_flipOnClick && !_loc4_)
  2087.       {
  2088.          _loc2_._flipSound.start(0,1);
  2089.       }
  2090.       var _loc5_ = this._xmouse;
  2091.       var _loc6_ = this._ymouse;
  2092.       var _loc3_ = _loc2_.__ox;
  2093.       if(_loc4_)
  2094.       {
  2095.          _loc2_._bookState = this._constants.FLIPOVER_STATE;
  2096.          _loc2_._flipSound.start(0,1);
  2097.       }
  2098.       else
  2099.       {
  2100.          _loc2_._bookState = this._constants.FLIPBACK_STATE;
  2101.       }
  2102.       if(_loc3_ < 0 && _loc5_ > 0 || _loc3_ > 0 && _loc5_ < 0)
  2103.       {
  2104.          _loc2_._bookState = this._constants.FLIPOVER_STATE;
  2105.       }
  2106.    }
  2107. };
  2108. FFlippingBookView.prototype.__onMouseDown = function()
  2109. {
  2110.    if(!this._visible || !this.enabled)
  2111.    {
  2112.       return undefined;
  2113.    }
  2114.    var _loc2_ = this._view;
  2115.    var _loc3_ = this._xmouse;
  2116.    var _loc4_ = this._ymouse;
  2117.    if(_loc3_ > - _loc2_._pageWidth && _loc4_ > (- _loc2_._pageHeight) / 2 && _loc3_ < _loc2_._pageWidth && _loc4_ < _loc2_._pageHeight / 2)
  2118.    {
  2119.       var _loc5_ = false;
  2120.       if(_loc2_._bookState == this._constants.AUTOFLIP_STATE)
  2121.       {
  2122.          _loc5_ = true;
  2123.       }
  2124.       if(_loc3_ < 0)
  2125.       {
  2126.          var _loc10_ = _loc2_._baseObj.pagesSet[_loc2_._model._userCurrentPage];
  2127.          var _loc7_ = _loc2_._model._curPageNumbers[0];
  2128.          var _loc6_ = _loc2_._cache.__pagesHolders[_loc2_._model._userPages[_loc2_._model._curPageNumbers[0]]];
  2129.          if(_loc6_.media != undefined)
  2130.          {
  2131.             _loc6_ = _loc6_.media;
  2132.          }
  2133.          if(_loc7_ != undefined)
  2134.          {
  2135.             _loc2_._baseObj.onClick(_loc7_,_loc6_,_loc5_);
  2136.          }
  2137.       }
  2138.       else if(_loc3_ > 0)
  2139.       {
  2140.          _loc10_ = _loc2_._baseObj.pagesSet[_loc2_._model._userCurrentPage];
  2141.          _loc7_ = _loc2_._model._curPageNumbers[1];
  2142.          _loc6_ = _loc2_._cache.__pagesHolders[_loc2_._model._userPages[_loc2_._model._curPageNumbers[1]]];
  2143.          if(_loc6_.media != undefined)
  2144.          {
  2145.             _loc6_ = _loc6_.media;
  2146.          }
  2147.          if(_loc7_ != undefined)
  2148.          {
  2149.             _loc2_._baseObj.onClick(_loc7_,_loc6_,_loc5_);
  2150.          }
  2151.       }
  2152.    }
  2153.    if(!_loc2_._flipOnClick && _loc2_._bookState != this._constants.AUTOFLIP_STATE)
  2154.    {
  2155.       return undefined;
  2156.    }
  2157.    if(_loc5_)
  2158.    {
  2159.       if(_loc2_._flipOnClick)
  2160.       {
  2161.          _loc2_._bookState = this._constants.FLIPPING_STATE;
  2162.       }
  2163.       else
  2164.       {
  2165.          _loc2_._bookState = this._constants.FLIPPING_STATE;
  2166.       }
  2167.    }
  2168.    if(_loc3_ != 0 && _loc3_ > - _loc2_._pageWidth && _loc4_ > (- _loc2_._pageHeight) / 2 && _loc3_ < _loc2_._pageWidth && _loc4_ < _loc2_._pageHeight / 2)
  2169.    {
  2170.       if(_loc2_._bookState == this._constants.UNACTIVE_STATE)
  2171.       {
  2172.          _loc2_._bookState = this._constants.FLIPPING_STATE;
  2173.          var _loc8_ = Math.sqrt(_loc3_ * _loc3_ + _loc4_ * _loc4_);
  2174.          var _loc9_ = Math.asin(_loc4_ / _loc8_);
  2175.          _loc4_ = Math.tan(_loc9_) * _loc2_._pageWidth;
  2176.          if(_loc4_ > _loc2_._pageHeight / 2)
  2177.          {
  2178.             _loc4_ = _loc2_._pageHeight / 2;
  2179.          }
  2180.          if(_loc4_ < (- _loc2_._pageHeight) / 2)
  2181.          {
  2182.             _loc4_ = (- _loc2_._pageHeight) / 2;
  2183.          }
  2184.          _loc2_.__oy = _loc4_;
  2185.          if(_loc3_ < 0)
  2186.          {
  2187.             _loc2_.__page04._x = - _loc2_._pageWidth;
  2188.             _loc2_.__ox = - _loc2_._pageWidth;
  2189.             _loc2_._model.goBack();
  2190.             _loc2_.onStartFlip(_loc2_._model._curPageNumbers[0],true);
  2191.          }
  2192.          if(_loc3_ > 0)
  2193.          {
  2194.             _loc2_.__page04._x = 0;
  2195.             _loc2_.__ox = _loc2_._pageWidth;
  2196.             _loc2_._model.goForward();
  2197.             _loc2_.onStartFlip(_loc2_._model._curPageNumbers[1],false);
  2198.          }
  2199.          if(_loc2_._bookState != this._constants.UNACTIVE_STATE)
  2200.          {
  2201.             _loc2_.__shadow03._visible = true;
  2202.             _loc2_.__shadow04._visible = true;
  2203.             _loc2_.__shadow03.setMask(_loc2_.__shMask03);
  2204.             _loc2_.__shadow04.setMask(_loc2_.__shMask04);
  2205.             _loc2_.__drawShadow12Mask();
  2206.          }
  2207.          _loc2_.__oldX = _loc2_.__ox;
  2208.          _loc2_.__oldY = _loc2_.__oy;
  2209.       }
  2210.    }
  2211. };
  2212. FFlippingBookView.prototype.onStartFlip = function(p, isLeft)
  2213. {
  2214.    if(!this._baseObj.alwaysOpened)
  2215.    {
  2216.       if(isLeft && this._baseObj.leftPageNumber == undefined)
  2217.       {
  2218.          return undefined;
  2219.       }
  2220.       if(!isLeft && this._baseObj.rightPageNumber == undefined)
  2221.       {
  2222.          return undefined;
  2223.       }
  2224.    }
  2225.    else
  2226.    {
  2227.       if(isLeft && this._baseObj.leftPageNumber == 0)
  2228.       {
  2229.          return undefined;
  2230.       }
  2231.       if(!isLeft && this._baseObj.rightPageNumber == this._baseObj.totalPages - 1)
  2232.       {
  2233.          return undefined;
  2234.       }
  2235.    }
  2236.    var _loc3_ = this._baseObj.getPageLink(p);
  2237.    _loc3_.onStartFlip();
  2238.    this._baseObj.onStartFlip(p);
  2239. };
  2240. FFlippingBookView.prototype.onSetPages = function(i, j)
  2241. {
  2242.    if(this._bookState == this._const.INIT_STATE)
  2243.    {
  2244.       this._bookState = this._const.UNACTIVE_STATE;
  2245.    }
  2246.    else if(this._bookState == this._const.UNACTIVE_STATE)
  2247.    {
  2248.       this.__redrawBook();
  2249.    }
  2250.    else if((this._bookState == this._const.GOTOPAGE_STATE || this._bookState == this._const.FLIP_GOTOPAGE_STATE) && i == 1)
  2251.    {
  2252.       this.__redrawBook();
  2253.       this.__oldX = 0;
  2254.       this.__oldY = 0;
  2255.       if(this._bookState == this._const.GOTOPAGE_STATE)
  2256.       {
  2257.          this._model.getNextGotoPage(this.__gotoPageIndex);
  2258.       }
  2259.       else
  2260.       {
  2261.          this._model.getFlipGotoPage(this.__gotoPageIndex,true);
  2262.       }
  2263.       if(this._bookState != this._const.UNACTIVE_STATE)
  2264.       {
  2265.          this._flipSound.start(0,1);
  2266.          this.__pagesShadow._visible = true;
  2267.          this.__shadow03._visible = true;
  2268.          this.__shadow04._visible = true;
  2269.          this.__shadow03.setMask(this.__shMask03);
  2270.          this.__shadow04.setMask(this.__shMask04);
  2271.          this.__drawShadow12Mask();
  2272.       }
  2273.    }
  2274. };
  2275. FFlippingBookView.prototype.__onEnterFrame = function()
  2276. {
  2277.    var _loc2_ = this._view;
  2278.    var _loc5_ = _loc2_._baseObj;
  2279.    _loc5_._initLibraryPages();
  2280.    var _loc6_ = _loc5_.getPageLink(_loc5_.leftPageNumber);
  2281.    var _loc8_ = _loc5_.getPageLink(_loc5_.rightPageNumber);
  2282.    if(!_loc6_.isExternal && !_loc6_.onOpenCalled)
  2283.    {
  2284.       _loc6_.onOpen();
  2285.       _loc6_.onOpenCalled = true;
  2286.    }
  2287.    if(!_loc8_.isExternal && !_loc8_.onOpenCalled)
  2288.    {
  2289.       _loc8_.onOpen();
  2290.       _loc8_.onOpenCalled = true;
  2291.    }
  2292.    if(!this._visible || !this.enabled)
  2293.    {
  2294.       return undefined;
  2295.    }
  2296.    var _loc3_ = this._xmouse;
  2297.    var _loc4_ = this._ymouse;
  2298.    if(_loc2_._bookState == _loc2_._const.START_FLIP_CORNER_STATE)
  2299.    {
  2300.       var _loc7_ = _loc2_._getFlipCornerCoords();
  2301.       _loc3_ = _loc7_.x;
  2302.       _loc4_ = _loc7_.y;
  2303.       _loc2_._bookState = _loc2_._const.FLIP_CORNER_STATE;
  2304.       var _loc11_ = Math.sqrt(_loc3_ * _loc3_ + _loc4_ * _loc4_);
  2305.       var _loc12_ = Math.asin(_loc4_ / _loc11_);
  2306.       _loc4_ = Math.tan(_loc12_) * _loc2_._pageWidth;
  2307.       if(_loc4_ > 0)
  2308.       {
  2309.          _loc4_ = _loc2_._pageHeight / 2;
  2310.       }
  2311.       if(_loc4_ < 0)
  2312.       {
  2313.          _loc4_ = (- _loc2_._pageHeight) / 2;
  2314.       }
  2315.       _loc2_.__oy = _loc4_;
  2316.       _loc4_ = -100;
  2317.       if(_loc3_ < 0)
  2318.       {
  2319.          _loc2_.__page04._x = - _loc2_._pageWidth;
  2320.          _loc2_.__ox = - _loc2_._pageWidth;
  2321.          _loc2_._model.goBack();
  2322.       }
  2323.       if(_loc3_ > 0)
  2324.       {
  2325.          _loc2_.__page04._x = 0;
  2326.          _loc2_.__ox = _loc2_._pageWidth;
  2327.          _loc2_._model.goForward();
  2328.       }
  2329.       if(_loc2_._bookState != this._constants.UNACTIVE_STATE)
  2330.       {
  2331.          _loc2_.__pagesShadow._visible = true;
  2332.          _loc2_.__shadow03._visible = true;
  2333.          _loc2_.__shadow04._visible = true;
  2334.          _loc2_.__shadow03.setMask(_loc2_.__shMask03);
  2335.          _loc2_.__shadow04.setMask(_loc2_.__shMask04);
  2336.          _loc2_.__drawShadow12Mask();
  2337.       }
  2338.       _loc2_.__oldX = _loc2_.__ox;
  2339.       _loc2_.__oldY = _loc2_.__oy;
  2340.    }
  2341.    else if(_loc2_._bookState == _loc2_._const.AUTOFLIP_STATE)
  2342.    {
  2343.       if(!_loc2_.__isCorner(Math.abs(_loc3_),Math.abs(_loc4_)))
  2344.       {
  2345.          _loc2_._bookState = _loc2_._const.FLIPBACK_STATE;
  2346.       }
  2347.    }
  2348.    else if(_loc2_._bookState == _loc2_._const.UNACTIVE_STATE && _loc2_._autoFlip != 0)
  2349.    {
  2350.       if(_loc2_.__isCorner(Math.abs(_loc3_),Math.abs(_loc4_)))
  2351.       {
  2352.          _loc2_._bookState = _loc2_._const.AUTOFLIP_STATE;
  2353.          _loc11_ = Math.sqrt(_loc3_ * _loc3_ + _loc4_ * _loc4_);
  2354.          _loc12_ = Math.asin(_loc4_ / _loc11_);
  2355.          _loc4_ = Math.tan(_loc12_) * _loc2_._pageWidth;
  2356.          if(_loc4_ > 0)
  2357.          {
  2358.             _loc4_ = _loc2_._pageHeight / 2;
  2359.          }
  2360.          if(_loc4_ < 0)
  2361.          {
  2362.             _loc4_ = (- _loc2_._pageHeight) / 2;
  2363.          }
  2364.          _loc2_.__oy = _loc4_;
  2365.          _loc4_ = this._ymouse;
  2366.          if(_loc3_ < 0)
  2367.          {
  2368.             _loc2_.__page04._x = - _loc2_._pageWidth;
  2369.             _loc2_.__ox = - _loc2_._pageWidth;
  2370.             _loc2_._model.goBack();
  2371.             _loc2_.onStartFlip(_loc2_._model._curPageNumbers[0],true);
  2372.          }
  2373.          if(_loc3_ > 0)
  2374.          {
  2375.             _loc2_.__page04._x = 0;
  2376.             _loc2_.__ox = _loc2_._pageWidth;
  2377.             _loc2_._model.goForward();
  2378.             _loc2_.onStartFlip(_loc2_._model._curPageNumbers[1],false);
  2379.          }
  2380.          if(_loc2_._bookState != this._constants.UNACTIVE_STATE)
  2381.          {
  2382.             _loc2_.__pagesShadow._visible = true;
  2383.             _loc2_.__shadow03._visible = true;
  2384.             _loc2_.__shadow04._visible = true;
  2385.             _loc2_.__shadow03.setMask(_loc2_.__shMask03);
  2386.             _loc2_.__shadow04.setMask(_loc2_.__shMask04);
  2387.             _loc2_.__drawShadow12Mask();
  2388.          }
  2389.          _loc2_.__oldX = _loc2_.__ox;
  2390.          _loc2_.__oldY = _loc2_.__oy;
  2391.       }
  2392.    }
  2393.    if(_loc2_._bookState == _loc2_._const.FLIP_CORNER_STATE)
  2394.    {
  2395.       _loc7_ = _loc2_._getFlipCornerCoords();
  2396.       _loc3_ = _loc7_.x;
  2397.       _loc4_ = _loc7_.y;
  2398.       var _loc0_ = null;
  2399.       _loc3_ = _loc2_.__oldX += (_loc3_ - _loc2_.__oldX) * _loc2_._pageSpeed;
  2400.       var _loc0_ = null;
  2401.       _loc4_ = _loc2_.__oldY += (_loc4_ - _loc2_.__oldY) * _loc2_._pageSpeed;
  2402.       _loc2_.__movePage(_loc3_,_loc4_);
  2403.       if(Math.abs(_loc3_ - _loc7_.x) < 1 && Math.abs(_loc4_ - _loc7_.y))
  2404.       {
  2405.          _loc2_._bookState = _loc2_._const.AUTOFLIP_STATE;
  2406.       }
  2407.    }
  2408.    else if(_loc2_._bookState == _loc2_._const.FLIPPING_STATE || _loc2_._bookState == _loc2_._const.AUTOFLIP_STATE)
  2409.    {
  2410.       var _loc0_ = null;
  2411.       _loc3_ = _loc2_.__oldX += (_loc3_ - _loc2_.__oldX) * _loc2_._pageSpeed;
  2412.       var _loc0_ = null;
  2413.       _loc4_ = _loc2_.__oldY += (_loc4_ - _loc2_.__oldY) * _loc2_._pageSpeed;
  2414.       _loc2_.__movePage(_loc3_,_loc4_);
  2415.    }
  2416.    else if(_loc2_._bookState == _loc2_._const.FLIPOVER_STATE)
  2417.    {
  2418.       var _loc0_ = null;
  2419.       _loc3_ = _loc2_.__oldX += (- _loc2_.__ox - _loc2_.__oldX) * _loc2_._closeSpeed;
  2420.       var _loc0_ = null;
  2421.       _loc4_ = _loc2_.__oldY += (_loc2_.__oy - _loc2_.__oldY) * _loc2_._closeSpeed;
  2422.       _loc2_.__movePage(_loc3_,_loc4_);
  2423.       if(_loc3_ / (- _loc2_.__ox) > _loc2_._minOffset)
  2424.       {
  2425.          _loc2_._bookState = _loc2_._const.UNACTIVE_STATE;
  2426.          _loc2_._cache.restorePages();
  2427.          _loc2_._model.putPage();
  2428.       }
  2429.    }
  2430.    else if(_loc2_._bookState == _loc2_._const.FLIPBACK_STATE)
  2431.    {
  2432.       var _loc0_ = null;
  2433.       _loc3_ = _loc2_.__oldX += (_loc2_.__ox - _loc2_.__oldX) * _loc2_._closeSpeed;
  2434.       var _loc0_ = null;
  2435.       _loc4_ = _loc2_.__oldY += (_loc2_.__oy - _loc2_.__oldY) * _loc2_._closeSpeed;
  2436.       _loc2_.__movePage(_loc3_,_loc4_);
  2437.       if(_loc3_ / _loc2_.__ox > _loc2_._minOffset)
  2438.       {
  2439.          if(_loc3_ > 0)
  2440.          {
  2441.             var _loc9_ = _loc2_._model._curPageNumbers[1];
  2442.             var _loc10_ = _loc5_.getPageLink(_loc9_);
  2443.             _loc10_.onFlipBack();
  2444.             _loc5_.onFlipBack(_loc9_);
  2445.          }
  2446.          else
  2447.          {
  2448.             _loc9_ = _loc2_._model._curPageNumbers[0];
  2449.             _loc10_ = _loc5_.getPageLink(_loc9_);
  2450.             _loc10_.onFlipBack();
  2451.             _loc5_.onFlipBack(_loc9_);
  2452.          }
  2453.          _loc2_._bookState = _loc2_._const.UNACTIVE_STATE;
  2454.          _loc2_._cache.restoreWorkPages();
  2455.          _loc2_.redrawBook();
  2456.       }
  2457.    }
  2458.    else if(_loc2_._bookState == _loc2_._const.GOTOPAGE_STATE || _loc2_._bookState == _loc2_._const.FLIP_GOTOPAGE_STATE)
  2459.    {
  2460.       var _loc0_ = null;
  2461.       _loc3_ = _loc2_.__oldX += (- _loc2_.__ox - _loc2_.__oldX) * _loc2_._gotoSpeed;
  2462.       var _loc0_ = null;
  2463.       _loc4_ = _loc2_.__oldY += (_loc2_.__oy - _loc2_.__oldY) * _loc2_._gotoSpeed;
  2464.       _loc2_.__movePage(_loc3_,_loc4_);
  2465.       if(_loc3_ / (- _loc2_.__ox) > _loc2_._minOffset)
  2466.       {
  2467.          _loc2_._cache.restorePages();
  2468.          _loc2_._model.putPage();
  2469.       }
  2470.    }
  2471. };
  2472. FFlippingBookView.prototype.__movePage = function(x, y)
  2473. {
  2474.    var _loc4_ = this._pageHeight / 2;
  2475.    var _loc5_ = this._pageWidth;
  2476.    var _loc7_ = Math.sqrt((_loc4_ + this.__oy) * (_loc4_ + this.__oy) + _loc5_ * _loc5_);
  2477.    var _loc6_ = Math.sqrt((_loc4_ - this.__oy) * (_loc4_ - this.__oy) + _loc5_ * _loc5_);
  2478.    var _loc11_ = Math.sqrt((_loc4_ + y) * (_loc4_ + y) + x * x);
  2479.    var _loc10_ = Math.sqrt((_loc4_ - y) * (_loc4_ - y) + x * x);
  2480.    if(_loc11_ > _loc7_ || _loc10_ > _loc6_)
  2481.    {
  2482.       if(y < this.__oy)
  2483.       {
  2484.          var _loc8_ = Math.asin((_loc4_ - y) / _loc10_);
  2485.          y = _loc4_ - Math.sin(_loc8_) * _loc6_;
  2486.          x = x >= 0 ? Math.cos(_loc8_) * _loc6_ : (- Math.cos(_loc8_)) * _loc6_;
  2487.          if(y > this.__oy)
  2488.          {
  2489.             if(this.__ox * x > 0)
  2490.             {
  2491.                y = this.__oy;
  2492.                x = this.__ox;
  2493.             }
  2494.             else
  2495.             {
  2496.                y = this.__oy;
  2497.                x = - this.__ox;
  2498.             }
  2499.          }
  2500.       }
  2501.       else
  2502.       {
  2503.          _loc8_ = Math.asin((y + _loc4_) / _loc11_);
  2504.          y = Math.sin(_loc8_) * _loc7_ - _loc4_;
  2505.          x = x >= 0 ? Math.cos(_loc8_) * _loc7_ : (- Math.cos(_loc8_)) * _loc7_;
  2506.          if(y < this.__oy)
  2507.          {
  2508.             if(this.__ox * x > 0)
  2509.             {
  2510.                y = this.__oy;
  2511.                x = this.__ox;
  2512.             }
  2513.             else
  2514.             {
  2515.                y = this.__oy;
  2516.                x = - this.__ox;
  2517.             }
  2518.          }
  2519.       }
  2520.    }
  2521.    if(this.__ox < 0 && x - this.__ox < 5 || this.__ox > 0 && this.__ox - x < 5)
  2522.    {
  2523.       if(this.__ox < 0)
  2524.       {
  2525.          x = - _loc5_ + 5;
  2526.       }
  2527.       if(this.__ox > 0)
  2528.       {
  2529.          x = _loc5_ - 5;
  2530.       }
  2531.    }
  2532.    var _loc18_ = this.__oy - y;
  2533.    var _loc19_ = this.__ox - x;
  2534.    var _loc15_ = Math.atan(_loc18_ / _loc19_);
  2535.    var _loc9_ = 2 * _loc15_;
  2536.    var _loc17_ = _loc9_ * 57.29577951308232;
  2537.    var _loc16_ = Math.sin(_loc9_);
  2538.    var _loc14_ = Math.cos(_loc9_);
  2539.    var _loc13_ = x + (_loc4_ + this.__oy) * _loc16_ - (_loc5_ - this.__ox) / 2 * _loc14_;
  2540.    var _loc12_ = y - (_loc4_ + this.__oy) * _loc14_ - (_loc5_ - this.__ox) / 2 * _loc16_;
  2541.    this.__page03._rotation = _loc17_;
  2542.    this.__page03._x = _loc13_;
  2543.    this.__page03._y = _loc12_;
  2544.    this.__drawMasks(_loc15_,_loc13_,_loc12_,x,y);
  2545.    this.__page03._visible = true;
  2546.    this.__page04._visible = true;
  2547. };
  2548. FFlippingBookView.prototype.__drawMasks = function(beta, x, y, _mx, _my)
  2549. {
  2550.    var pageH = this._pageHeight;
  2551.    var pageH2 = pageH / 2;
  2552.    var pageW = this._pageWidth;
  2553.    var r = Math.sqrt((this.__ox - _mx) * (this.__ox - _mx) + (this.__oy - _my) * (this.__oy - _my));
  2554.    var alpha = 2 * beta;
  2555.    var cos_a = Math.cos(alpha);
  2556.    var sin_a = Math.sin(alpha);
  2557.    var cos_b = Math.cos(beta);
  2558.    var sin_b = Math.sin(beta);
  2559.    var tan_a = sin_a / cos_a;
  2560.    var tan_b = Math.tan(beta);
  2561.    var bx = 0;
  2562.    var by = 0;
  2563.    var ax = 0;
  2564.    var ay = pageH;
  2565.    y += pageH2;
  2566.    bx = x - y / tan_a;
  2567.    ax = bx - pageH * tan_b;
  2568.    if(beta == 0)
  2569.    {
  2570.       if(this.__ox < 0 && x < 0)
  2571.       {
  2572.          x = ax = bx = - pageW;
  2573.       }
  2574.       else if(this.__ox > 0 && x > 0)
  2575.       {
  2576.          x = ax = bx = pageW;
  2577.       }
  2578.       else
  2579.       {
  2580.          ax = bx = 0;
  2581.       }
  2582.    }
  2583.    var cx = this.__ox <= 0 ? - pageW : pageW;
  2584.    var cy = 0;
  2585.    var dx = cx;
  2586.    var dy = pageH;
  2587.    var k = this.__ox <= 0 ? 1 : 0;
  2588.    var px = x + k * pageW * cos_a;
  2589.    var py = y + k * pageW * sin_a;
  2590.    var fx = px - pageH * sin_a;
  2591.    var fy = py + pageH * cos_a;
  2592.    var lx = cx;
  2593.    var ly = beta == 0 ? -1 : (bx - cx) / tan_b;
  2594.    var tmpx = 0;
  2595.    var tmpy = 0;
  2596.    var ccx = cx;
  2597.    var ddx = dx;
  2598.    cx = 0;
  2599.    dx = 0;
  2600.    if(this._transpPage04)
  2601.    {
  2602.       ccx = ddx = cx;
  2603.    }
  2604.    if(ly < 0 || ly > pageH)
  2605.    {
  2606.       with(this.__mask03)
  2607.       {
  2608.          clear();
  2609.          moveTo(ax,ay);
  2610.          beginFill(16776960,100);
  2611.          lineTo(bx,by);
  2612.          lineTo(px,py);
  2613.          lineTo(fx,fy);
  2614.          lineTo(ax,ay);
  2615.          endFill();
  2616.       }
  2617.       with(this.__mask12)
  2618.       {
  2619.          clear();
  2620.          moveTo(ax,ay);
  2621.          beginFill(0,100);
  2622.          lineTo(bx,by);
  2623.          lineTo(cx,cy);
  2624.          lineTo(dx,dy);
  2625.          lineTo(ax,ay);
  2626.          endFill();
  2627.       }
  2628.       with(this.__shMask03)
  2629.       {
  2630.          clear();
  2631.          moveTo(ax,ay);
  2632.          beginFill(16776960,100);
  2633.          lineTo(bx,by);
  2634.          lineTo(px,py);
  2635.          lineTo(fx,fy);
  2636.          lineTo(ax,ay);
  2637.          endFill();
  2638.       }
  2639.       with(this.__shMask04)
  2640.       {
  2641.          clear();
  2642.          moveTo(ax,ay);
  2643.          beginFill(0,100);
  2644.          lineTo(bx,by);
  2645.          lineTo(ccx,cy);
  2646.          lineTo(ddx,dy);
  2647.          lineTo(ax,ay);
  2648.          endFill();
  2649.       }
  2650.       with(this.__pagesShadow)
  2651.       {
  2652.          _rotation = beta * this.radIndex;
  2653.          _xscale = this.__ox <= 0 ? (- r) / 4 : r / 4;
  2654.          ay -= pageH2;
  2655.          by -= pageH2;
  2656.          var ab = Math.sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by));
  2657.          _alpha = 2 * pageW - r >= 50 ? 100 : 2 * (2 * pageW - r);
  2658.          _x = bx - ab / 2 * sin_b;
  2659.          _y = by + ab / 2 * cos_b;
  2660.          _visible = true;
  2661.       }
  2662.       with(this.__shadow03)
  2663.       {
  2664.          _rotation = this.__pagesShadow._rotation;
  2665.          _xscale = this.__pagesShadow._xscale;
  2666.          _alpha = this.__pagesShadow._alpha;
  2667.          _x = this.__pagesShadow._x;
  2668.          _y = this.__pagesShadow._y;
  2669.       }
  2670.       with(this.__shadow04)
  2671.       {
  2672.          _rotation = this.__pagesShadow._rotation;
  2673.          _xscale = - this.__pagesShadow._xscale;
  2674.          _alpha = this.__pagesShadow._alpha;
  2675.          _x = this.__pagesShadow._x;
  2676.          _y = this.__pagesShadow._y;
  2677.       }
  2678.    }
  2679.    else
  2680.    {
  2681.       if(bx > pageW || bx < - pageW)
  2682.       {
  2683.          bx = ax;
  2684.          by = ay;
  2685.          tmpx = cx;
  2686.          tmpy = cy;
  2687.          cx = dx;
  2688.          cy = dy;
  2689.          dx = tmpx;
  2690.          dy = tmpy;
  2691.          px = fx;
  2692.          py = fy;
  2693.       }
  2694.       with(this.__mask03)
  2695.       {
  2696.          clear();
  2697.          moveTo(lx,ly);
  2698.          beginFill(16711680,100);
  2699.          lineTo(px,py);
  2700.          lineTo(bx,by);
  2701.          lineTo(lx,ly);
  2702.          endFill();
  2703.       }
  2704.       with(this.__mask12)
  2705.       {
  2706.          clear();
  2707.          moveTo(lx,ly);
  2708.          beginFill(0,100);
  2709.          lineTo(bx,by);
  2710.          lineTo(cx,cy);
  2711.          lineTo(dx,dy);
  2712.          lineTo(lx,dy);
  2713.          lineTo(lx,ly);
  2714.          endFill();
  2715.       }
  2716.       with(this.__shMask03)
  2717.       {
  2718.          clear();
  2719.          moveTo(lx,ly);
  2720.          beginFill(16711680,100);
  2721.          lineTo(px,py);
  2722.          lineTo(bx,by);
  2723.          lineTo(lx,ly);
  2724.          endFill();
  2725.       }
  2726.       with(this.__shMask04)
  2727.       {
  2728.          clear();
  2729.          moveTo(lx,ly);
  2730.          beginFill(16711680,100);
  2731.          lineTo(ccx,cy);
  2732.          lineTo(bx,by);
  2733.          lineTo(lx,ly);
  2734.          endFill();
  2735.       }
  2736.       with(this.__pagesShadow)
  2737.       {
  2738.          _rotation = beta * this.radIndex;
  2739.          _xscale = this.__ox <= 0 ? (- r) / 4 : r / 4;
  2740.          ly -= pageH2;
  2741.          by -= pageH2;
  2742.          var bl = Math.sqrt((lx - bx) * (lx - bx) + (ly - by) * (ly - by));
  2743.          _alpha = 2 * pageW - r >= 50 ? 100 : 2 * (2 * pageW - r);
  2744.          _x = by >= ly ? lx - bl / 2 * sin_b : bx - bl / 2 * sin_b;
  2745.          _y = by >= ly ? ly + bl / 2 * cos_b : by + bl / 2 * cos_b;
  2746.          _visible = true;
  2747.       }
  2748.       with(this.__shadow03)
  2749.       {
  2750.          _rotation = this.__pagesShadow._rotation;
  2751.          _xscale = this.__pagesShadow._xscale;
  2752.          _alpha = this.__pagesShadow._alpha;
  2753.          _x = this.__pagesShadow._x;
  2754.          _y = this.__pagesShadow._y;
  2755.       }
  2756.       with(this.__shadow04)
  2757.       {
  2758.          _rotation = this.__pagesShadow._rotation;
  2759.          _xscale = - this.__pagesShadow._xscale;
  2760.          _alpha = this.__pagesShadow._alpha;
  2761.          _x = this.__pagesShadow._x;
  2762.          _y = this.__pagesShadow._y;
  2763.       }
  2764.    }
  2765.    this.__page03.setMask(this.__mask03);
  2766.    this.__shadow03.setMask(this.__shMask03);
  2767.    this.__shadow04.setMask(this.__shMask04);
  2768.    this.__ox <= 0 ? this.__page01.setMask(this.__mask12) : this.__page02.setMask(this.__mask12);
  2769. };
  2770. FFlippingBookView.prototype.flipCorner = function(position)
  2771. {
  2772.    if(this._bookState != this._const.UNACTIVE_STATE)
  2773.    {
  2774.       return undefined;
  2775.    }
  2776.    this._flipCornerPosition = position;
  2777.    this._bookState = this._const.START_FLIP_CORNER_STATE;
  2778.    this._flipSound.start(0,1);
  2779. };
  2780. FFlippingBookView.prototype._getFlipCornerCoords = function()
  2781. {
  2782.    var _loc4_ = this._autoFlip;
  2783.    var _loc3_ = 0;
  2784.    var _loc2_ = 0;
  2785.    switch(this._flipCornerPosition)
  2786.    {
  2787.       case "top-left":
  2788.          _loc3_ = - this._pageWidth + this._autoFlip;
  2789.          _loc2_ = (- this._pageHeight) / 2 + this._autoFlip / 2;
  2790.          break;
  2791.       case "top-right":
  2792.          _loc3_ = this._pageWidth - this._autoFlip;
  2793.          _loc2_ = (- this._pageHeight) / 2 + this._autoFlip / 2;
  2794.          break;
  2795.       case "bottom-left":
  2796.          _loc3_ = - this._pageWidth + this._autoFlip;
  2797.          _loc2_ = this._pageHeight / 2 - this._autoFlip / 2;
  2798.          break;
  2799.       case "bottom-right":
  2800.          _loc3_ = this._pageWidth - this._autoFlip;
  2801.          _loc2_ = this._pageHeight / 2 - this._autoFlip / 2;
  2802.    }
  2803.    return {x:_loc3_,y:_loc2_};
  2804. };
  2805. FFlippingBookView.prototype.directGotoPage = function(n)
  2806. {
  2807.    if(this._bookState != this._const.UNACTIVE_STATE)
  2808.    {
  2809.       return undefined;
  2810.    }
  2811.    var _loc3_ = this._model._currentPage;
  2812.    this._model._currentPage = this._model._realPageNumber(n);
  2813.    this._cache.restoreDirectGotoPages();
  2814.    this._model.__direction = -1;
  2815.    var _loc2_ = 0;
  2816.    if(_loc3_ < this._model._currentPage)
  2817.    {
  2818.       _loc2_ = 1;
  2819.    }
  2820.    this._model.putPage(true,_loc2_);
  2821.    this.__page01.setMask(null);
  2822.    this.__page02.setMask(null);
  2823.    this._baseObj.onEndGoto();
  2824. };
  2825. FFlippingBookView.prototype.flipGotoPage = function(n)
  2826. {
  2827.    if(this._bookState != this._const.UNACTIVE_STATE)
  2828.    {
  2829.       return undefined;
  2830.    }
  2831.    this._bookState = this._const.FLIP_GOTOPAGE_STATE;
  2832.    this.__gotoPageIndex = this._model._realPageNumber(n);
  2833.    this._model._last_current_page = this._model._currentPage;
  2834.    if(this._model._currentPage > this.__gotoPageIndex)
  2835.    {
  2836.       this.__page04._x = - this._pageWidth;
  2837.       this.__ox = - this._pageWidth;
  2838.       this.__oy = (- this._pageHeight) / 2;
  2839.    }
  2840.    if(this._model._currentPage < this.__gotoPageIndex)
  2841.    {
  2842.       this.__page04._x = 0;
  2843.       this.__ox = this._pageWidth;
  2844.       this.__oy = (- this._pageHeight) / 2;
  2845.    }
  2846.    this.__oldX = 0;
  2847.    this.__oldY = 0;
  2848.    this._model.getFlipGotoPage(this.__gotoPageIndex,false);
  2849.    if(this._bookState != this._const.UNACTIVE_STATE)
  2850.    {
  2851.       this._flipSound.start(0,1);
  2852.       this.__pagesShadow._visible = true;
  2853.       this.__shadow03._visible = true;
  2854.       this.__shadow04._visible = true;
  2855.       this.__shadow03.setMask(this.__shMask03);
  2856.       this.__shadow04.setMask(this.__shMask04);
  2857.       this.__drawShadow12Mask();
  2858.    }
  2859. };
  2860. FFlippingBookView.prototype.gotoPage = function(n)
  2861. {
  2862.    if(this._bookState != this._const.UNACTIVE_STATE)
  2863.    {
  2864.       return undefined;
  2865.    }
  2866.    this._bookState = this._const.GOTOPAGE_STATE;
  2867.    this.__gotoPageIndex = this._model._realPageNumber(n);
  2868.    if(this._model._currentPage > this.__gotoPageIndex)
  2869.    {
  2870.       this.__page04._x = - this._pageWidth;
  2871.       this.__ox = - this._pageWidth;
  2872.       this.__oy = (- this._pageHeight) / 2;
  2873.    }
  2874.    if(this._model._currentPage < this.__gotoPageIndex)
  2875.    {
  2876.       this.__page04._x = 0;
  2877.       this.__ox = this._pageWidth;
  2878.       this.__oy = (- this._pageHeight) / 2;
  2879.    }
  2880.    this.__oldX = 0;
  2881.    this.__oldY = 0;
  2882.    this._model.getNextGotoPage(this.__gotoPageIndex);
  2883.    if(this._bookState != this._const.UNACTIVE_STATE)
  2884.    {
  2885.       this._flipSound.start(0,1);
  2886.       this.__pagesShadow._visible = true;
  2887.       this.__shadow03._visible = true;
  2888.       this.__shadow04._visible = true;
  2889.       this.__shadow03.setMask(this.__shMask03);
  2890.       this.__shadow04.setMask(this.__shMask04);
  2891.       this.__drawShadow12Mask();
  2892.    }
  2893. };
  2894. Object.registerClass("FFlippingBookSymbol",FFlippingBookClass);
  2895.