// JavaScript Documentvar bookmarkedTabViewState = YAHOO.util.History.getBookmarkedState( "tabview" ); var initialTabViewState = bookmarkedTabViewState || "tab0";YAHOO.util.History.register( "tabview", initialTabViewState, function( state ) { // Select the tab according to the "state" parameter:tabView.set( "activeIndex", state.substr(3) ); } );var tabView; YAHOO.util.History.onLoadEvent.subscribe( function() { // Instantiate the TabView widget tabView = new YAHOO.widget.TabView( "tabview" ); tabView.addListener( "activeTabChange", handleTabViewActiveTabChange ); // Retrieve the current state of the TabView module and select the appropriate tabvar currentTabViewState = YAHOO.util.History.getCurrentState( "tabview" ); tabView.set( "activeIndex", currentTabViewState.substr(3) ); } );function handleTabViewActiveTabChange( e ) { 	var currentTabViewState = YAHOO.util.History.getCurrentState( "tabview" ); 	var newTabViewState = "tab" + this.getTabIndex( e.newValue ); // The following test is crucial. Otherwise, we end up circling forever. // Indeed, YAHOO.util.History.navigate will call the module onStateChange callback, // which will call tabView.set, which will call this handler and it keeps // going from here... if ( newTabViewState != currentTabViewState ) YAHOO.util.History.navigate( "tabview", newTabViewState ); }