$.fx.speeds._default = 1000;

$(function()
{
  $("#masterlevel").accordion(
  {
    autoHeight: false,
    navigation: true,
    collapsible: true
  });
});

$(function()
{
  $("#statslevel").accordion(
  {
    autoHeight: false,
    navigation: true,
    collapsible: true,
	active: 3
  });
});

$(function()
{
  $("#username").autocomplete(
  {
    source: "users.php",
    minLength: 3,
    delay: 0,
  });
});

function move_on_max(field, nextField, maxLength)
{
  field.value = field.value.toUpperCase();

  if(field.value.length >= maxLength)
  {
    document.getElementById(nextField).focus();
  }
}

function validate_form(theform)
{
  msg = "";

  if(theform.pass1.value.length != 5 || theform.pass2.value.length != 4 || theform.pass3.value.length != 5 || theform.pass4.value.length != 4 || theform.pass5.value.length != 5)
  {
    msg = "Invalid auditor pass format. Please recheck your entry.";
  }
  else if(theform.username.value == "")
  {
    msg = "Please enter a forum account username.";
  }

  if(msg != "")
  {
    alert(msg);
    return false;
  }

  return true;
}
