<link rel="stylesheet" type="text/css" href="../css/jquery.autocomplete.css" />
<script type="text/javascript" src="../css/jquery.1.4.2.js"></script>
<script type="text/javascript" src="../css/jquery.autocomplete.js"></script>
<link rel="stylesheet" type="text/css" href="../css/wizard.css" />

<script>
function confirmRefresh() {
var okToRefresh = confirm("Do you really want to cancel this entry?");
var url='showAllProducts.php?cat=Tiles and Accessories&productSelect=All&colorSelect=All'
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>

<?php
//country select box
$country = file('../include/products_name.txt');
$options2 = '';
foreach ($country as $country) {
    $options2 .= '<option value="'.$country.'">'.$country.'</option>';
}
$country_select = '<select name="productName_text" class="wizard3" >
                       <option value="'.$_SESSION['productName'].'" selected="selected" >'. $_SESSION['productName'].'</option>'
					   .$options2.'</select>'; 


?>

<form id="form1" name="form1" method="get" action="storeWizbase.php">
  <table width=595 border="0" align="center" cellpadding="10" cellspacing="0" bordercolor="#0066FF" border-collapse="collapse">
    <tr>
      <td width="525" ><?php if ($_SESSION['error']==1) { ?>
        <p class="wizard2"> <img src="../img/icon-error.png" width="30" height="30" />&nbsp;&nbsp;&nbsp;&nbsp;
          <label class="std">A product / store item with the name "<?php echo $_SESSION['productName'].' '.$_SESSION['color'] ?>" allready exists, please use another name.</label>
        </p>
        <?php 
	 $_SESSION['productName'] ="";
     $_SESSION['suppliersName'] = "";
	 $_SESSION['color'] = "";
	 $_SESSION['subCategory'] = "";
	 $_SESSION['shelf'] = "";
	 $_SESSION['unit'] = "";
	 $_SESSION['returnable'] = "";
	 $_SESSION['quantity'] = "";
	 $_SESSION['minimumStock'] = "";
	 $_SESSION['price'] = "";
	 
	 $_SESSION['depreciation'] = "";
	 $_SESSION['date'] = "";
	 $_SESSION['productSpecs'] = "";
	 $_SESSION['p'] = 1;
	 $_SESSION['error']=0;
	 //$_SESSION['changed']="";
	 //$_SESSION['changed2']="";
	 
	 
	 } ?>
        <p class="wizard">
          <label class="left2">What is the name of the product / store item?</label>
          <br />
          <?php if ($_SESSION['category'] == "Tiles and Accessories"){ ?>
          <select name="productName_text" class="wizard3">
            <option value="DOUBLE ROMAN">DOUBLE ROMAN</option>
            <option value="MONO RIDGE">MONO RIDGE</option>
            <option value="RAKE VERGE">RAKE VERGE</option>
            <option value="SLATE">SLATE</option>
            <option value="TAPERED HIP STARTER">TAPERED HIP STARTER</option>
            <option value="TAPERED RIDGE">TAPERED RIDGE</option>
            <option value="V HIP STARTER">V HIP STARTER</option>
            <option value="V RIDGE">V RIDGE</option>
            <option value="VENETIAN">VENETIAN</option>
            <option value="<?php echo $_SESSION['productName'] ?>" selected="selected"><?php echo $_SESSION['productName'] ?></option>
          </select>
		  <?php }
		  else {?>
	      <input name="productName_text" type="text" id="productName_text" class="wizard0" <?php if ($_SESSION['category'] == "Tiles and Accessories"){ ?> onkeyup="ToUpper(this)"  <?php } else { ?>  onblur="capitalize(this)" <?php } ?> value="<?php echo $_SESSION['productName'] ?>"  />
	      <label class="star">*</label><?php } ?>
            <br /><br />

<?php if ($_SESSION['category'] == "Tiles and Accessories"){ ?>
<label class="left2">Colour and finish:</label>
<input name="color_text" type="text" id="color_text" class="wizard0" onkeyup="ToLower(this)" value="<?php echo $_SESSION['color'] ?>" />
  <label class="star">*</label>
   <br />
   <?php } ?>

          <input name="error" type="hidden" id="error" value="0" />
          <input name="p" type="hidden" id="p" value="2" />
          <input name="s" type="hidden" id="s" value="2" />
        </p></td>
    </tr>
    <tr>
      <td><table width="590" height="50" align="center" id="tableButtonBar">
          <tr>
            <td width="117"><input type="submit" name="prev_button" id="prev_button" class="imagebutton" value="Prev" onclick=" needToConfirm = false; " /></td>
            <td width="115">&nbsp;</td>
            <td width="99">&nbsp;</td>
            <td width="125" align="left"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onclick="needToConfirm = false; confirmRefresh();" value="Cancel" /></td>
            <td width="110" align="left"><input type="submit" name="next_button" class="imagebutton" value="Next" onclick="validate(); needToConfirm = false; " /></td>
          </tr>
        </table></td>
    </tr>
  </table>
</form>
<!--form validation-->
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("form1");
  frmvalidator.EnableMsgsTogether();
  
  function validate() {
  frmvalidator.addValidation("productName_text","req","Please enter a product name.");
  <?php if ($_SESSION['category'] == "Tiles and Accessories"){ ?>
  frmvalidator.addValidation("color_text","req","Please enter a color and finish.");
  <?php } ?>
  }
  </script>
