<?php
/*
 * This file is part of the easy-CMS project.
 * easy-CMS is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * easy-CMS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with easy-CMS; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */


include_once('config.inc.php');

$message = '';

if(isset($_REQUEST['error'])) {
  $message = LANG_LOGIN_ERROR;
}

?>
<html>
<head>
<script type="text/javascript" src="includes/html/scripts/md5.js"></script>

<script><!--
function processSubmission() {
	var passValue = document.getElementById('password').value;
	if(passValue.length != 32) {
		document.getElementById('password').value = hex_md5(passValue);
	}
}
//--></script>
<style>
body {
  background-color: #34669c;
}

#main {
  position: absolute;
  left: 50%;
  top: 25%;
  margin-left: -220px;
  margin-top: -70px;
  width: 440px;
  height: 300px;
  border: solid 1px black;
  background-color: #ffffff;
}

#title {
  position: absolute;
  top: 30px;
  width: 360px;
  height: 60px;
  font-family: Arial, Verdana, Helvetica;
  font-size: 22px;
  line-height: 40px;
  color: #3c8ec4;
  padding-left: 80px;
  background: url('includes/images/login.png') no-repeat 20px 0px;
}

#logpass {
  position: absolute;
  top: 110px;
  width: 395px;
  font-family: Verdana, Arial, Helvetica;
  font-size: 14px;
  color: #808080;
  padding-left: 45px;
}

#buttons {
  position: absolute;
  top: 220px;
  right: 40px;
  font-family: Verdana, Arial, Helvetica;
  font-size: 14px;
  color: #808080;
  padding-left: 45px;
}

#message {
  position: absolute;
  top: 180px;
  left: 45px;
  font-family: Arial, Verdana, Helvetica;
  font-size: 14px;
  color: red;
}
</style>
</head>
<body>
<form action="index.php" method="post" onsubmit="javascript:processSubmission();">
<div id="main">
  <div id="title"><?php echo LANG_LOGIN_LOGON ?></div>
  <div id="logpass">
    <div style="height: 20px; margin-bottom: 5px;">
      <div style="float: left; width: 130px;">&bull;&nbsp;&nbsp;<?php echo LANG_LOGIN_USERNAME; ?></div>
      <div style="float: left; margin-left: 10px;"><input id="first_input" type="edit" name="login" /></div>
    </div>
    <div style="height: 20px; margin-bottom: 5px;">
      <div style="float: left; width: 130px;">&bull;&nbsp;&nbsp;<?php echo LANG_LOGIN_PASSWORD; ?></div>
      <div style="float: left; margin-left: 10px;"><input type="password" id="password" name="password" /></div>
    </div>
  </div>
  <div id="message"><?php echo $message; ?></div>
  <div id="buttons">
    <div style="float: left; margin-right: 6px;"><input type="submit" value="&nbsp;<?php echo LANG_OK_BUTTON; ?>&nbsp;" /></div><div style="float: left;"><input type="button" value="&nbsp;<?php echo LANG_CANCEL_BUTTON; ?>&nbsp;" /></div>
  </div>
</div>
<input type="hidden" name="action" value="login" />
</form>
<script>
document.getElementById('first_input').focus();
</script>
</body>
</html>