home *** CD-ROM | disk | FTP | other *** search
/ FCE Gold Plus / GOLD.iso / pc / main.swf / scripts / __Packages / Friends_navigation.as < prev    next >
Text File  |  2007-11-02  |  25KB  |  834 lines

  1. class Friends_navigation
  2. {
  3.    var interval = 50;
  4.    var fileClicked = false;
  5.    var bDrawBar = false;
  6.    var arrSectionMCs = [{linkage:"ExternalNavigationElementLevel0",size:{w:108,h:18}},{linkage:"ExternalNavigationElementLevel1",size:{w:108,h:18}},{linkage:"ExternalNavigationElementEnd",size:{w:108,h:700},draw:true,level:3}];
  7.    function Friends_navigation(navigation_mc)
  8.    {
  9.       this.navigation_mc = navigation_mc;
  10.       this.init();
  11.       this.initFileBtn(navigation_mc._parent.homeBtn,null,true);
  12.    }
  13.    function removeNavigation()
  14.    {
  15.       this.navigation_mc.createEmptyMovieClip("base_mc",1);
  16.       this.arrTempNavigation = [];
  17.       this.count = 0;
  18.       this.navigationHeight = 0;
  19.       this.base_mc = this.navigation_mc.base_mc;
  20.       this.createEndNode();
  21.    }
  22.    function disable()
  23.    {
  24.       this.base_mc.onRelease = null;
  25.       this.base_mc.useHandCursor = false;
  26.    }
  27.    function enable()
  28.    {
  29.       delete this.base_mc.onRelease;
  30.    }
  31.    function init()
  32.    {
  33.       this.showNavigation(false);
  34.       this.levelOpen = 0;
  35.       this.lastFileClicked = [];
  36.       this.hideDummys();
  37.    }
  38.    function testMatch(arr1, arr2)
  39.    {
  40.       var _loc3_ = 0;
  41.       var _loc1_ = 0;
  42.       while(_loc1_ < arr2.length)
  43.       {
  44.          if(arr1[_loc1_] == arr2[_loc1_])
  45.          {
  46.             _loc3_ = _loc3_ + 1;
  47.          }
  48.          _loc1_ = _loc1_ + 1;
  49.       }
  50.       if(_loc3_ == arr2.length)
  51.       {
  52.          return true;
  53.       }
  54.       return false;
  55.    }
  56.    function createEndNode()
  57.    {
  58.       var _loc4_ = this.arrSectionMCs[this.arrSectionMCs.length - 1];
  59.       var _loc3_ = _loc4_.linkage;
  60.       var _loc2_ = this.base_mc.attachMovie(_loc3_,"section" + this.count + "_mc",this.count);
  61.       _loc2_.x += 2;
  62.       return _loc2_;
  63.    }
  64.    function createNodeMC(buttObj)
  65.    {
  66.       var _loc5_ = this.arrSectionMCs[buttObj.nodePath.length - 1];
  67.       var _loc4_ = _loc5_.linkage;
  68.       if(buttObj.bFolder && buttObj.nodePath.length == 1)
  69.       {
  70.          _loc4_ += "b";
  71.       }
  72.       else if(!buttObj.activitySectionFile)
  73.       {
  74.          if(!buttObj.referenceFile)
  75.          {
  76.          }
  77.       }
  78.       var _loc7_ = _loc5_.size;
  79.       var _loc3_ = this.base_mc.attachMovie(_loc4_,"section" + this.count + "_mc",this.count,{label:buttObj.label});
  80.       _loc3_.x += 2;
  81.       _loc3_.txtObj.embedFonts = true;
  82.       return _loc3_;
  83.    }
  84.    function checkDrawNodePath(mc, arrDrawRef)
  85.    {
  86.       var _loc4_ = this.arrTempNavigation[this.arrDrawNavigation[arrDrawRef]].nodePath.slice();
  87.       if((this.arrTempNavigation[this.arrDrawNavigation[arrDrawRef]].nodePath.length > this.arrTempNavigation[this.arrDrawNavigation[arrDrawRef + 1]].nodePath.length || this.arrTempNavigation[this.arrDrawNavigation[arrDrawRef + 1]].nodePath.length == undefined) && this.arrTempNavigation[this.arrDrawNavigation[arrDrawRef]].nodePath.length != 1)
  88.       {
  89.          mc.isBase = true;
  90.       }
  91.       else
  92.       {
  93.          mc.isBase = false;
  94.       }
  95.    }
  96.    function drawNodeMC(arrDrawRef, bEnd)
  97.    {
  98.       var _loc3_ = this.arrDrawNavigation[arrDrawRef];
  99.       if(!bEnd)
  100.       {
  101.          var _loc2_ = this.createNodeMC(this.arrTempNavigation[_loc3_]);
  102.          var _loc6_ = undefined;
  103.          _loc2_._y = this.navigationHeight;
  104.          this.checkDrawNodePath(_loc2_,arrDrawRef);
  105.          if(_loc2_.isBase)
  106.          {
  107.             this.navigationHeight += 3;
  108.          }
  109.          trace("arrTempNavigation[id].bFolder" + this.arrTempNavigation[_loc3_].bFolder);
  110.          if(this.arrTempNavigation[_loc3_].bFolder)
  111.          {
  112.             this.initFolderBtn(_loc2_,this.arrTempNavigation[_loc3_]);
  113.             if(this.testMatch(this.lastFolderClicked,this.arrTempNavigation[_loc3_].nodePath))
  114.             {
  115.                _loc2_.isOpen = true;
  116.                _loc2_.arrowMC._rotation = 90;
  117.                this.changeBtnState(_loc2_,"_active");
  118.             }
  119.             else
  120.             {
  121.                _loc2_.isOpen = false;
  122.                _loc2_.arrowMC._rotation = 0;
  123.                this.changeBtnState(_loc2_,"_start");
  124.             }
  125.          }
  126.          else
  127.          {
  128.             _loc2_.arrowMC._visible = false;
  129.             this.initFileBtn(_loc2_,this.arrTempNavigation[_loc3_]);
  130.             if(_loc2_.isBase)
  131.             {
  132.                if(this.testMatch(this.lastFileClicked,this.arrTempNavigation[_loc3_].nodePath))
  133.                {
  134.                   _loc2_.isOpen = true;
  135.                   this.changeBtnState(_loc2_,"_baseOver");
  136.                }
  137.                else
  138.                {
  139.                   _loc2_.isOpen = false;
  140.                   this.changeBtnState(_loc2_,"_base");
  141.                }
  142.             }
  143.             else if(this.testMatch(this.lastFileClicked,this.arrTempNavigation[_loc3_].nodePath))
  144.             {
  145.                trace("hhheeeellllooo asaf");
  146.                _loc2_.isOpen = true;
  147.                this.changeBtnState(_loc2_,"_rollover");
  148.             }
  149.             else
  150.             {
  151.                _loc2_.isOpen = false;
  152.                this.changeBtnState(_loc2_,"_start");
  153.             }
  154.          }
  155.          if(this.arrTempNavigation[_loc3_].nodePath.length == 1)
  156.          {
  157.             this.navigationHeight += this.arrTempNavigation[_loc3_].size.h - 2;
  158.          }
  159.          else
  160.          {
  161.             this.navigationHeight += this.arrTempNavigation[_loc3_].size.h - 4;
  162.          }
  163.       }
  164.    }
  165.    function updateDrawNavigation()
  166.    {
  167.       var _loc4_ = this.arrTempNavigation.length;
  168.       var _loc3_ = true;
  169.       var _loc2_ = 0;
  170.       while(_loc2_ < _loc4_ && _loc3_)
  171.       {
  172.          if(!this.arrTempNavigation[_loc2_].draw)
  173.          {
  174.             this.arrDrawNavigation.splice(_loc2_,0,_loc2_);
  175.             this.arrTempNavigation[_loc2_].draw = true;
  176.             this.setDrawStatesByNode(this.arrNavigation,this.arrTempNavigation[_loc2_].nodePath.slice(),true);
  177.             _loc3_ = false;
  178.          }
  179.          _loc2_ = _loc2_ + 1;
  180.       }
  181.    }
  182.    function setDrawStatesByNode(arrNav, nodePath, state)
  183.    {
  184.       if(nodePath.length == 1)
  185.       {
  186.          arrNav[nodePath[0]].draw = state;
  187.       }
  188.       else
  189.       {
  190.          var _loc3_ = nodePath[0];
  191.          nodePath.shift();
  192.          this.setDrawStatesByNode(arrNav[_loc3_].arrSubSections,nodePath,state);
  193.       }
  194.    }
  195.    function animateMenu()
  196.    {
  197.       var _loc3_ = this.arrDrawNavigation.length;
  198.       var _loc5_ = true;
  199.       this.levelOpen = 0;
  200.       this.count = 0;
  201.       this.navigationHeight = 5;
  202.       var _loc2_ = 0;
  203.       while(_loc2_ < _loc3_)
  204.       {
  205.          this.drawNodeMC(_loc2_,false);
  206.          this.count = this.count + 1;
  207.          _loc2_ = _loc2_ + 1;
  208.       }
  209.       this.drawNodeMC(null,true);
  210.       this.updateDrawNavigation();
  211.       var _loc4_ = this;
  212.       var _loc6_ = undefined;
  213.       if(_loc3_ >= this.arrTempNavigation.length)
  214.       {
  215.          clearInterval(this.drawInterval);
  216.       }
  217.    }
  218.    function drawMenu(bDraw)
  219.    {
  220.       var _loc3_ = this.arrTempNavigation.length;
  221.       this.maxLevel = 1;
  222.       this.arrDrawNavigation = [];
  223.       var _loc2_ = 0;
  224.       while(_loc2_ < _loc3_)
  225.       {
  226.          if(this.arrTempNavigation[_loc2_].nodePath.length - 1 > this.maxLevel)
  227.          {
  228.             this.maxLevel = this.arrTempNavigation[_loc2_].nodePath.length - 1;
  229.          }
  230.          _loc2_ = _loc2_ + 1;
  231.       }
  232.       _loc2_ = 0;
  233.       while(_loc2_ < _loc3_)
  234.       {
  235.          if(this.arrTempNavigation[_loc2_].draw)
  236.          {
  237.             this.arrDrawNavigation.push(_loc2_);
  238.          }
  239.          else if(this.arrTempNavigation[_loc2_].nodePath.length - 1 != this.maxLevel)
  240.          {
  241.             this.arrTempNavigation[_loc2_].draw = true;
  242.             this.arrDrawNavigation.push(_loc2_);
  243.          }
  244.          else if(this.arrTempNavigation[_loc2_].nodePath.length - 1 <= this.levelOpen)
  245.          {
  246.             this.arrTempNavigation[_loc2_].draw = true;
  247.             this.arrDrawNavigation.push(_loc2_);
  248.          }
  249.          _loc2_ = _loc2_ + 1;
  250.       }
  251.       if(bDraw)
  252.       {
  253.          this.animateMenu();
  254.          clearInterval(this.drawInterval);
  255.          this.drawInterval = setInterval(this,"animateMenu",this.interval);
  256.       }
  257.    }
  258.    function createNavObject(elementArrNav)
  259.    {
  260.       var _loc3_ = {};
  261.       for(var _loc4_ in elementArrNav)
  262.       {
  263.          if(_loc4_ != "arrSubSections")
  264.          {
  265.             _loc3_[_loc4_] = elementArrNav[_loc4_];
  266.          }
  267.       }
  268.       _loc3_.size = this.arrSectionMCs[_loc3_.nodePath.length - 1].size;
  269.       _loc3_.draw = elementArrNav.draw;
  270.       return _loc3_;
  271.    }
  272.    function clearMenu()
  273.    {
  274.       this.resetMenu();
  275.       this.lastFolderClicked = [];
  276.       this.lastFileClicked = [];
  277.       this.buildMenu(this.arrNavigation,[]);
  278.       this.drawMenu(true);
  279.    }
  280.    function buildMenu(arrNav, navNodePath)
  281.    {
  282.       var _loc2_ = 0;
  283.       while(_loc2_ < arrNav.length)
  284.       {
  285.          this.arrTempNavigation[this.count++] = this.createNavObject(arrNav[_loc2_]);
  286.          if(navNodePath[0] == _loc2_)
  287.          {
  288.             navNodePath.shift();
  289.             var _loc5_ = arrNav[_loc2_].arrSubSections.length;
  290.             this.buildMenu(arrNav[_loc2_].arrSubSections,navNodePath);
  291.          }
  292.          _loc2_ = _loc2_ + 1;
  293.       }
  294.    }
  295.    function resetMenu()
  296.    {
  297.       this.navigation_mc.createEmptyMovieClip("base_mc",1);
  298.       this.arrTempNavigation = [];
  299.       this.count = 0;
  300.       this.navigationHeight = 0;
  301.       this.base_mc = this.navigation_mc.base_mc;
  302.    }
  303.    function createMenu(bDraw)
  304.    {
  305.       var _loc2_ = undefined;
  306.       this.resetMenu();
  307.       if(this.reopenNode.length)
  308.       {
  309.          _loc2_ = this.lastFolderClicked.slice();
  310.       }
  311.       else if(this.fileClicked)
  312.       {
  313.          _loc2_ = this.lastFileClicked.slice();
  314.       }
  315.       else
  316.       {
  317.          _loc2_ = this.lastFolderClicked.slice();
  318.       }
  319.       this.buildMenu(this.arrNavigation,_loc2_);
  320.       this.drawMenu(bDraw);
  321.    }
  322.    function initialDisplay()
  323.    {
  324.       this.createMenu(true);
  325.       this.reopenNode = [];
  326.       this.showNavigation(true);
  327.    }
  328.    function initFolderBtn(btn, nodeData)
  329.    {
  330.       var manager = this;
  331.       btn.nodeData = nodeData;
  332.       btn.onRelease = function()
  333.       {
  334.          _root.secondPage.unitPicture.gotoAndStop(btn.nodeData.refNo);
  335.          manager.onFolderClicked(this,true);
  336.       };
  337.       btn.onRollOver = function()
  338.       {
  339.          manager.changeBtnRollOver(this);
  340.          _root.firstPage.firstPagePicture.gotoAndStop(this.nodeData.refNo);
  341.       };
  342.       btn.onRollOut = function()
  343.       {
  344.          manager.changeBtnRollOut(this);
  345.       };
  346.       btn.onReleaseOutside = function()
  347.       {
  348.          manager.changeBtnRollOut(this);
  349.       };
  350.    }
  351.    function initFileBtn(btn, nodeData, bHomeBtn)
  352.    {
  353.       var manager = this;
  354.       btn.nodeData = nodeData;
  355.       btn.state = "_start";
  356.       if(bHomeBtn == undefined)
  357.       {
  358.          btn.onRelease = function()
  359.          {
  360.             manager.onFileClicked(this,true);
  361.          };
  362.       }
  363.       else
  364.       {
  365.          btn.txtObj.embedFonts = true;
  366.          btn.label = "Main Menu";
  367.          btn._y = -1 + _root.header._height;
  368.          btn.onRelease = function()
  369.          {
  370.             manager.clearMenu();
  371.             _root.unitData.homeBtnPress();
  372.          };
  373.       }
  374.       btn.onRollOver = function()
  375.       {
  376.          manager.changeBtnRollOver(this);
  377.       };
  378.       btn.onRollOut = function()
  379.       {
  380.          manager.changeBtnRollOut(this);
  381.       };
  382.       btn.onReleaseOutside = function()
  383.       {
  384.          manager.changeBtnRollOut(this);
  385.       };
  386.    }
  387.    function changeBtnRollOut(btn)
  388.    {
  389.       if(btn.nodeData.bFolder && !btn.isOpen || !btn.nodeData.bFolder && !btn.isOpen)
  390.       {
  391.          if(btn.isBase)
  392.          {
  393.             btn.gotoAndStop("_base");
  394.          }
  395.          else
  396.          {
  397.             btn.gotoAndStop("_start");
  398.          }
  399.          btn.txtObj.embedFonts = true;
  400.       }
  401.       else if(btn.nodeData.bFolder && btn.isOpen)
  402.       {
  403.          btn.gotoAndStop("_active");
  404.          btn.txtObj.embedFonts = true;
  405.       }
  406.    }
  407.    function changeBtnRollOver(btn)
  408.    {
  409.       if(!(btn.nodeData.bFolder && btn.isOpen))
  410.       {
  411.          if(btn.isBase)
  412.          {
  413.             btn.gotoAndStop("_baseOver");
  414.          }
  415.          else
  416.          {
  417.             btn.gotoAndStop("_rollover");
  418.          }
  419.          btn.txtObj.embedFonts = true;
  420.       }
  421.    }
  422.    function changeBtnState(btn, state)
  423.    {
  424.       if(btn.nodeData.header != "green")
  425.       {
  426.          btn.gotoAndStop(state);
  427.       }
  428.       btn.txtObj.embedFonts = true;
  429.       btn.state = state;
  430.    }
  431.    function clearDrawState(arrNav, nodePath)
  432.    {
  433.       var _loc3_ = arrNav.length;
  434.       if(nodePath.length == 0)
  435.       {
  436.          var _loc2_ = 0;
  437.          while(_loc2_ < _loc3_)
  438.          {
  439.             arrNav[_loc2_].draw = false;
  440.             _loc2_ = _loc2_ + 1;
  441.          }
  442.       }
  443.       else
  444.       {
  445.          var _loc6_ = nodePath[0];
  446.          nodePath.shift();
  447.          this.clearDrawState(arrNav[_loc6_].arrSubSections,nodePath);
  448.       }
  449.    }
  450.    function onFileClicked(btnNode, bFromNavigation)
  451.    {
  452.       this.fileClicked = true;
  453.       var _loc4_ = btnNode.nodeData.nodePath.slice();
  454.       var _loc3_ = undefined;
  455.       if(_loc4_.length > 1)
  456.       {
  457.          _loc3_ = _loc4_.slice();
  458.          _loc3_.pop();
  459.       }
  460.       if(_loc3_ != undefined)
  461.       {
  462.          if(!this.testMatch(this.lastFolderClicked,_loc3_))
  463.          {
  464.             this.lastFolderClicked = _loc3_.slice();
  465.             this.clearDrawState(this.arrNavigation,_loc3_);
  466.          }
  467.       }
  468.       this.lastFileClicked = _loc4_.slice();
  469.       trace("lastFileClicked = " + this.lastFileClicked);
  470.       this.reopenNode = [];
  471.       if(_loc4_.length == 1)
  472.       {
  473.          this.lastFolderClicked = [];
  474.       }
  475.       _root.currId = btnNode.nodeData.unit;
  476.       trace("i am on file clicked in navigation");
  477.       _root.loadedFromNav = true;
  478.       if(btnNode.label != "iTest")
  479.       {
  480.          _root.onFileClicked(btnNode.nodeData);
  481.       }
  482.       else
  483.       {
  484.          _root.onFileClicked(btnNode.nodeData);
  485.          this.clearMenu();
  486.          _root.unitData.homeBtnPress();
  487.       }
  488.       this.createMenu(true);
  489.    }
  490.    function onFolderClicked(btnNode, bFromNavigation)
  491.    {
  492.       trace("folder clicked: " + this.lastFileClicked);
  493.       var _loc5_ = true;
  494.       var _loc4_ = btnNode.nodeData.nodePath.slice();
  495.       this.fileClicked = false;
  496.       if(_loc4_.length == 1 && this.lastFolderClicked[0] == _loc4_[0] && this.lastFileClicked.length != 0)
  497.       {
  498.          _loc5_ = false;
  499.       }
  500.       if(this.testMatch(this.lastFolderClicked,_loc4_) && bFromNavigation)
  501.       {
  502.          this.lastFolderClicked = _loc4_.slice();
  503.          if(_loc5_)
  504.          {
  505.             this.lastFolderClicked.pop();
  506.          }
  507.       }
  508.       else if(this.testMatch(this.reopenNode,_loc4_) && bFromNavigation)
  509.       {
  510.          this.lastFolderClicked = this.reopenNode.slice();
  511.       }
  512.       else
  513.       {
  514.          this.lastFolderClicked = _loc4_.slice();
  515.       }
  516.       if(_loc4_.length == 1)
  517.       {
  518.          this.reopenNode = [];
  519.          this.lastFileClicked = [];
  520.          if(this.arrNavigation[_loc4_[0]].label != "Activities")
  521.          {
  522.             _root.unitData.unitBtnPress(_loc4_[0]);
  523.          }
  524.       }
  525.       else if(_loc4_[0] == 0 && _loc4_.length == 2)
  526.       {
  527.          this.reopenNode = [];
  528.          this.lastFileClicked = [];
  529.       }
  530.       else if(_loc4_[0] == 0 && _loc4_.length == 3)
  531.       {
  532.          this.reopenNode = [];
  533.          this.lastFileClicked = [];
  534.       }
  535.       if(_loc4_[0] == this.reopenNode[0] && _loc4_.length == 1 && bFromNavigation)
  536.       {
  537.          this.clearDrawState(this.arrNavigation,this.reopenNode.slice());
  538.       }
  539.       else if(_loc5_)
  540.       {
  541.          this.clearDrawState(this.arrNavigation,_loc4_.slice());
  542.       }
  543.       else if(_loc4_[0] == 0 && _loc4_.length == 1)
  544.       {
  545.          var _loc3_ = 0;
  546.          while(_loc3_ < this.arrNavigation[0].arrSubSections.length)
  547.          {
  548.             this.arrNavigation[0].arrSubSections[_loc3_].draw = true;
  549.             _loc3_ = _loc3_ + 1;
  550.          }
  551.       }
  552.       this.createMenu(true);
  553.    }
  554.    function subBtnClicked(unit, subUnit, bDontCollapseNav)
  555.    {
  556.       var _loc3_ = {};
  557.       this.lastFileClicked = [];
  558.       this.reopenNode = [];
  559.       _loc3_.nodeData = this.createNavObject(this.arrNavigation[0]);
  560.       _loc3_.nodeData = this.createNavObject(this.arrNavigation[0].arrSubSections[unit].arrSubSections[subUnit]);
  561.       _loc3_.nodeData.nodePath = [0,unit,subUnit];
  562.       if(bDontCollapseNav)
  563.       {
  564.          this.createMenu(true);
  565.          _root.unitData.subBtnPress(unit,subUnit);
  566.       }
  567.       else
  568.       {
  569.          this.onFolderClicked(_loc3_,true);
  570.       }
  571.    }
  572.    function unitBtnClicked(unit, bDontCollapseNav)
  573.    {
  574.       var _loc3_ = {};
  575.       _loc3_.nodeData = this.createNavObject(this.arrNavigation[unit]);
  576.       _loc3_.nodeData.nodePath = [unit];
  577.       trace("dumping this unitNodeData ");
  578.       trace(_loc3_.nodeData.label);
  579.       if(bDontCollapseNav)
  580.       {
  581.          this.onFolderClicked(_loc3_,false);
  582.       }
  583.       else if(_loc3_.nodeData.label == "iTest")
  584.       {
  585.          this.onFileClicked(_loc3_);
  586.          this.clearMenu();
  587.          _root.unitData.homeBtnPress();
  588.       }
  589.       else
  590.       {
  591.          this.onFolderClicked(_loc3_,true);
  592.       }
  593.    }
  594.    function getUnitInfo(nodePath, difference)
  595.    {
  596.       if(difference != undefined)
  597.       {
  598.          nodePath[nodePath.length - 1] += difference;
  599.       }
  600.       this.getUnitInfoByNode(this.arrNavigation,nodePath);
  601.       return this.objectHolder;
  602.    }
  603.    function getUnitInfoByNode(arrNav, nodePath)
  604.    {
  605.       if(nodePath.length == 2 && arrNav[nodePath[0]].arrActivities)
  606.       {
  607.          var _loc4_ = nodePath[0];
  608.          nodePath.shift();
  609.          this.getUnitInfoByNode(arrNav[_loc4_].arrActivities.arrSubSections,nodePath);
  610.       }
  611.       else if(nodePath.length == 1)
  612.       {
  613.          this.objectHolder = arrNav[nodePath[0]];
  614.       }
  615.       else
  616.       {
  617.          _loc4_ = nodePath[0];
  618.          nodePath.shift();
  619.          this.getUnitInfoByNode(arrNav[_loc4_].arrSubSections,nodePath);
  620.       }
  621.    }
  622.    function hideDummys()
  623.    {
  624.       trace("initialise");
  625.       this.navigation_mc.dummy1_mc.swapDepths(0);
  626.       this.navigation_mc.dummy1_mc.removeMovieClip();
  627.       this.navigation_mc.dummy2_mc.swapDepths(0);
  628.       this.navigation_mc.dummy2_mc.removeMovieClip();
  629.       this.navigation_mc.dummy3_mc.swapDepths(0);
  630.       this.navigation_mc.dummy3_mc.removeMovieClip();
  631.       this.navigation_mc.dummy4_mc.swapDepths(0);
  632.       this.navigation_mc.dummy4_mc.removeMovieClip();
  633.       this.navigation_mc.endSection.swapDepths(0);
  634.       this.navigation_mc.endSection.removeMovieClip();
  635.    }
  636.    function parseXML(navigationXML)
  637.    {
  638.       trace("asasassadfdfdfd");
  639.       var _loc3_ = undefined;
  640.       var _loc4_ = undefined;
  641.       var _loc5_ = undefined;
  642.       var _loc6_ = undefined;
  643.       this.arrNavigation = [];
  644.       _loc4_ = navigationXML.firstChild;
  645.       _loc3_ = 0;
  646.       while(_loc3_ <= _loc4_.childNodes.length)
  647.       {
  648.          if(_loc4_.childNodes[_loc3_].nodeName == "folder")
  649.          {
  650.             _loc5_ = this.extractFolder(_loc4_.childNodes[_loc3_],_loc3_,false);
  651.             this.arrNavigation.push(_loc5_);
  652.          }
  653.          else if(_loc4_.childNodes[_loc3_].nodeName == "file")
  654.          {
  655.             _loc6_ = this.extractFile(_loc4_.childNodes[_loc3_],_loc3_);
  656.             this.arrNavigation.push(_loc6_);
  657.          }
  658.          _loc3_ = _loc3_ + 1;
  659.       }
  660.       this.addNodePaths(this.arrNavigation,[]);
  661.       _root.unitData.getNavArr(this.arrNavigation);
  662.       this.initialDisplay();
  663.    }
  664.    function extractFolder(folderTag, nodeNo, isActivity)
  665.    {
  666.       var _loc4_ = {};
  667.       _loc4_.label = folderTag.attributes.label;
  668.       if(folderTag.attributes.title)
  669.       {
  670.          _loc4_.title = folderTag.attributes.title;
  671.       }
  672.       if(folderTag.attributes.image)
  673.       {
  674.          _loc4_.image = folderTag.attributes.image;
  675.       }
  676.       var _loc7_ = false;
  677.       if(folderTag.attributes.label == "Activities")
  678.       {
  679.          isActivity = true;
  680.          _loc7_ = true;
  681.       }
  682.       _loc4_.refNo = nodeNo;
  683.       _loc4_.arrSubSections = [];
  684.       _loc4_.bFolder = true;
  685.       _loc4_.draw = false;
  686.       var _loc2_ = 0;
  687.       while(_loc2_ <= folderTag.childNodes.length)
  688.       {
  689.          if(folderTag.childNodes[_loc2_].nodeName == "folder")
  690.          {
  691.             _loc4_.arrSubSections.push(this.extractFolder(folderTag.childNodes[_loc2_],_loc2_,isActivity));
  692.          }
  693.          else if(folderTag.childNodes[_loc2_].nodeName == "file")
  694.          {
  695.             _loc4_.arrSubSections.push(this.extractFile(folderTag.childNodes[_loc2_],_loc2_,isActivity));
  696.          }
  697.          _loc2_ = _loc2_ + 1;
  698.       }
  699.       if(isActivity && !_loc7_)
  700.       {
  701.          if(_loc4_.arrSubSections.length > 1)
  702.          {
  703.             var _loc6_ = new Object();
  704.             _loc6_.bFolder = false;
  705.             _loc6_.draw = false;
  706.             _loc6_.label = _loc4_.label;
  707.             _loc6_.arrActivities = {};
  708.             _loc6_.link = {};
  709.             _loc6_.link.url = "activities.swf";
  710.             _loc6_.arrActivities = _loc4_;
  711.             _loc6_.activitySectionFile = true;
  712.             _loc4_ = _loc6_;
  713.          }
  714.          else
  715.          {
  716.             _loc4_ = _loc4_.arrSubSections[0];
  717.             _loc4_.activitySectionFile = true;
  718.          }
  719.       }
  720.       return _loc4_;
  721.    }
  722.    function extractFile(fileTag, nodeNo, isActivity)
  723.    {
  724.       var _loc4_ = {};
  725.       var _loc9_ = undefined;
  726.       var _loc6_ = undefined;
  727.       var _loc5_ = undefined;
  728.       _loc4_.link = {};
  729.       _loc4_.bFolder = false;
  730.       _loc4_.isActivity = isActivity;
  731.       _loc4_.draw = false;
  732.       if(fileTag.attributes.label)
  733.       {
  734.          _loc4_.label = fileTag.attributes.label;
  735.       }
  736.       if(fileTag.attributes.url)
  737.       {
  738.          _loc4_.link.url = fileTag.attributes.url;
  739.       }
  740.       if(fileTag.attributes.title)
  741.       {
  742.          _loc4_.title = fileTag.attributes.title;
  743.       }
  744.       if(fileTag.attributes.activityFile)
  745.       {
  746.          _loc4_.link.activityFile = fileTag.attributes.activityFile;
  747.       }
  748.       if(fileTag.attributes.PDF)
  749.       {
  750.          var _loc8_ = new Array();
  751.          _loc9_ = fileTag.attributes.PDF;
  752.          _loc6_ = _loc9_.split("\\");
  753.          var _loc2_ = 0;
  754.          while(_loc2_ < _loc6_.length)
  755.          {
  756.             _loc5_ = _loc6_[_loc2_].split(".");
  757.             var _loc7_ = {};
  758.             _loc7_.unit = _loc5_[0];
  759.             _loc7_.subSection = _loc5_[1];
  760.             _loc8_.push(_loc7_);
  761.             _loc2_ = _loc2_ + 1;
  762.          }
  763.          _loc4_.link.pdf = _loc8_;
  764.       }
  765.       if(fileTag.attributes.type)
  766.       {
  767.          _loc4_.type = fileTag.attributes.type;
  768.          if(fileTag.attributes.type != fileTag.previousSibling.attributes.type && fileTag.attributes.type != fileTag.nextSibling.attributes.type)
  769.          {
  770.             this.typeCount = 0;
  771.          }
  772.          else if(fileTag.attributes.type != fileTag.previousSibling.attributes.type)
  773.          {
  774.             this.typeCount = 1;
  775.          }
  776.          else
  777.          {
  778.             this.typeCount = this.typeCount + 1;
  779.          }
  780.       }
  781.       if(fileTag.attributes.header)
  782.       {
  783.          _loc4_.header = fileTag.attributes.header;
  784.       }
  785.       if(fileTag.attributes.rubric)
  786.       {
  787.          _loc4_.rubric = fileTag.attributes.rubric;
  788.       }
  789.       if(fileTag.parentNode.attributes.label == "Mini-Grammar")
  790.       {
  791.          _loc4_.referenceFile = true;
  792.          _loc8_ = new Array();
  793.          _loc7_ = {};
  794.          if(fileTag.attributes.PDF)
  795.          {
  796.             _loc7_.unit = fileTag.attributes.PDF;
  797.          }
  798.          else
  799.          {
  800.             _loc7_.unit = nodeNo + 1;
  801.          }
  802.          _loc8_.push(_loc7_);
  803.          _loc4_.link.pdf = _loc8_;
  804.       }
  805.       if(fileTag.parentNode.parentNode.attributes.label == "Activities")
  806.       {
  807.          _loc4_.activitySectionFile = true;
  808.       }
  809.       if(fileTag.parentNode.attributes.label == "Grammar")
  810.       {
  811.          _loc4_.grammarSectionFile = true;
  812.       }
  813.       _loc4_.refNo = nodeNo;
  814.       return _loc4_;
  815.    }
  816.    function addNodePaths(arr, currNode)
  817.    {
  818.       var _loc2_ = 0;
  819.       while(_loc2_ < arr.length)
  820.       {
  821.          arr[_loc2_].nodePath = currNode.concat([_loc2_]);
  822.          if(arr[_loc2_].arrSubSections)
  823.          {
  824.             this.addNodePaths(arr[_loc2_].arrSubSections,arr[_loc2_].nodePath);
  825.          }
  826.          _loc2_ = _loc2_ + 1;
  827.       }
  828.    }
  829.    function showNavigation(bValue)
  830.    {
  831.       this.navigation_mc._visible = bValue;
  832.    }
  833. }
  834.