function extractId(longId)
{   
  idInfo = longId.split("_");
  return idInfo[idInfo.length - 1];
} 

$(document).ready( function()
{
  $(document).pngFix();


  $(".header").click( function()
  {
    shortId = extractId( $(this).attr("id") );
    if ( $("#content_" + shortId).is(":visible") )
    {
      if ($("#content_" + shortId).hasClass("floaters"))
        $("#content_" + shortId).hide();
      else
        $("#content_" + shortId).slideUp("slow");
      $("#toggle_" + shortId).html('<img src="/img/icons/add.png" alt="show" title="show" />');
    }
    else
    {
      if ($("#content_" + shortId).hasClass("floaters"))
        $("#content_" + shortId).show();
      else
        $("#content_" + shortId).slideDown("slow");
      $("#toggle_" + shortId).html('<img src="/img/icons/remove.png" alt="hide" title="hide" />');
    }
  });

  textboxes = $("input:text");

  if ($.browser.mozilla)
  {
    $(textboxes).keypress(checkForEnter);
  }
  else
  {
    $(textboxes).keydown(checkForEnter);
  }

  function checkForEnter(event)
  {
    if (event.keyCode == 13)
    {
      currentTextboxNumber = textboxes.index(this);

      if (textboxes[currentTextboxNumber + 1] != null)
      {
        nextTextbox = textboxes[currentTextboxNumber + 1];
        nextTextbox.select();
      }

      event.preventDefault();
      return false;
    }
  }
});

