<?
global $user , $lang;
?>
<div class="user_panel" style="clear: both;">
  <?
  if ( !is_object( $user ) || !$user -> get_login() )
  {
    ?>
    <form class="form_designer">
      <table>
        <tr>
          <th class="header" style="padding: 0px 0px 10px;"><?=$lang -> getTrans( 'T_EMAIL' );?>:</th>
          <td class="row"><input type="text" name="r_email" id="r_email"></td>
        </tr>
        <tr>
          <td colspan="2" class="row">
            <input type="button" value="<?=$lang -> getTrans( 'T_ODZYSKAJ_HASLO' );?>" onClick="recoverPassword()">
          </td>
        </tr>
      </table>
    </form>
    <?
  }
  ?>
</div>
<script type="text/javascript">
  function recoverPassword()
  {
    var email = $( "#r_email" ).val();
    if ( !sprawdzEmail( email ) )
      $.prompt( '<?=$lang -> getTrans( 'T_NIEPRAWIDLOWY_EMAIL_REJESTRACJA' );?>' , { buttons: { <?=$lang -> getTrans( 'T_ZAMKNIJ' );?>: true }, focus: 1 });
    else
    {
      $.prompt('<?=$lang -> getTrans( 'T_PROSZE_CZEKAC' );?>');
      xajax_recoverPassword( email );
    }
  }

  function sprawdzEmail(AdresEmail)
  {
    var TestEmail = /^(.[A-Za-z0-9\-]*\w)+@+([A-Za-z0-9\-]*\w)+(\.[A-Za-z]*\w)+$/;
    var Wynik = AdresEmail.match(TestEmail);

    if (Wynik == null)
      return false;
    return true;
  }
</script>