<?php echo $header; ?>
<div id="content">
  <div class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?> 
  </div>
  <?php if ($error_warning) { ?>
  <div class="warning"><?php echo $error_warning; ?></div>
  <?php } ?>
  <div class="box">
    <div class="heading">
      <h1><img src="view/image/customer.png" alt="" /> <?php echo $heading_title; ?></h1>
      <div class="buttons"><a onclick="$('#form').submit();" class="button"><?php echo $button_save; ?></a>
	  <a onclick="location = '<?php echo $ExcelUpdate; ?>';" class="button">Update all Products</a> 
	  <a onclick="location = '<?php echo $cancel; ?>';" class="button"><?php echo $button_cancel; ?></a>
	 </div>
    </div>
    <div class="content">
      <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form">
        <table class="form">
          <tr>
            <td><span class="required">*</span> <?php echo $entry_name; ?></td>
            <td><input type="text" name="metal_code" value="<?php echo $metal_code; ?>" />
              <?php if ($error_metal_code) { ?>
              <span class="error"><?php echo $error_metal_code; ?></span>
              <?php  } ?></td>
          </tr>
		    <tr>
            <td><span class="required">*</span> <?php echo $entry_metalname; ?></td>
            <td><input type="text" name="metalname" value="<?php echo $metalname; ?>" />
              <?php if ($error_metalname) { ?>
              <span class="error"><?php echo $error_metalname; ?></span>
              <?php  } ?></td>
          </tr>
		  <tr>
            <td><?php echo $entry_image; ?></td>
            <td valign="top"><div class="image"><img src="<?php echo $thumb; ?>" alt="" id="thumb" />
                <input type="hidden" name="image" value="<?php echo $image; ?>" id="image" />
                <br /><a onclick="image_upload('image', 'thumb');"><?php echo $text_browse; ?></a>&nbsp;&nbsp;|&nbsp;&nbsp;<a onclick="$('#thumb').attr('src', '<?php echo $no_image; ?>'); $('#image').attr('value', '');"><?php echo $text_clear; ?></a></div>
              <?php if ($error_image) { ?>
              <span class="error"><?php echo $error_image; ?></span>
              <?php } ?></td>
          </tr>
		  
		  
          <tr>
            <td><span class="required">*</span> <?php echo $entry_description; ?></td>
            <td><textarea name="description" cols="40" rows="5"><?php echo $description; ?></textarea>
              <?php if ($error_description) { ?>
              <span class="error"><?php echo $error_description; ?></span>
              <?php  } ?></td>
          </tr>
          <tr>
            <td><span class="required">*</span> <?php echo 'Silver Ratio'; ?></td>
            <td><input type="text" name="silver_ratio" value="<?php echo $silver_ratio; ?>" />
              <?php if ($error_silver_ratio) { ?>
              <span class="error"><?php echo $error_silver_ratio; ?></span>
              <?php  } ?></td>
          </tr>
          <tr>
            <td><span class="required">*</span> <?php echo $entry_pricepergram; ?></td>
            <td><input type="text" name="pricepergram" value="<?php echo $pricepergram; ?>" />
              <?php if ($error_pricepergram) { ?>
              <span class="error"><?php echo $error_pricepergram; ?></span>
              <?php  } ?></td>
          </tr>
           <tr>
            <td><span class="required">*</span> <?php echo $entry_sort_order; ?></td>
            <td><input type="text" name="sort_order" value="<?php echo $sort_order; ?>" />
             </td>
          </tr>
         <input type="hidden" name="priceperounce" value="0" />

          <!--
          <tr>
            <td><span class="required">*</span> <?php echo $entry_priceperounce; ?></td>
            <td><input type="text" name="priceperounce" value="<?php echo $priceperounce; ?>" />
              <?php if ($error_priceperounce) { ?>
              <span class="error"><?php echo $error_priceperounce; ?></span>
              <?php  } ?></td>
          </tr>
          -->
		    <tr>
              <td><?php echo $entry_currency; ?></td>
              <td><select name="ccurrency">
                  <?php foreach ($currencies as $currency) { ?>
                  <?php if ($currency['code'] == $ccurrency) { ?>
                  <option value="<?php echo $currency['code']; ?>" selected="selected"><?php echo $currency['title']; ?></option>
                  <?php } else { ?>
                  <option value="<?php echo $currency['code']; ?>"><?php echo $currency['title']; ?></option>
                  <?php } ?>
                  <?php } ?>
                </select></td>
            </tr>
        </table>
      </form>
    </div>
  </div>
</div>
<script type="text/javascript"><!--
function image_upload(field, thumb) {
	$('#dialog').remove();
	
	$('#content').prepend('<div id="dialog" style="padding: 3px 0px 0px 0px;"><iframe src="index.php?route=common/filemanager&token=<?php echo $token; ?>&field=' + encodeURIComponent(field) + '" style="padding:0; margin: 0; display: block; width: 100%; height: 100%;" frameborder="no" scrolling="auto"></iframe></div>');
	
	$('#dialog').dialog({
		title: '<?php echo $text_image_manager; ?>',
		close: function (event, ui) {
			if ($('#' + field).attr('value')) {
				$.ajax({
					url: 'index.php?route=common/filemanager/image&token=<?php echo $token; ?>&image=' + encodeURIComponent($('#' + field).attr('value')),
					dataType: 'text',
					success: function(text) {
						$('#' + thumb).replaceWith('<img src="' + text + '" alt="" id="' + thumb + '" />');
					}
				});
			}
		},	
		bgiframe: false,
		width: 800,
		height: 400,
		resizable: false,
		modal: false
	});
};
//--></script> 
<?php echo $footer; ?>