// Move RedBubble people actions to top of profile
// Version 0.2
// 2008-01-22
// Copyright (c) 2008, Dave Pearson <http://www.davep.org/>
// Released under the GPL
// http://www.gnu.org/copyleft/gpl.html
//
// --------------------------------------------------------------------
//
// This is a Greasemonkey user script.  To install it, you need
// Greasemonkey: http://www.greasespot.net/
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to "Install User Script".
// Accept the default configuration and install.
//
// To uninstall, go to Tools/Manage User Scripts,
// select "RedBubble Move People Actions", and click Uninstall.
//
// --------------------------------------------------------------------
//
// ==UserScript==
// @name          RedBubble Move People Actions
// @namespace     http://www.davep.org/
// @description   Moves the comment box to the bottom of the comments
// @include       http://www.redbubble.com/people/*
// ==/UserScript==

// Function to find the actions for a user's profile.
function getModuleActions()
{
   var actions = null;
   var ulists  = document.getElementsByTagName( 'ul' );

   for ( i = 0; i < ulists.length; i++ )
   {
      if ( ulists[ i ].className == 'module-actions' )
      {
         actions = ulists[ i ];
         break;
      }
   }

   return actions;
}

// Look for the actions.
var actions = getModuleActions();

// Look for the start of the profile.
var profile = document.getElementById( 'profile-meta' );

// Did we get them?
if ( actions && profile ) {
   // We did. Move the actions to the start of the profile.
   profile.parentNode.insertBefore( actions, profile.nextSibling );
}

