<?php
session_start();
if(!isset($_SESSION['auth'])) {
	header("location:index.php");
}

require_once("../inc/confNetisse.php");
require_once("./functions.php");

$DID = isset($_REQUEST["did"]) ? intval($_REQUEST["did"]) : 0;
?>

<html>

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title><?php echo $PROJECT_TITLE;?> : Cr&#233;ation d'une nouvelle direction</title>
	<link rel="stylesheet" href="css/font-awesome.min.css" />
	<link rel="stylesheet" type="text/css" href="css/cadif.css" />
	<link rel="stylesheet" type="text/css" href="css/dashboard.css" />
	<link rel="stylesheet" type="text/css" href="css/cans/jquery-ui-1.8.17.custom.css" />
	<!--<link rel="stylesheet" type="text/css" href="css/tableTools_jui.css" />-->
	<link rel="stylesheet" type="text/css" href="css/datatable_jui.css" />

	<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="js/jquery-ui-1.8.22.custom.min.js"></script>
	<script type="text/javascript" src="js/jquery.dataTables.js"></script>
	<script type="text/javascript">

	function checkMax(obj,maxlength){
		if (obj.value.length > maxlength) {
			obj.value = obj.value.substring(0, maxlength);
			var POP = $('<div></div>').html("<center>Votre message est trop long. Merci de le raccourcir.</center>").dialog({autoOpen: false,title: 'Erreur'});
			POP.dialog({autoOpen:false, modal:true, draggable: false, width:360,close:function(ev, ui){document.getElementById(obj).focus();} });
			POP.dialog("open");
		}
	}

	function checkForm() {
		if (document.getElementById("nom").value == "") {
			var POP = $('<div></div>').html("<center>Vous devez renseigner le champ 'Nom'.</center>").dialog({autoOpen: false,title: 'Erreur'});
			POP.dialog({autoOpen:false, modal:true, draggable: false, width:360,close:function(ev, ui){document.getElementById("nom").focus();} });
			POP.dialog("open");
		} else {
			document.formAgencyNew.submit();
		}
	}
	</script>
</head>


<body>

	<div id="global">

		<div id="home">
			<div id="logo"><a href="dashboard.php"><img src="<?php echo $SERVER; ?>assets/img/logo.png" height="110" border="0"/></a></div>
			<div id="username">
				<b><?php echo isset($_SESSION["nom"]) ? $_SESSION["nom"] : $_SESSION["matricule"];?></b> &nbsp; | &nbsp; <a href="close.php" class="link" title="Fermer et clore votre session">D&#233;connexion</a>
				<br/>
			</div>
		</div>
		<div id="panels">
			<?php include "menu.php";?>
			<div class="main-content">
				<div id="title">
					Cr&#233;ation d'une nouvelle direction
				</div>
				<div id="form">
					<form name="formAgencyNew" id="formAgencyNew" action="do.php" method="post">
						<input type="hidden" name="act" value="drNew"/>

						<table align="center" class="form">
							<tr>
								<td>Nom de la direction</td>
								<td><input type="text" name="nom" id="nom" size="30" tabindex="1"/></td>
							</tr>
							<tr>
								<td>&nbsp;</td>
								<td align="center"><input type="button" class="formAct" name="valider" id="valider" value="Valider" onclick="checkForm();" tabindex="8"/></td>
							</tr>
						</table>
					</form>
				</div>
			</div>

		</div>

		<?php include 'footer.php';?>
		<script>
		document.getElementById('nom').focus();
	</script>

</body>

</html>