$(document).ready(function() {
try
{
//  $(document).pngFix();

  var f = document.loginform;
  if (f)
  {
    new Validator({element: f.login, trim:true, nonempty:true});
    new Validator({element: f.password, nonempty:true});

    $("#loginpass, #remember").keydown(function(event) {
      if (event.keyCode == 13) 
      {
        $("form[name='loginform'] input.button1").click();
        return false;
      }
      });

    $("div.page_login .button1").bind("click", function() {
      f = this.form;
      if (!checkAllFormValidators(f, true)) return;
      hashpass(f);
      f.submit();
    });
  }

  var sf = document.searchform;
  if (sf)
  {
    new Validator({element: sf.q, trim:true, nonempty:true, minlen: 3, maxlen: 100});
  }

  $(".hide").hide();
  $(".show").show();
} catch(e) {}
});

function hashpass(f)
{
  f.hash.value = hex_md5(f.password.value);
  f.password.value = "";
  return true;
}
