<table width="90%" border="0" cellpadding="5" align="center" class="loginbox">
<?php if ($show_instructions) { ?>
  <tr>
    <th width="50%" class="header left">
      <?php  print_string("returningtosite") ?>
    </th>
    <th width="50%" class="header right">
      <?php  print_string("firsttime") ?>
    </th>
  </tr>
<?php } ?>
  <tr>
    <td width="50%" align="center" valign="top" class="content left">
      <p><?php print_string("loginusing") ?>:
        <?php
        if (empty($CFG->usesid))
        {
            echo "<br />(";
            print_string("cookiesenabled");
            echo ")";
            helpbutton("cookies", get_string("cookiesenabled"));
        }
        ?><br /><?php formerr($errormsg) ?>
      </p>
      <form action="index.php" method="post" name="login" id="login">
        <table border="0" align="center">
        <tr>
          <td width="80%">
            <table align="center" class="loginform">
              <tr class="username"> 
                <td align="right" class="c0">
                  <?php print_string("username") ?>:
                </td>
                <td class="c1">
                  <input type="text" name="username" size="15" value="<?php p($frm->username) ?>" alt="<?php print_string("username") ?>" /> 
                </td>
              </tr>
              <tr class="password"> 
                <td align="right" class="c0">
                  <?php print_string("password") ?>:
                </td>
                <td class="c1">
                  <input type="password" name="password" size="15" value="" alt="<?php print_string("password") ?>" />
                </td>
              </tr>
            </table>
          </td>
          <td width="20%">
            <input type="submit" value="<?php print_string("login") ?>" />
            <input type="hidden" name="testcookies" value="1" />
          </td>
        </tr>
        </table>
      </form>

<?php if ($CFG->guestloginbutton) {  ?>
      <hr width="80%" />
      <p><?php print_string("someallowguest") ?>:</p>
        <form action="index.php" method="post" name="guestlogin">
          <input type="hidden" name="username" value="guest" />
          <input type="hidden" name="password" value="guest" />
          <input type="hidden" name="testcookies" value="1" />
          <input type="submit" value="<?php print_string("loginguest") ?>" />
        </form>
<?php } ?>

<?php
    $changebuttonname = get_string("passwordrecovery");
    $sesskey = sesskey();
?>
      <hr width="80%" />
      <p><?php print_string("forgotten") ?></p> 
        <form action="forgot_password.php" method="post" name="changepassword">
          <input type="hidden" name="sesskey" value="<?php echo $sesskey; ?>" />
          <input type="submit" value="<?php p($changebuttonname) ?>" />
        </form>
    </td>

<?php if ($show_instructions) { ?>
    <td width="50%" valign="top" class="content right">
<?php     switch ($CFG->auth) {
              case "email":
                 print_string("loginsteps", "", "signup.php");
?>
                 <div align="center">
                   <form action="signup.php" method="get" name="signup">
                   <input type="submit" value="<?php print_string("startsignup") ?>" />
                   </form>
                 </div>
<?php            break;
               case "none":
                 print_string("loginstepsnone");
                 break;
               default:
                 echo format_text($CFG->auth_instructions);
                 if (!function_exists('auth_user_login')) {
                    require_once("../auth/$CFG->auth/lib.php");
                 }
                 if (!empty($CFG->auth_user_create) and function_exists('auth_user_create') ){
?>
                 <div align="center">
                    <form action="signup.php" method="get" name="signup">
                    <input type="submit" value="<?php print_string("startsignup") ?>" />
                    </form>
                 </div>
<?php            }
          }
?>
    </td></tr>
<?php } ?>
</table>
