$(function()
{
   $("#loginform").submit(function()
   {
      if (!$('#un').val() && !$('#em').val())
      {
         $('#forgem').show();
         return false;
      }
      else if (!$('#up').val())
      {
         $('#loginform').attr('action','../lostpass/');
         return true;
      }
      return true;
   });
   
   $('#btnSetEmail').click(function()
   {
      if ($('#inem').val()!='')
      {
         $("#loginform").append('<input type="hidden" name="em" id="em" value="'+$('#inem').val()+'"/>');
         $("#loginform").each(function(){this.submit();});
      }
   });
   
   $('#btnCancelEmail').click(function()
   {
      $('#inem').val('');
      $('#em').val('');
      $('#forgem').hide();
   });
   
   $('a.aUseLogin').click(function()
   {
      $('#un').val($(this).html());
      return false;
   });
   
   $('.urem').mouseover(function()
   {
      $('#uremhint').css('top', ($(this).offset()['top'] + $(this).offset()['height']) + 'px');
      $('#uremhint').css('left', $(this).offset()['left'] + 'px');
      $('#uremhint').show();
   });
   $('.urem').mouseout(function()
   {
      $('#uremhint').hide();
   });
});
