<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") ?>:<br />
        (<?php print_string("cookiesenabled");?>) 
         <?php 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") ?>" />
          </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="submit" value="<?php print_string("loginguest") ?>" />
        </form>
<?php } ?>

<?php if (!empty($CFG->{'auth_'.$CFG->auth.'_stdchangepassword'})
          || $CFG->changepassword 
	  || is_internal_auth() ) {
	  if (is_internal_auth() || !empty($CFG->{'auth_'.$CFG->auth.'_stdchangepassword'})) {
              $changepassword = "forgot_password.php";
              $changebuttonname = get_string("senddetails");
          } else {
              $changepassword = $CFG->changepassword;
              $changebuttonname = get_string("passwordrecovery");
          }
?>
      <hr width="80%" />
      <p><?php print_string("forgotten") ?></p> 
        <form action="<?php p($changepassword) ?>" method="get" name="changepassword">
          <input type="submit" value="<?php p($changebuttonname) ?>" />
        </form>
<?php } ?>

    </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>
