	//$(document).ready(function() {
			//tabs
			//$('#tabs')
			
		//});


 $(function(){
  
  // The tab groups to manage.
  var tabs = $( '#tabs' ).tabs({ fx: { opacity: 'toggle' } }),
    
    // Because the jQuery UI tabs API doesn't allow selecting a tab without
    // also triggering its select event, we need the select event handler to
    // return false when the tab is clicked, but return true when the tab is
    // changed via the fragmentChange event handler. This variable allows the
    // script to keep track.
    in_event;
  
  // Enable tabs (and the select event) on all tab groups.
  tabs.tabs({
    select: function( event, ui ) {
      
      if ( in_event ) {
        // Any tab "select" event code goes here.
        debug.log( this.id, ui.index );
        
      } else {
        // Update the fragment.
        var obj = {};
        obj[ this.id ] = ui.index; // Set tab_group = index
        $.setFragment( obj );
      }
      
      // Don't return true when clicked, only return true if called via the
      // fragmentChange event handler.
      return in_event;
    }
  });
  
  // Parse the fragment and update all tab groups as necessary.
  function parse_fragment() {
    in_event = true;
    
    // Get the current document fragment, coercing numeric values into numbers.
    var params = $.fragment( true );
    
    // Select the appropriate tabs for each tab group (you could keep track of
    // what tab each group is on using .data, and only select a tab if it has
    // changed).
    tabs.each(function(){
      $(this).tabs( 'select', params[ this.id ] !== undefined ? params[ this.id ] : 0 );
    });
    
    in_event = false;
  };
  
  // Enable the fragmentChange event.
  $.fragmentChange( true );
  
  // Bind parse_fragment to the fragmentChange event (using a namespace in case
  // we need to unbind later).
  $(document).bind( 'fragmentChange.tabs', parse_fragment );
  
  // Call parse_fragment now, in case the page was loaded with a fragment.
  parse_fragment();
  
});        
        
        


