<?php
require 'database.inc.php';
//session_start();
//session_register("lg_user");
//session_register("lg_password");
//session_register("lg_admin");
//session_register("lg_menu1");
//session_register("lg_menu2");
//session_register("lg_menu3");
//session_register("lg_menu4");
//session_register("lg_menu5");
?>
<html>

<head>
	<meta http-equiv='content-type' content='text/html;charset=utf-8'>
	<title>WebBike V1.0</title>
	<SCRIPT language=JavaScript src='valideformulaire.js' type=text/javascript></SCRIPT>
	<SCRIPT language=JavaScript src="milonic_src.js" type=text/javascript></SCRIPT>
	<script language=JavaScript>
		if (ns4) _d.write("<scr" + "ipt language=JavaScript src=mmenuns4.js><\/scr" + "ipt>");
		else _d.write("<scr" + "ipt language=JavaScript src=mmenudom.js><\/scr" + "ipt>");
	</script>

	<!--
<SCRIPT language=JavaScript src="menu_data.js" type=text/javascript></SCRIPT>
-->
	<script language=JavaScript>
		document.onkeydown = mykeydown;
		actif = "info";

		function mykeydown(e) {
			if (event.keyCode == 13) {
				document.forms[actif].submit();
			}
		}

		function set_default(Type, Sous_type) {
			if (MustSave == 1) {
				alert("Vous devez sauver les changements!");
				return;
			}
			if (AsChange == 1) {
				if (!confirm("Perdre chamgements?")) {
					return;
				}
			}
			texte = "Type = " + Type + " Sous_Type = " + Sous_type;
			document.location.href = "article.php?Type=" + Type + "&Sous_Type=" + Sous_type + "&NoVisu=0";
		}


		_menuCloseDelay = 500 // The time delay for menus to remain visible on mouse out
		_menuOpenDelay = 150 // The time delay before menus open on mouse over
		_subOffsetTop = 0 // Sub menu top offset
		_subOffsetLeft = 0 // Sub menu left offset

		with(menuStyle = new mm_style()) {
			onbgcolor = "#00007F";
			oncolor = "#FFFFFF";
			offbgcolor = "#BFBFBF";
			offcolor = "#000000";
			bordercolor = "#BFBFBF";
			borderstyle = "raised";
			borderwidth = 2;
			separatorsize = "2";
			padding = 4;
			//fontsize="75%";
			fontsize = "100%";
			fontfamily = "tahoma, verdana";
			high3dcolor = "#eeeeee";
			low3dcolor = "#7F7F7F";
			swap3d = "1";
			subimage = "arrow.gif";
			subimagepadding = "2";
			followscroll = 10;
		}

		<?php
		if (Test_User($lg_user, $lg_password) == TRUE) {
			echo 'with(milonic=new menuname("Main Menu")){' . "\n" .
				'style=menuStyle;' . "\n" .
				'top=10;' . "\n" .
				'left=10;' . "\n" .
				'alwaysvisible=1;' . "\n" .
				'followscroll="10";' . "\n" .
				'orientation="horizontal";' . "\n";
			if ($lg_menu1 != 0) {
				if ($lg_menu1 & 1)
					echo 'aI("text=Afficher article;align=center;clickfunction=set_default(1,1);");' . "\n";
				if ($lg_menu1 & 2)
					echo 'aI("text=Modifier article;align=center;clickfunction=set_default(1,2);");' . "\n";
				if ($lg_menu1 & 4)
					echo 'aI("text=Nouvel article;align=center;clickfunction=set_default(1,3);");' . "\n";
				if ($lg_menu1 & 8)
					echo 'aI("text=Copier article;align=center;clickfunction=set_default(1,4);");' . "\n";
				if ($lg_menu1 & 16)
					echo 'aI("text=Supprimer article;align=center;clickfunction=set_default(1,5);");' . "\n";
				echo '}' . "\n" . "\n";
			}
			echo 'drawMenus();' . "\n" . "\n";
		}
		?>
	</script>
	<link href="style.css" rel="stylesheet" media="screen">
</head>

<body>
	<?php
	if (Test_User($lg_user, $lg_password) == TRUE) {
		if (isset($Type) == False) {
			$Type = 1;
		}
		if (isset($Sous_Type) == False) {
			$Sous_Type = 2;
		}
		if (isset($Etape) == False) {
			$Etape = 0;
		}
		if (isset($NoVisu) == False) {
			$NoVisu = 0;
		}
		echo "<br><br>\n";
		switch ($Type) {
			case 1:
				switch ($Sous_Type) {
					case 1:
						echo "<big>Affichage article</big><br>\n";
						switch ($Etape) {
							case 0:
								Create_Recherche_Form(1, $NoVisu);
								break;
							case 1:
								Create_Recherche_Form(1, $NoVisu);
								Affiche_Resultat_Recherche_Form(1, $NoVisu);
								break;
							case 2:
								Affiche_formulaire(1, AFFICHAGE, $no_division = 1, $clef = ${GetNomClef(1)}, $no_visu = $NoVisu);
								break;
						}
						break;
					case 2:
						echo "<big>Modifiaction article</big><br>\n";
						switch ($Etape) {
							case 0:
								Create_Recherche_Form(1, $NoVisu);
								break;
							case 1:
								Create_Recherche_Form(1, $NoVisu);
								Affiche_Resultat_Recherche_Form(1, $NoVisu);
								break;
							case 2:
								if (isset($Modif))
									Valide_Modif(
										1,
										MODIFICATION,
										1,
										${GetNomClef(1)},
										$NoVisu,
										",DateModif='" . date("Y-m-d") . "',PersonneModif='" . addslashes($lg_user) . "'",
										''
									);

								Affiche_formulaire(1, MODIFICATION, $no_division = 1, $clef = ${GetNomClef(1)}, $no_visu = $NoVisu);
								break;
							case 3:
								Valide_Modif(
									1,
									MODIFICATION,
									1,
									${GetNomClef(1)},
									$NoVisu,
									",DateModif='" . date("Y-m-d") . "',PersonneModif='" . addslashes($lg_user) . "'",
									''
								);
								break;
						}
						break;
					case 3:
						echo "<big>Nouvel article</big><br>\n";
						switch ($Etape) {
							case 0:
								Affiche_formulaire(1, NOUVEAU, 1, '', $NoVisu);
								break;
							case 1:
								Valide_Modif(
									1,
									NOUVEAU,
									1,
									'',
									$NoVisu,
									", DateModif, PersonneModif",
									", '" . date("Y-m-d") . "', '" . addslashes($lg_user) . "'"
								);
								break;
						}
						break;
					case 4:
						echo "<big>Copier article</big><br>\n";
						switch ($Etape) {
							case 0:
								Create_Recherche_Form(1, $NoVisu);
								break;
							case 1:
								Create_Recherche_Form(1, $NoVisu);
								Affiche_Resultat_Recherche_Form(1, $NoVisu);
								break;
							case 2:
								Affiche_formulaire(1, COPIE, 1, ${GetNomClef(1)}, $NoVisu);
								break;
							case 3:
								Valide_Modif(
									1,
									COPIE,
									1,
									'',
									$NoVisu,
									", DateModif, PersonneModif",
									", '" . date("Y-m-d") . "', '" . addslashes($lg_user) . "'"
								);
								break;
						}
						break;
					case 5:
						echo "<big>Supprimer article</big><br>\n";
						switch ($Etape) {
							case 0:
								Create_Recherche_Form(1, $NoVisu);
								break;
							case 1:
								Create_Recherche_Form(1, $NoVisu);
								Affiche_Resultat_Recherche_Form(1, $NoVisu);
								break;
							case 2:
								Affiche_formulaire(1, SUPPRIMER, 1, ${GetNomClef(1)}, $NoVisu);
								break;
							case 3:
								Valide_Modif(1, SUPPRIMER, 1, ${GetNomClef(1)}, $NoVisu, "", "");
								break;
						}
						break;
				}
				break;
		}
	}
	?>
</body>

</html>