<?php
include("../include/session.php");
if( !$session->isAdmin()){
	//header("Location: ../Store/storeMenu.php");?>
<script language="javascript" type="text/javascript">
        <!--
		  window.location="denied.php";
        -->
       </script>
<?php 
}else{
	
	include("../storeHeader.php");
	
	
	
	$s = $_GET['s'];
	$p = $_GET['p'];
	$_SESSION['p']=$p;
	$_SESSION['s']=$s;
	
	
	if (isset($_GET['prev_button']) )
	   {
		 $_SESSION['p']= $_SESSION['p']-1;
	   }
		 
	if (isset($_GET['next_button']) )
	  {
		$_SESSION['p']=$_SESSION['p']+1;
	  }
	
		
	
	if ($s==1) {
		$_SESSION['reg_no'] = $_GET['reg_no_text'];
	};
	
	if($s==2) {
	 $_SESSION['VehicleMake'] = $_GET['vehicleMake_select'];
	 $_SESSION['VehicleModel'] = $_GET['vehicleModel_select'];
	 $_SESSION['year'] = $_GET['year_select'];
	 $_SESSION['chassis_no'] = $_GET['chassis_no_text'];
	 $_SESSION['fuel'] = $_GET['fuelSelect'];
	};
	
	if($s==3) {
	 $_SESSION['CompanyNo'] = $_GET['companySelect'];	
	
	 $companyQuery = "SELECT  name FROM rad_tocotex  WHERE account_no = ".$_SESSION['CompanyNo'];
	 $companyResult = execsql($companyQuery);
	 $_SESSION['CompanyName'] = mysql_result($companyResult, 0, "name");
		
	 $_SESSION['DriverNo'] = $_GET['driverSelect'];
	 
	 $driverQuery = "SELECT  first_name, last_name FROM rad_representatives  WHERE repId = ".$_SESSION['DriverNo'];
	 $driverResult = execsql($driverQuery);
	 $_SESSION['DriverName'] = mysql_result($driverResult, 0, "first_name")." ".mysql_result($driverResult, 0, "last_name");
	 
	 $_SESSION['PurchaseDate'] = $_GET['PurchaseDate'];
	 $_SESSION['License'] = $_GET['licenseSelect'];
	 $_SESSION['Notes'] = $_GET['notesText'];

	};
	
	if($s==4) {
	 $_SESSION['RemarksText'] = $_GET['RemarksText'];
	}
	
	?>
<script language="JavaScript" src="gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<!--form validation-->
<script type="text/javascript" src="../css/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="../css/wizard.css" />
<script language="javascript" type="text/javascript" >
<!--
function confirmRefresh() {
var okToRefresh = confirm("Do you really want to cancel this entry?");
var url='specificNewEntry.php'
if (okToRefresh)
	{
			window.location=url;
	}
}
// -->
</script>
<script language="JavaScript">
  var needToConfirm = true;
  window.onbeforeunload = confirmExit;
  function confirmExit()
  {
    if (needToConfirm)
      return "You did not finish the wizard.\nIf you leave now your data will not be saved.";
  }
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
</script>
<table id="tableMain" width="595">
  <!--begin of tableMain-->
  <tr>
    <td ><div class="headerbox2">New Vehicle</div>
      <br />
      <p class="stepbar">
        <?php if ($_SESSION['p']==1) { echo "<label class=step>"; }  else { echo"<label class=stepd>"; } ?>
        Step 1<br />
        <font size="1">Registration</font>
        </label>
        <?php if ($_SESSION['p']==2) { echo "<label class=step>"; }  else { echo"<label class=stepd>"; } ?>
        Step 2<br />
        <font size="1">Vehicle details</font>
        </label>
        <?php if ($_SESSION['p']==3) { echo "<label class=step>"; }  else { echo"<label class=stepd>"; } ?>
        Step 3<br />
        <font size="1">Company details</font>
        </label>
        <?php if ($_SESSION['p']==4) { echo "<label class=step>"; }  else { echo"<label class=stepd>"; } ?>
        Step 4<br />
        <font size="1">Finish</font>
        </label>
       
        <label class="steptext">
          <?php if ($_SESSION['p']==1) { echo "Registration number."; } else { echo "Details for vehicle with registration number:&nbsp;&nbsp;&nbsp;&nbsp; ".$_SESSION['reg_no']; } ?>
        </label>
      </p>
      <br /></td>
    <!--center of tableMain-->
  </tr>
  <tr>
    <td><!--center of tableMain-->
      <?php 
	if ($_SESSION['p']==1) { include("vehicleWiz1.php"); }
	if ($_SESSION['p']==2) { include("vehicleWiz2.php"); }
	if ($_SESSION['p']==3) { include("vehicleWiz3.php"); }
	if ($_SESSION['p']==4) { include("vehicleWiz4.php"); }
	if ($_SESSION['p']==5) { include("vehicleWiz5.php"); }
    ?></td>
  </tr>
</table>
<?php

	}
	include("../footer.php");

?>
