ginebra/chrome/bedrockchrome/toolbar2.snippet/toolbar.js
branchGCC_SURGE
changeset 8 2e16851ffecd
parent 2 bf4420e9fa4d
parent 6 1c3b8676e58c
equal deleted inserted replaced
2:bf4420e9fa4d 8:2e16851ffecd
     1 
       
     2 var tbCb;
       
     3 
       
     4 /* create all functions with toolbar.* */
       
     5 //
       
     6 // INIT the webView Toolbar
       
     7 //
       
     8 
       
     9 /* Fade functions - modified the 3rdparty solution*/
       
    10 var FadeAnim = {
       
    11 
       
    12     fade : function (id) {
       
    13         opacity = 96;
       
    14         this.fadeLoop(id, opacity);
       
    15     },
       
    16     fadeLoop : function (id, opacity) {
       
    17         var o = document.getElementById(id);
       
    18         if (opacity >= 5) {
       
    19             FadeAnim.setOpacity(o, opacity);
       
    20             opacity -= 4;
       
    21             window.setTimeout("FadeAnim.fadeLoop('" + id + "', " + opacity + ")", 50);
       
    22         } else {
       
    23 //                        o.style.display = "none";
       
    24             o.style.visibility = 'hidden';
       
    25             //window.chrome.alert("Menu is " +  o.style.visibility);
       
    26             tbCb("hideCplt");
       
    27               
       
    28         }
       
    29     },
       
    30     setOpacity : function (o, opacity) {
       
    31         o.style.filter = "alpha(style=0,opacity:" + opacity + ")";      // IE
       
    32         o.style.KHTMLOpacity = opacity / 100;                           // Konqueror
       
    33         o.style.MozOpacity = opacity / 100;                                     // Mozilla (old)
       
    34         o.style.opacity = opacity / 100;                                        // Mozilla (new)
       
    35     },
       
    36 
       
    37     show : function (id) {
       
    38         opacity = 4;
       
    39         this.showLoop(id, opacity);
       
    40     },
       
    41     showLoop : function (id, opacity) {
       
    42         var o = document.getElementById(id);
       
    43         if (opacity <= 100) {
       
    44             FadeAnim.setOpacity(o, opacity);
       
    45             opacity += 4;
       
    46             window.setTimeout("FadeAnim.showLoop('" + id + "', " + opacity + ")", 50);
       
    47         }
       
    48         else {
       
    49             tbCb("showCplt");
       
    50         }
       
    51     }
       
    52 }
       
    53 
       
    54 /* Utility functions */
       
    55 function Util() {
       
    56     
       
    57     /* Utility function to strip off the given string
       
    58      */
       
    59     function convertToValue(num, str) {
       
    60 
       
    61         var i = num.indexOf(str);
       
    62         var value = 0;
       
    63         if (i > -1) {
       
    64             value = num.slice(0, i);
       
    65         }
       
    66         return Number(value);
       
    67     }
       
    68 
       
    69     /* Get the first button if of the toolbar specified by 'view' */
       
    70     function firstBtn(tbId) {
       
    71         var rowid = getRowId(tbId);
       
    72         return (document.getElementById(rowid).firstChild.id);
       
    73     }
       
    74 
       
    75     /* Get the last button if of the toolbar specified by 'view' */
       
    76     function lastBtn(tbId) {
       
    77         var rowid = getRowId(tbId);
       
    78         return (document.getElementById(rowid).lastChild.id);
       
    79     }
       
    80 
       
    81     /* Get the row id of the toolbar specified by 'view' */
       
    82     function getRowId(tbId) {
       
    83        var id;
       
    84         switch( tbId) {
       
    85             case  "WebViewToolbarId":
       
    86                 id = "webViewRow";
       
    87                 break;
       
    88             case  "WebViewMiniToolbarId":
       
    89                 id = "webViewMiniRow";
       
    90                 break;
       
    91             case  "HistoryViewToolbarId":
       
    92                 id = "historyRow";
       
    93                 break;
       
    94             case  "BookmarkViewToolbarId":
       
    95                 id = "bookmarkRow";
       
    96                 break;
       
    97             case  "BookmarkHistoryViewToolbarId":
       
    98                 id = "bookmarkHistoryRow";
       
    99                 break;
       
   100             case  "WindowViewToolbarId":
       
   101                 id = "windowRow";
       
   102                 break;
       
   103             default:
       
   104                 break;
       
   105         }
       
   106         return id;
       
   107 
       
   108     }
       
   109 
       
   110     /* This function calculates the margin-right needed */
       
   111     this.setMarginRight = function(tbId) {
       
   112 
       
   113         /* Get the total number of images in the toolbar */
       
   114         var firstIcon = firstBtn(tbId);
       
   115     
       
   116         var el = document.getElementById(getRowId(tbId));
       
   117         Icons = el.getElementsByTagName("img");
       
   118 
       
   119         numIcons = Icons.length;
       
   120         /* Get total width and total width od all icons */
       
   121         var  iconW = document.getElementById(firstIcon).offsetWidth;
       
   122         var  totalW =  document.getElementById(tbId).offsetWidth;
       
   123         var totalIconW= (iconW * numIcons);
       
   124         var firstobj = document.getElementById(firstIcon);
       
   125         var lastObj = document.getElementById(lastBtn(tbId));
       
   126 
       
   127         switch (numIcons) {
       
   128             case 1:
       
   129                 /* Only one icon */
       
   130                 var leftMarginStr=document.defaultView.getComputedStyle(firstobj, '').getPropertyValue("margin-left");
       
   131                 var leftMargin = convertToValue(leftMarginStr, "px");
       
   132         
       
   133                 var marginRight = totalW - totalIconW - leftMargin;
       
   134                 Icons[0].style.marginRight = marginRight + "px";
       
   135                 break;
       
   136             
       
   137         default:
       
   138             /* More than two buttons */
       
   139             var leftMarginStr=document.defaultView.getComputedStyle(firstobj, '').getPropertyValue("margin-left");
       
   140             var rightmarginStr=document.defaultView.getComputedStyle(lastObj, '').getPropertyValue("margin-right");
       
   141             var leftMargin = convertToValue(leftMarginStr, "px");
       
   142             var rightMargin = convertToValue(rightmarginStr, "px");
       
   143             var totalMargin = rightMargin + leftMargin ;
       
   144 
       
   145 
       
   146             /* Now determine remaining space */
       
   147             var marginRight = (totalW - totalIconW - totalMargin)/(numIcons - 1);
       
   148             for (var i = 0; i < numIcons; i++ ) {
       
   149     
       
   150                 if (i !== (numIcons-1)  ){
       
   151                     Icons[i].style.marginRight = marginRight + "px";
       
   152                 }
       
   153             }
       
   154             break;
       
   155         }
       
   156 
       
   157     }
       
   158 }
       
   159 
       
   160 /* create all functions with toolbar.* */
       
   161 //
       
   162 // INIT the webView Toolbar
       
   163 //
       
   164 
       
   165 function WebViewToolbar()
       
   166 {
       
   167 
       
   168     var utils = new Util();
       
   169     var menuTimeoutCb = _hideToolbar;
       
   170     var menuTimeoutId = 0;
       
   171     tbCb = _handleToolbarMenuCb;
       
   172 
       
   173 
       
   174     //Private methods
       
   175     //write webview toolbar HTML code to document
       
   176     function _writeWebViewToolbar() {
       
   177     var html = ''+
       
   178         '<span id="webViewRow" style="width:100%">'+
       
   179         '<img class="toolBarBtn firstButton" id="backButton" >'+
       
   180         '<span id="menu" >'+
       
   181         '<img class="toolBarBtn" id="zoomIn"   >'+
       
   182         '<img class="toolBarBtn" id="zoomOut" >'+
       
   183         '<img class="toolBarBtn" id="winButton" >'+
       
   184         '<img class="toolBarBtn" id="contextMenuButton" >'+
       
   185         '</span>'+
       
   186         '<img class="toolBarBtn lastButton" id="mvButton">'+
       
   187         '</span>';
       
   188         document.write(html);
       
   189 
       
   190         // We can immediately set up the simple buttons
       
   191         // ActionButtons have to wait until the page is loaded
       
   192         var index = window.pageController.pageCount();
       
   193         var base = "toolbar2.snippet/fjicons/windows" + index;
       
   194         new SimpleButton("winButton",
       
   195                          base + ".png",
       
   196                          base + "_pushed.png",
       
   197                          base + ".png",
       
   198                          _goToWindowView);
       
   199 
       
   200        new SimpleButton("mvButton",
       
   201                          "toolbar2.snippet/fjicons/mostVisited.png",
       
   202                          "toolbar2.snippet/fjicons/mostVisited_pushed.png",
       
   203                          "toolbar2.snippet/fjicons/mostVisited.png",
       
   204                          _activateMostVisited);
       
   205 
       
   206 
       
   207 
       
   208         new SimpleButton("contextMenuButton",
       
   209                           "toolbar2.snippet/fjicons/menu.png",
       
   210                           "toolbar2.snippet/fjicons/menu_pushed.png",
       
   211                           "toolbar2.snippet/fjicons/menu.png",
       
   212                           _contextMenuF);
       
   213 //       document.getElementById("menu").style.visibility = 'hidden';
       
   214        utils.setMarginRight("WebViewToolbarId");
       
   215    }
       
   216 
       
   217     /* Adds the back action button  using ActionButton from ../../js/ActionButton.js */
       
   218     function _setActions () {
       
   219         new ActionButton("backButton",
       
   220                      "toolbar2.snippet/fjicons/back.png",
       
   221                      "toolbar2.snippet/fjicons/back_pushed.png",
       
   222                      "toolbar2.snippet/fjicons/back_disabled.png",
       
   223                      window.pageController.actions.back);
       
   224 
       
   225         new ActionButton("zoomIn",
       
   226                      "toolbar2.snippet/fjicons/zoom+.png",
       
   227                      "toolbar2.snippet/fjicons/zoom+_pushed.png",
       
   228                      "toolbar2.snippet/fjicons/zoom+_disabled.png",
       
   229                      window.webView.actions.zoomIn);
       
   230 
       
   231 
       
   232         new ActionButton("zoomOut",
       
   233                      "toolbar2.snippet/fjicons/zoom-.png",
       
   234                      "toolbar2.snippet/fjicons/zoom-_pushed.png",
       
   235                      "toolbar2.snippet/fjicons/zoom-_disabled.png",
       
   236                      window.webView.actions.zoomOut);
       
   237 
       
   238         /* Add 'addWindow' action */
       
   239         new ActionButton("addWindow",
       
   240                          "toolbar2.snippet/fjicons/addwindow.png",
       
   241                          "toolbar2.snippet/fjicons/addwindow_pushed.png",
       
   242                          "toolbar2.snippet/fjicons/addwindow_disabled.png",
       
   243                          window.viewManager.WindowView.actions.addWindow);
       
   244     }
       
   245 
       
   246     var timeoutId = 0;
       
   247     function _contextMenuF ()
       
   248     {
       
   249     	  var hideFlag = 0;
       
   250     	    
       
   251     	  hideFlag = window.snippets.ContextMenuId.getContextMenuFlag();
       
   252     	     
       
   253     	  if(hideFlag == 1)
       
   254     	  {
       
   255     	     	 window.snippets.ContextMenuBgId.hide();
       
   256     	     	 window.snippets.ContextMenuId.hide();
       
   257     	       return;
       
   258     	  }
       
   259     	  
       
   260     	    
       
   261         clearTimeout(timeoutId);
       
   262     	
       
   263         window.snippets.ContextMenuBgId.setPosition(0,20);
       
   264         window.snippets.ContextMenuBgId.show();
       
   265         window.snippets.ContextMenuBgId.zValue = 1;
       
   266     	
       
   267         window.snippets.ContextMenuId.repaint();
       
   268         if (window.snippets.ContextMenuId.getDisplayMode() == "portrait")
       
   269             window.snippets.ContextMenuId.setPosition(83,270);
       
   270         else //landscape
       
   271             window.snippets.ContextMenuId.setPosition(223,130);
       
   272 
       
   273         window.snippets.ContextMenuId.show();
       
   274         window.snippets.ContextMenuId.zValue = 10;
       
   275            
       
   276         timeoutId = setTimeout ( 'window.snippets.ContextMenuId.hide(); window.snippets.ContextMenuBgId.hide()', 6000 ); // close the menu after 6 secs
       
   277 //        _showToolbar();
       
   278     }
       
   279 
       
   280     /* Update the windows icon based on the number of windows open */
       
   281     function _changeWindowIcon () {
       
   282         var index = window.pageController.pageCount();
       
   283         var base = "toolbar2.snippet/fjicons/windows" + index;
       
   284 
       
   285         document.getElementById('winButton').button.updateImages(base + ".png",
       
   286                                                                  base + "_pushed.png",
       
   287                                                                  base + ".png");
       
   288         //window.snippets.repaint("WebViewToolbarId");
       
   289 
       
   290     }
       
   291 
       
   292     function _goToWindowView () {        
       
   293         window.viewStack.switchView("WindowView", "webView");
       
   294     }
       
   295 
       
   296     function _goToGoAnywhereView () {
       
   297         /* Change to history view */
       
   298         window.viewStack.switchView("goAnywhereView", "webView");
       
   299     }
       
   300 
       
   301     function _goToBookmarkView () {
       
   302         /* Change to Bookmark view */
       
   303         window.viewStack.switchView("bookmarkTreeView", "webView");
       
   304     }
       
   305 
       
   306     function _goToRecentUrlView () {
       
   307          window.viewStack.switchView("bookmarkHistoryView", "webView");
       
   308     }
       
   309 
       
   310     function _activateMostVisited () {
       
   311         
       
   312     }
       
   313 
       
   314     function _chromeLoadComplete () {
       
   315         _setActions();
       
   316         _changeWindowIcon();
       
   317 
       
   318         /* Connect to pageCreated signal */
       
   319         window.pageController.pageCreated.connect(_changeWindowIcon);
       
   320 
       
   321         /*
       
   322         window.pageController.loadStarted.connect(_showToolbar);
       
   323         window.pageController.loadFinished.connect(startMenuHideTimer);
       
   324         window.pageController.pageScrollRequested.connect(_showToolbar);
       
   325         */
       
   326     }
       
   327 
       
   328     function _showToolbar()  {
       
   329         var el = document.getElementById("menu");
       
   330         //window.chrome.alert("show Toolbar " +  el.style.visibility);
       
   331         if (el.style.visibility != 'visible') {
       
   332             document.getElementById("menu").style.visibility = 'visible';
       
   333             FadeAnim.show("menu");
       
   334         }
       
   335     }
       
   336 
       
   337     function startMenuHideTimer() {
       
   338 
       
   339         //window.chrome.alert("startMenuHideTimer");
       
   340         var el = document.getElementById("menu");
       
   341         if (el.style.visibility == 'visible' && (!menuTimeoutId) ) {
       
   342             //window.chrome.alert("startMenuHideTimer: started timer");
       
   343             //menuTimeoutId = setTimeout ('_hideToolbar()', 1000);
       
   344             menuTimeoutId = setTimeout (menuTimeoutCb, 3000);
       
   345         }
       
   346     }
       
   347 
       
   348     function _hideToolbar()  {
       
   349         //window.chrome.alert("hideToolbar " +  document.getElementById("menu").style.visibility);
       
   350 
       
   351         var el = document.getElementById("menu");
       
   352 
       
   353         clearTimeout(menuTimeoutId);
       
   354         menuTimeoutId = 0;
       
   355 
       
   356         if (el.style.visibility != 'hidden' ) {
       
   357             FadeAnim.fade("menu");
       
   358             //window.chrome.alert("hide Toolbar " +  document.getElementById("menu").style.visibility);
       
   359         }
       
   360     }
       
   361 
       
   362     function _handleToolbarMenuCb(x) {
       
   363 
       
   364         if (x == "showCplt" ) {
       
   365             startMenuHideTimer();
       
   366         }
       
   367         else if (x == "hideCplt"){
       
   368 
       
   369         }
       
   370     }
       
   371 
       
   372     function _activateBookmark () {
       
   373         window.chrome.toggleVisibility("BookmarkViewToolbarId");
       
   374     }
       
   375 
       
   376     function _deActivateBookmark () {
       
   377         window.chrome.toggleVisibility("BookmarkViewToolbarId");
       
   378     }
       
   379 
       
   380     function _activateHistory () {
       
   381         window.chrome.toggleVisibility("HistoryViewToolbarId");
       
   382     }
       
   383 
       
   384     function _deActivateHistory () {
       
   385         window.chrome.toggleVisibility("HistoryViewToolbarId");
       
   386     }
       
   387 
       
   388     function _activateBookMarkHistory () {
       
   389         window.chrome.toggleVisibility("BookmarkHistoryViewToolbarId");
       
   390     }
       
   391 
       
   392     function _deActivateBookMarkHistory () {
       
   393         window.chrome.toggleVisibility("BookmarkHistoryViewToolbarId");
       
   394     }
       
   395 
       
   396     function _activateWebView () {
       
   397         window.chrome.toggleVisibility("WebViewToolbarId");
       
   398     }
       
   399 
       
   400     function _deActivateWebView () {
       
   401         window.chrome.toggleVisibility("WebViewToolbarId");
       
   402     }
       
   403 
       
   404     function _activateWindowView () {
       
   405 
       
   406         window.chrome.alert("_activateWindowView");
       
   407 
       
   408         /* Show the window count snippet */
       
   409         document.getElementById('WindowCountBarId').wcChrome.wcUpdateWindowHtml();
       
   410         window.chrome.toggleVisibility("WindowCountBarId");
       
   411 
       
   412         window.chrome.toggleVisibility("WindowViewToolbarId");
       
   413     }
       
   414 
       
   415     function _deActivateWindowView () {
       
   416 
       
   417         window.chrome.toggleVisibility("WindowCountBarId");
       
   418         window.chrome.toggleVisibility("WindowViewToolbarId");
       
   419 
       
   420         /* Set the windows icon based on the number of windows */
       
   421         _changeWindowIcon();
       
   422     }
       
   423 
       
   424     function _pageChanged() {
       
   425         _changeWindowIcon();
       
   426         window.chrome.alert("_pageChanged");
       
   427         document.getElementById('WindowCountBarId').wcChrome.wcUpdateWindowHtml();
       
   428     }
       
   429 
       
   430     function _updateToolbar() {
       
   431        utils.setMarginRight("WebViewToolbarId");
       
   432 
       
   433     }
       
   434 
       
   435     _writeWebViewToolbar();
       
   436     window.chrome.loadComplete.connect(_chromeLoadComplete);
       
   437     window.viewStack.activateBookmark.connect(_activateBookmark);
       
   438     window.viewStack.deActivateBookmark.connect(_deActivateBookmark);
       
   439     window.viewStack.activateHistory.connect(_activateHistory);
       
   440     window.viewStack.deActivateHistory.connect(_deActivateHistory);
       
   441     window.viewStack.activateBookMarkHistory.connect(_activateBookMarkHistory);
       
   442     window.viewStack.deActivateBookMarkHistory.connect(_deActivateBookMarkHistory);
       
   443     window.viewStack.activateWebView.connect(_activateWebView);
       
   444     window.viewStack.deActivateWebView.connect(_deActivateWebView);
       
   445     window.viewStack.activateWindowView.connect(_activateWindowView);
       
   446     window.viewStack.deActivateWindowView.connect(_deActivateWindowView);
       
   447     window.viewStack.pageChanged.connect(_pageChanged);
       
   448     window.chrome.onDisplayModeChanged.connect(_updateToolbar);
       
   449     window.chrome.viewPortResize.connect(_updateToolbar);
       
   450 
       
   451 } //end of class webViewToolbar
       
   452 
       
   453 
       
   454 // INIT the History View Toolbar
       
   455 function HistoryViewToolbar()
       
   456 {
       
   457     //Private methods
       
   458     //write historyview toolbar HTML code to document
       
   459     function _writeHistoryViewToolbar() {
       
   460         var tbhtml = ''+
       
   461         //'<span id="historyRow" style="width:100%">'+
       
   462         //'<img class="toolBarBtn firstButton" id="goBacktoWebViewHist">'+
       
   463         //'</span>';
       
   464 
       
   465         '<table class="toolBarTable">' +
       
   466         '<tr>' +
       
   467         '<td class="toolBarBtnCell" style="width=100%;"><img class="toolBarBtn" id="goBacktoWebViewHist"></td>'+
       
   468         '</tr>' +
       
   469         '</table>';
       
   470          document.write(tbhtml);
       
   471 
       
   472          /* add back button as a simple button */
       
   473          new SimpleButton("goBacktoWebViewHist",
       
   474                           "toolbar2.snippet/fjicons/back.png",
       
   475                           "toolbar2.snippet/fjicons/back_pushed.png",
       
   476                           "toolbar2.snippet/fjicons/back.png",
       
   477                           _goBackFromGoAnywhereView);
       
   478 
       
   479     }
       
   480 
       
   481     _goBackFromGoAnywhereView = function() {
       
   482         window.viewStack.switchView("webView", "goAnywhereView");
       
   483     }
       
   484 
       
   485     _writeHistoryViewToolbar();
       
   486 
       
   487 } //end of class HistoryViewToolbar
       
   488 
       
   489 // INIT the bookmark View Toolbar
       
   490 function BookmarkViewToolbar()
       
   491 {
       
   492     //Private methods
       
   493     //write webview toolbar HTML code to document
       
   494     function _writeBookmarkViewToolbar() {
       
   495         var tbhtml = ''+
       
   496         //'<span id="bookmarkRow" style="width:100%">'+
       
   497         //'<img class="toolBarBtn firstButton" id="goBacktoWebViewBM">'+
       
   498         //'<img class="toolBarBtn lastButton"  id="addToBookMark">'+
       
   499         //'</span>';
       
   500         '<table class="toolBarTable">' +
       
   501             '<tr>' +
       
   502             '<td class="toolBarBtnCell" style="width=50%;"><img class="toolBarBtn" id="goBacktoWebViewBM"></td>'+
       
   503             '<td class="toolBarBtnCell" style="width=50%;"><img class="toolBarBtn" id="addToBookMark"></td>'+
       
   504             '</tr>'+
       
   505             '</table>';
       
   506 
       
   507          document.write(tbhtml);
       
   508 
       
   509 
       
   510          /* add back button as a simple button */
       
   511          new SimpleButton("goBacktoWebViewBM",
       
   512                           "toolbar2.snippet/fjicons/back.png",
       
   513                           "toolbar2.snippet/fjicons/back_pushed.png",
       
   514                           "toolbar2.snippet/fjicons/back.png",
       
   515                           _goBackFromBookmarkView);
       
   516 
       
   517          /* add bookmark button as a simple button */
       
   518          new SimpleButton("addToBookMark",
       
   519                          "toolbar2.snippet/fjicons/addwindow.png",
       
   520                          "toolbar2.snippet/fjicons/addwindow_pushed.png",
       
   521                          "toolbar2.snippet/fjicons/addwindow.png",
       
   522                          _addCurrentPageToBookMark);
       
   523 
       
   524     }
       
   525 
       
   526     function _goBackFromBookmarkView () {
       
   527         window.viewStack.switchView("webView", "bookmarkTreeView");
       
   528     }
       
   529 
       
   530     function _addCurrentPageToBookMark () {
       
   531         /* Change to history view */
       
   532         window.chrome.addCurrentPageToBookMark();
       
   533     }
       
   534 
       
   535 
       
   536     _writeBookmarkViewToolbar();
       
   537 
       
   538 }
       
   539 
       
   540 // INIT the Bookmark History View Toolbar
       
   541 function BookmarkHistoryViewToolbar()
       
   542 {
       
   543     /* BookmarkHist View Toolbar */
       
   544     function _writeBookmarkHistoryViewToolbar() {
       
   545         var tbhtml = ''+
       
   546         //'<span id="bookmarkHistoryRow" style="width:100%">'+
       
   547         //'<img class="toolBarBtn firstButton" id="goBacktoWebViewBMH">'+
       
   548         //'</span>';
       
   549         '<table class="toolBarTable">' +
       
   550             '<tr>' +
       
   551             '<td class="toolBarBtnCell" style="width=100%;"><img class="toolBarBtn" id="goBacktoWebViewBMH"></td>'+
       
   552             '</tr>'+
       
   553             '</table>';
       
   554          document.write(tbhtml);
       
   555 
       
   556          /* add back button as a simple button */
       
   557          new SimpleButton("goBacktoWebViewBMH",
       
   558                           "toolbar2.snippet/fjicons/back.png",
       
   559                           "toolbar2.snippet/fjicons/back_pushed.png",
       
   560                           "toolbar2.snippet/fjicons/back.png",
       
   561                           _goBackFromRecentUrlView);
       
   562     }
       
   563 
       
   564     /* This function changes the view to webView and updates the layout correspondingly */
       
   565     _goBackFromRecentUrlView = function()
       
   566     {
       
   567         window.viewStack.switchView("webView", "bookmarkHistoryView");
       
   568     }
       
   569 
       
   570     _writeBookmarkHistoryViewToolbar();
       
   571 
       
   572 }
       
   573 
       
   574 
       
   575 // INIT the Window View Toolbar
       
   576 function WindowViewToolbar()
       
   577 {
       
   578     /* Window View Toolbar */
       
   579     function _writeWindowToolbar() {
       
   580         var tbhtml = ''+
       
   581             //    '<span id="windowRow" style="width:100%">'+
       
   582             //    '<img class="toolBarBtn firstButton" id="goBacktoWebViewWin">'+
       
   583             //    '<img class="toolBarBtn" id="addWindow">'+
       
   584             //    '</span>';
       
   585             '<table class="toolBarTable">' +
       
   586             '<tr>' +
       
   587             '<td class="toolBarBtnCell" style="width=50%;"><img class="toolBarBtn" id="goBacktoWebViewWin"></td>'+
       
   588             '<td class="toolBarBtnCell" style="width=50%;"><img class="toolBarBtn" id="addWindow"></td>'+
       
   589             '</tr>'+
       
   590             '</table>';
       
   591 
       
   592 
       
   593          document.write(tbhtml);
       
   594 
       
   595          /* add back as simple button, add window is an action button */
       
   596          new SimpleButton("goBacktoWebViewWin",
       
   597                           "toolbar2.snippet/fjicons/back.png",
       
   598                           "toolbar2.snippet/fjicons/back_pushed.png",
       
   599                           "toolbar2.snippet/fjicons/back.png",
       
   600                           _goBackFromWindowView);
       
   601 
       
   602        }
       
   603 
       
   604     _goBackFromWindowView = function() {
       
   605         window.viewStack.switchView("webView", "WindowView");
       
   606     }
       
   607     _writeWindowToolbar();
       
   608 }
       
   609 
       
   610 
       
   611