<head>
<?php
		
	$table_name = $_SESSION['db_prefix']."_suppliers";
	$check_query = "SELECT account_name FROM $table_name WHERE account_name = '". $_SESSION['account_name']."'" ;
	
	$check_result = mySQL_query($check_query) or die ("Error in query:   $check_query . * ". mySQL_error());
	$check_num = mysql_num_rows($check_result);
	if ($check_num!=0) { 
	$_SESSION['error']=1;
	$_SESSION['p']=1;
	
	
	?>
    
    <script language="javascript" type="text/javascript">
        <!--
		needToConfirm = false;
	 window.location="supplierWizbase.php?s=0&p=1";
        -->
     </script>
	
	?>
<?php	
       }
    else{

$table_name = $_SESSION['db_prefix']."_list_places";

    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId2 = array ();
	$arrName2 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
		$arrId2[$b] = mysql_result($position_result, $b, "item_name");
		$arrName2[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
	}
	}
	
	$table_name = $_SESSION['db_prefix']."_list_country";
    $position_query = "SELECT item_name FROM $table_name ORDER BY item_name ASC";
	$arrId1 = array ();
	$arrName1 = array ();
	$position_result = execsql($position_query);
	if ($position_result!="") {
	$position_num = mysql_num_rows($position_result);
	$b = 0;
	while ($b < $position_num) {
		$arrId1[$b] = mysql_result($position_result, $b, "item_name");
		$arrName1[$b] = mysql_result($position_result, $b, "item_name");
		$b++;
	}
	}

?>
<!--jscript-->
<script language="JavaScript" src="../jscript/gen_validatorv4.js"  type="text/javascript" xml:space="preserve"></script>
<script language="JavaScript" src="../jscript/upper_case.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/lower_case.js"  type="text/javascript"></script>
<script language="JavaScript" src="../jscript/capitalize_textbox.js"  type="text/javascript"></script>  


</head>
<?php include('../include/wait.php') ?>
<body onLoad="MM_showHideLayers('wait','','hide')" onFocus="MM_showHideLayers('wait','','hide');"  onBlur="MM_showHideLayers('wait','','hide');">
<div class="page_middle_frame">
<form id="feedbackform" method="get" action="supplierWizbase.php">
  <table id="tableMain" width="595">
    <!--begin of tableMain-->
    <tr>
      <td><!--center of tableMain-->
        
        <table width=595 border="0" align="center" cellpadding="10" cellspacing="0" bordercolor="#0066FF" border-collapse="collapse">
          <tr>
            <td width="525" height="275" valign="top" ><div class="wizard_frame">
                <label class="label_std">Is this a 'credit' or 'cash' account?</label>
                &nbsp;
                <label class="star">*</label>
                &nbsp;&nbsp;&nbsp;
                <label class="label_std">
                  <input type="radio" name="cash_credit_group" value="credit" id="cash_credit_group_0" <?php if ($_SESSION['credit_cash']=="credit") { echo "checked='checked' " ;} ?> autofocus tabindex="1"/>
                  credit</label>
                <label class="label_std">
                  <input type="radio" name="cash_credit_group" value="cash" id="cash_credit_group_1"  <?php if ($_SESSION['credit_cash']=="cash") { echo "checked='checked' " ;} ?>/>
                  cash</label>
              </div>
              <br />
              <br />
              <div class="wizard_frame">
                <label class="label_std">Postal address:</label>
                <select name="AddressText1" class="select80" id="box" tabindex="2">
                  <option value="PO Box">PO Box</option>
                  <option value="P Bag">P Bag</option>
                  <option selected="selected"><?php echo $_SESSION['AddressText1'] ?></option>
                </select>
                <input name="AddressText2" type="text" class="text100" id="postal address" onKeyUp="ToUpper(this)" value="<?php echo $_SESSION['AddressText2'] ?>" tabindex="3"/>
                <label class="star">*</label>
                <label class="label_std">&nbsp;&nbsp;&nbsp;Place:&nbsp;&nbsp;&nbsp;</label>
                <span class="right">
                <select name="PlaceText" class="select120" tabindex="4" >
                  <option value="<?php echo $_SESSION['PlaceText'] ?>" selected="selected" tabindex="4"><?php echo $_SESSION['PlaceText'] ?></option>
                  <?php
        	for ($j = 0; $j < count($arrId2); $j++) {
    		echo "<option value=" . "\"" . $arrId2[$j] . "\"" . ">" . $arrName2[$j] . "</option>";
	}
?>
                </select>
                </span>
                <label class="star">*</label>
                <br />
              </div>
              <br />
              <br />
              <div class="wizard_frame">
                <label class="label_std">Physical address:</label>
                <input name="AddressText3" type="text" class="text150" id="physical address"  onblur="capitalize(this)" onKeyUp="ToLower(this)" value="<?php echo $_SESSION['AddressText3'] ?>" tabindex="5"/>
                <label class="label_std">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Place:&nbsp;&nbsp;&nbsp;</label>
                <span class="right">
                <select name="PlaceText2" class="select120" tabindex="6" >
                  <option value="<?php echo $_SESSION['PlaceText2'] ?>" selected="selected"><?php echo $_SESSION['PlaceText2'] ?></option>
                  <?php
        	for ($j = 0; $j < count($arrId2); $j++) {
    		echo "<option value=" . "\"" . $arrId2[$j] . "\"" . ">" . $arrName2[$j] . "</option>";
	}
?>
                </select>
                </span><br />
                <br />
                <label class="label_std">Country:</label>
                <select name="CountryText" class="select160" tabindex="7" >
                  <option value="<?php echo $_SESSION['CountryText'] ?>" selected="selected"><?php echo $_SESSION['CountryText'] ?></option>
                  <?php
        	for ($j = 0; $j < count($arrId1); $j++) {
    		echo "<option value=" . "\"" . $arrId1[$j] . "\"" . ">" . $arrName1[$j] . "</option>";
	}
?>
                </select>
                <label class="star">*</label>
                <input name="p" type="hidden" id="p" value="2" />
                <input name="s" type="hidden" id="s" value="2" />
              </div></td>
            <!--center of tableMain--> 
          </tr>
          <tr>
            <td><!--center of tableMain-->
              
              <table width="590" height="50" align="center" id="table_button_bar">
                <tr>
                  <td width="117"><input type="button" name="lastprev_button" class="imagebutton" value="Prev" onClick="needToConfirm = false;MM_goToURL('parent','supplierWizbase.php?s=&amp;p=1');return document.MM_returnValue;MM_showHideLayers('wait','','show');return document.MM_returnValue" tabindex="9"/></td>
                  <td width="115">&nbsp;</td>
                  <td width="99">&nbsp;</td>
                  <td width="125"><input name="cancelbutton" type="button" class="imagebutton" id="cancelbutton" onClick="needToConfirm = false; cancel_confirmation(1, '../store/store_main.php?date=0&branch=&subCatSelect=Tiles');" value="Cancel" tabindex="10"/></td>
                  <td width="110" align="left"><input type="submit" name="next_button" class="imagebutton" value="Next" onClick="needToConfirm = false; MM_showHideLayers('wait','','show');" tabindex="8"/></td>
                </tr>
              </table></td>
          </tr>
        </table>
  </table>
  <!--end of tableMain-->
</form>
</div>
<!--form validation--> 
<script language="JavaScript" type="text/javascript" xml:space="preserve">
  var frmvalidator  = new Validator("feedbackform");
  frmvalidator.EnableMsgsTogether();
  frmvalidator.addValidation("AddressText1","req","Please select box or bag.");
  frmvalidator.addValidation("AddressText2","req","Please enter a box or bag number.");
  frmvalidator.addValidation("PlaceText","req","Please select a city.");
  frmvalidator.addValidation("CountryText","req","Please select a country.");
  frmvalidator.addValidation("cash_credit_group","selone","Please select credit or cash.");
  </script>
<?php
	}
	?>
