{*

*	Module Name: Surface (Area) / Volume Calculator for Prestashop 1.5

*	Module URI: Please contact with info@megventure.com

*	Description: A utility to calculate quantity in area or volume units

*	Version: 1.0

*	Author: MEG Venture

*

*	Copyright 2013, MEG Venture (info@megventure.com)

*

*	This program is not a free software: you can't redistribute it and/or modify

*	it. All rights reserved.

*

*

*	This copyright notice  and licence should be retained in all modules based on this framework.

*	This does not affect your rights to assert copyright over your own original work.

*}



<!-- Square Meter Calculation Module -->

<input type="hidden" name="submitted_tabs[]" value="squaremeteradmin" />

	<h4>{l s='Surface (Area) / Volume Calculation Module' mod='squaremeter'}</h4>

	<div class="separation"></div>

	<fieldset style="border:none;">

      <table>

		<tr>

		<td class="col-left">

			<label>{l s='Display Applet:' mod='squaremeter'}</label>

		</td>	

        {if isset($admintab_display)}	

		<td style="padding-bottom:5px;">

			<select name="squaremeter_display" id="squaremeter_display">

            	<option value="" {if $admintab_display == ''}selected="selected"{/if} >{l s='Please choose' mod='squaremeter'}</option>

				<option value="yes" {if $admintab_display == 'yes'}selected="selected"{/if} >{l s='Enabled' mod='squaremeter'}</option>

				<option value="no" {if $admintab_display == 'no'}selected="selected"{/if} >{l s='Disabled' mod='squaremeter'}</option>

			</select>

		</td>

        {else}

		<td style="padding-bottom:5px;">

			<select name="squaremeter_display" id="squaremeter_display">

            	<option value="">{l s='Please choose' mod='squaremeter'}</option>

				<option value="yes">{l s='Enabled' mod='squaremeter'}</option>

				<option value="no">{l s='Disabled' mod='squaremeter'}</option>

			</select>

		</td>

        {/if}

		</tr>    

        <tr>

        <td colspan="2">

        <br />

        {l s='If you enable this option, the square meter calculation applet will be displayed in the product page above the quantity field. This will provide your visitors the opportunity to enter width and heigth to calculate the square meter value automatically. All decimal values are rounded up.' mod='squaremeter'}

        </td>

        </tr>

      </table>  

          </fieldset> 

	<div class="separation"></div>

	<fieldset style="border:none;">

      <table>

		<tr>

		<td class="col-left">

			<label>{l s='Calculation Applet Type:' mod='squaremeter'}</label>

		</td>	

        {if isset($admintab_type)}	

		<td style="padding-bottom:5px;">

			<select name="calculation_type" id="calculation_type" onchange="checktest3()">

            	<option value="" {if $admintab_type == ''}selected="selected"{/if} >{l s='Please choose' mod='squaremeter'}</option>

				<option value="surface" {if $admintab_type == 'surface'}selected="selected"{/if} >{l s='Surface' mod='squaremeter'}</option>

				<option value="volume" {if $admintab_type == 'volume'}selected="selected"{/if} >{l s='Volume' mod='squaremeter'}</option>

			</select>

		</td>

        {else}

		<td style="padding-bottom:5px;">

			<select name="calculation_type" id="calculation_type" onchange="checktest3()">

            	<option value="">{l s='Please choose' mod='squaremeter'}</option>

				<option value="surface">{l s='Surface' mod='squaremeter'}</option>

				<option value="volume">{l s='Volume' mod='squaremeter'}</option>

			</select>

		</td>

        {/if}

		</tr>    

        <tr>

        <td colspan="2">

        <br />

        {l s='The calculation applet is changed according to the calculation type selected. If surface is chosen, an applet with two fields, width and height, is displayed. If volume is chosen an applet with three fields, width, depth and height, is displayed. Calculations change accordingly.' mod='squaremeter'}

        </td>

        </tr>

      </table>  

            <p style="color:red;" id="errort3_"></p> 

            <p style="color:red;" id="errort4_"></p>  

          </fieldset> 

<div class="separation"></div> 
  
	<fieldset style="border:none;">

      <table>

		<tr>

		<td class="col-left">

			<label>{l s='Piece information field:' mod='squaremeter'}</label>

		</td>	

        {if isset($admintab_addquan)}	

		<td style="padding-bottom:5px;">

			<select name="additional_quantity" id="additional_quantity">

            	<option value="" {if $admintab_addquan == ''}selected="selected"{/if} >{l s='Please choose' mod='squaremeter'}</option>

				<option value="yes" {if $admintab_addquan == 'yes'}selected="selected"{/if} >{l s='Enabled' mod='squaremeter'}</option>

				<option value="no" {if $admintab_addquan == 'no'}selected="selected"{/if} >{l s='Disabled' mod='squaremeter'}</option>

			</select>

		</td>

        {else}

		<td style="padding-bottom:5px;">

			<select name="additional_quantity" id="additional_quantity">

            	<option value="">{l s='Please choose' mod='squaremeter'}</option>

				<option value="yes">{l s='Enabled' mod='squaremeter'}</option>

				<option value="no">{l s='Disabled' mod='squaremeter'}</option>

			</select>

		</td>

        {/if}

		</tr>    

        <tr>

        <td colspan="2">

        <br />

        {l s='Enable this feature if you want your customer state the number of the smaller pieces. For example, it can be used for label issuing. Customer may want 1000 labels, width of 5 m and height of 5 m. That makes 1000 x 5 x 5 = 25000 squaremeter. Then if you determine the prices per squaremeter, price is calculated accordingly. ' mod='squaremeter'}

        </td>

        </tr>

      </table>  

          </fieldset> 
          
<div class="separation"></div> 
  
	<fieldset style="border:none;">

      <table>

		<tr>

		<td class="col-left">

			<label>{l s='Order Quantity Display Options:' mod='squaremeter'}</label>

		</td>	

        {if isset($admintab_dispquan)}	

		<td style="padding-bottom:5px;">

			<select name="display_quantity" id="display_quantity">

            	<option value="" {if $admintab_dispquan == ''}selected="selected"{/if} >{l s='Please choose' mod='squaremeter'}</option>

				<option value="onevisible" {if $admintab_dispquan == 'onevisible'}selected="selected"{/if} >{l s='Always 1 and visible' mod='squaremeter'}</option>

				<option value="oneinvisible" {if $admintab_dispquan == 'oneinvisible'}selected="selected"{/if} >{l s='Always 1 and invisible' mod='squaremeter'}</option>

				<option value="calcvisible" {if $admintab_dispquan == 'calcvisible'}selected="selected"{/if} >{l s='Calculated and visible' mod='squaremeter'}</option>  

				<option value="calcinvisible" {if $admintab_dispquan == 'calcinvisible'}selected="selected"{/if} >{l s='Calculated and invisible' mod='squaremeter'}</option>                                

			</select>

		</td>

        {else}

		<td style="padding-bottom:5px;">

			<select name="display_quantity" id="display_quantity">

            	<option value="">{l s='Please choose' mod='squaremeter'}</option>

				<option value="onevisible">{l s='Always 1 and visible' mod='squaremeter'}</option>

				<option value="oneinvisible">{l s='Always 1 and invisible' mod='squaremeter'}</option>

				<option value="calcvisible">{l s='Calculated and visible' mod='squaremeter'}</option>

				<option value="calcinvisible">{l s='Calculated and invisible' mod='squaremeter'}</option>                

			</select>

		</td>

        {/if}

		</tr>    

        <tr>

        <td colspan="2">

        <br />

        {l s='This option is about the native order quantity input box of Prestashop. When you use the applet, the order quantity is disabled to be change by the customer and either calculated by the applet or be forced to be always 1. So here are your 4 different options: 1) You can force it equal always to 1 and be visible; 2) always equal to 1 and be invisible; 3) calculated according to the conversion rate and be visible; 4)calculated according to the conversion rate and be invisible.' mod='squaremeter'}

        </td>

        </tr>

      </table>  

          </fieldset>          

<div class="separation"></div>  
	<fieldset style="border:none;">

      <table>

		<tr>

		<td class="col-left">

			<label>{l s='Total Price Display Options:' mod='squaremeter'}</label>

		</td>	

        {if isset($admintab_dispprice)}	

		<td style="padding-bottom:5px;">

			<select name="display_price" id="display_price">

            	<option value="" {if $admintab_dispprice == ''}selected="selected"{/if} >{l s='Please choose' mod='squaremeter'}</option>

				<option value="pricebutton" {if $admintab_dispprice == 'pricebutton'}selected="selected"{/if} >{l s='Native price is visible and total price with button click' mod='squaremeter'}</option>

				<option value="nopricebutton" {if $admintab_dispprice == 'nopricebutton'}selected="selected"{/if} >{l s='Native price is hidden and total price with button click' mod='squaremeter'}</option>

				<option value="pricetotalprice" {if $admintab_dispprice == 'pricetotalprice'}selected="selected"{/if} >{l s='Native price and total price are always visible' mod='squaremeter'}</option>  

				<option value="nopricetotalprice" {if $admintab_dispprice == 'nopricetotalprice'}selected="selected"{/if} >{l s='Native price is hidden and total price is always visible' mod='squaremeter'}</option>          
                
				<option value="pricenototalprice" {if $admintab_dispprice == 'pricenototalprice'}selected="selected"{/if} >{l s='(Normal) Native price is visible and no total price' mod='squaremeter'}</option>                                        

			</select>

		</td>

        {else}

		<td style="padding-bottom:5px;">

			<select name="display_price" id="display_price">

            	<option value="">{l s='Please choose' mod='squaremeter'}</option>

				<option value="pricebutton">{l s='Native price is visible and total price with button click' mod='squaremeter'}</option>
				<option value="nopricebutton">{l s='Native price is hidden and total price with button click' mod='squaremeter'}</option>
				<option value="pricetotalprice">{l s='Native price and total price are always visible' mod='squaremeter'}</option>
				<option value="nopricetotalprice">{l s='Native price is hidden and total price is always visible' mod='squaremeter'}</option>                
				<option value="pricenototalprice">{l s='(Normal) Native price is visible and no total price' mod='squaremeter'}</option>     
			</select>

		</td>

        {/if}

		</tr>    

        <tr>

        <td colspan="2">

        <br />

        {l s='This option is about the native price information of Prestashop. When we enable our calculator, order quantity is calculated according to the dimensions set by the customer (if we don\'t force the quantity always be 1). So the customer sees the total price in cart as the order quantity x native price per quantity. However, with selected features below we have other options: 1) Adds an information button above the Add to Cart button and whenever customer clicks on it, the total price information is updated according to the order quantity times native price calculation; 2) Same as item 1, but this time other native price  information is hidden; 3) No button is added, the native price and calculated total price (excluding tax and shipping) are always visible and updated automatically; 4) Same as item 3, but native price is hidden; 5) Native price is hidden and no total price information in any way.' mod='squaremeter'}

        </td>

        </tr>

      </table>  

          </fieldset>          

<div class="separation"></div>  

	<fieldset style="border:none;">   

      <table>

		<tr>

		<td class="col-left">

			<label>{l s='1 piece (quantity) equals to:' mod='squaremeter'}</label>

		</td>		

		<td style="padding-bottom:5px;">

			<input type="text" name="conversion" id="conversion" size="10" value="{if isset($admintab_conversion)}{$admintab_conversion}{/if}" onchange="checktest()"  />

			{if isset($admintab_conversion_unit)}	

            <select style="height:22px;" name="conversion_unit" id="conversion_unit"  onchange="checktest3()">

            	<option value="" {if $admintab_conversion_unit == ''}selected="selected"{/if} >{l s='Please choose' mod='squaremeter'}</option>

				<option value="mm2" {if $admintab_conversion_unit == 'mm2'}selected="selected"{/if} >{l s='mm2' mod='squaremeter'}</option>

				<option value="cm2" {if $admintab_conversion_unit == 'cm2'}selected="selected"{/if} >{l s='cm2' mod='squaremeter'}</option>

				<option value="dm2" {if $admintab_conversion_unit == 'dm2'}selected="selected"{/if} >{l s='dm2' mod='squaremeter'}</option>                

				<option value="m2" {if $admintab_conversion_unit == 'm2'}selected="selected"{/if} >{l s='m2' mod='squaremeter'}</option>      

				<option value="mm3" {if $admintab_conversion_unit == 'mm3'}selected="selected"{/if} >{l s='mm3' mod='squaremeter'}</option>

				<option value="cm3" {if $admintab_conversion_unit == 'cm3'}selected="selected"{/if} >{l s='cm3' mod='squaremeter'}</option>

				<option value="dm3" {if $admintab_conversion_unit == 'dm3'}selected="selected"{/if} >{l s='dm3' mod='squaremeter'}</option>

				<option value="m3" {if $admintab_conversion_unit == 'm3'}selected="selected"{/if} >{l s='m3' mod='squaremeter'}</option>                             

			</select>

            {else}

            <select style="height:22px;" name="conversion_unit" id="conversion_unit" onchange="checktest3()">

            	<option value="">{l s='Please choose' mod='squaremeter'}</option>

				<option value="mm2" >{l s='mm2' mod='squaremeter'}</option>

				<option value="cm2">{l s='cm2' mod='squaremeter'}</option>

				<option value="dm2">{l s='dm2' mod='squaremeter'}</option>

				<option value="m2">{l s='m2' mod='squaremeter'}</option>   

				<option value="mm3" >{l s='mm3' mod='squaremeter'}</option>

				<option value="cm3">{l s='cm3' mod='squaremeter'}</option>

				<option value="dm3">{l s='dm3' mod='squaremeter'}</option>

				<option value="m3">{l s='m3' mod='squaremeter'}</option>                               

			</select>     

            {/if}       

		</td>

		</tr>   

        <tr>

        <td colspan="2">

        <br />

        {l s='Say that you have boards of 100 m2 (10mx10m)each. The calculator applet\'s product will be converted to the conversion rate you provided above. If you write 1 piece equals to 100 m2, the quantity field will change (increase/decrease) accordingly and automatically. To simply put, quantity will increase/decrease 1 ea on every 100 m2. Ex: Width 10 m. and Height 5 m., 10x5=50 m2, we round up to 100 and quantity field will be 1. Width 10 m. and Height 20 m., 10x20=200 m2, so the quantity will automatically be 2.' mod='squaremeter'}

        </td>

        </tr>

      </table>  



      <p style="color:red;" id="errort"></p> 

          </fieldset>

<div class="separation"></div>  

	<fieldset style="border:none;">   

      <table>

		<tr>

		<td class="col-left">

			<label>{l s='Min. Height Value (Ex: 1 unit):' mod='squaremeter'}</label>

		</td>		

		<td style="padding-bottom:5px;">

			<input type="text" name="minimum_height" id="minimum_height" size="10" value="{if isset($admintab_minheight)}{$admintab_minheight}{/if}" onchange="checktest()"  />  

   			{if isset($admintab_minheight_unit)}	          

            <select style="height:22px;" name="minimum_height_unit" id="minimum_height_unit" onchange="checktest2()">

            	<option value="" {if $admintab_minheight_unit == ''}selected="selected"{/if} >{l s='Please choose unit' mod='squaremeter'}</option>

				<option value="mm" {if $admintab_minheight_unit == 'mm'}selected="selected"{/if} >{l s='mm' mod='squaremeter'}</option>

				<option value="cm" {if $admintab_minheight_unit == 'cm'}selected="selected"{/if} >{l s='cm' mod='squaremeter'}</option>

				<option value="dm" {if $admintab_minheight_unit == 'dm'}selected="selected"{/if} >{l s='dm' mod='squaremeter'}</option>

				<option value="m" {if $admintab_minheight_unit == 'm'}selected="selected"{/if} >{l s='m' mod='squaremeter'}</option>                

			</select>

            {else}

            <select style="height:22px;" name="minimum_height_unit" id="minimum_height_unit" onchange="checktest2()">

            	<option value="">{l s='Please choose unit' mod='squaremeter'}</option>

				<option value="mm">{l s='mm' mod='squaremeter'}</option>

				<option value="cm">{l s='cm' mod='squaremeter'}</option>

				<option value="dm">{l s='dm' mod='squaremeter'}</option>

				<option value="m">{l s='m' mod='squaremeter'}</option>                

			</select>            

            {/if}

		</td>

		</tr>       

		<tr>

		<td class="col-left">

			<label>{l s='Max. Height Value (Ex: 20 unit):' mod='squaremeter'}</label>

		</td>		

		<td style="padding-bottom:5px;">

			<input type="text" name="maximum_height" id="maximum_height" size="10" value="{if isset($admintab_maxheight)}{$admintab_maxheight}{/if}" onchange="checktest()"  />

   			{if isset($admintab_maxheight_unit)}	            

            <select style="height:22px;" name="maximum_height_unit" id="maximum_height_unit" onchange="checktest2()">

            	<option value="" {if $admintab_maxheight_unit == ''}selected="selected"{/if} >{l s='Please choose unit' mod='squaremeter'}</option>

				<option value="mm" {if $admintab_maxheight_unit == 'mm'}selected="selected"{/if} >{l s='mm' mod='squaremeter'}</option>

				<option value="cm" {if $admintab_maxheight_unit == 'cm'}selected="selected"{/if} >{l s='cm' mod='squaremeter'}</option>
				<option value="dm" {if $admintab_maxheight_unit == 'dm'}selected="selected"{/if} >{l s='dm' mod='squaremeter'}</option>

				<option value="m" {if $admintab_maxheight_unit == 'm'}selected="selected"{/if} >{l s='m' mod='squaremeter'}</option>                

			</select>

            {else}

            <select style="height:22px;" name="maximum_height_unit" id="maximum_height_unit" onchange="checktest2()">

            	<option value="">{l s='Please choose unit' mod='squaremeter'}</option>

				<option value="mm">{l s='mm' mod='squaremeter'}</option>

				<option value="cm">{l s='cm' mod='squaremeter'}</option>

				<option value="dm">{l s='dm' mod='squaremeter'}</option>

				<option value="m">{l s='m' mod='squaremeter'}</option>                

			</select>            

            {/if}            

		</td>

		</tr>   

           

        <tr>

        <td colspan="2">

        <br />

        {l s='Customer will not be allowed to increase or decrease the applet\'s value above/below the limits.' mod='squaremeter'}

        </td>

        </tr>

      </table>            

      <p style="color:red;" id="errort1"></p> 

      <p style="color:red;" id="errort1_"></p>              

      </fieldset>

      

<div class="separation"></div>   

	<fieldset style="border:none;">   

      <table>

		<tr>

		<td class="col-left">

			<label>{l s='Min. Width Value (Ex: 1 unit):' mod='squaremeter'}</label>

		</td>		

		<td style="padding-bottom:5px;">

			<input type="text" name="minimum_width" id="minimum_width" size="10" value="{if isset($admintab_minwidth)}{$admintab_minwidth}{/if}" onchange="checktest()"  />

   			{if isset($admintab_minwidth_unit)}	                        

            <select style="height:22px;" name="minimum_width_unit" id="minimum_width_unit" onchange="checktest2()">

            	<option value="" {if $admintab_minwidth_unit == ''}selected="selected"{/if} >{l s='Please choose unit' mod='squaremeter'}</option>

				<option value="mm" {if $admintab_minwidth_unit == 'mm'}selected="selected"{/if} >{l s='mm' mod='squaremeter'}</option>

				<option value="cm" {if $admintab_minwidth_unit == 'cm'}selected="selected"{/if} >{l s='cm' mod='squaremeter'}</option>
				<option value="dm" {if $admintab_minwidth_unit == 'dm'}selected="selected"{/if} >{l s='dm' mod='squaremeter'}</option>

				<option value="m" {if $admintab_minwidth_unit == 'm'}selected="selected"{/if} >{l s='m' mod='squaremeter'}</option>                

			</select>    

            {else}

            <select style="height:22px;" name="minimum_width_unit" id="minimum_width_unit" onchange="checktest2()">

            	<option value="">{l s='Please choose unit' mod='squaremeter'}</option>

				<option value="mm">{l s='mm' mod='squaremeter'}</option>

				<option value="cm">{l s='cm' mod='squaremeter'}</option>

				<option value="dm">{l s='dm' mod='squaremeter'}</option>

				<option value="m">{l s='m' mod='squaremeter'}</option>                

			</select>    

            {/if}         

		</td>

		</tr>       

		<tr>

		<td class="col-left">

			<label>{l s='Max. Width Value (Ex: 20 unit):' mod='squaremeter'}</label>

		</td>		

		<td style="padding-bottom:5px;">

			<input type="text" name="maximum_width" id="maximum_width" size="10" value="{if isset($admintab_maxwidth)}{$admintab_maxwidth}{/if}" onchange="checktest()" />

   			{if isset($admintab_maxwidth_unit)}	                        

            <select style="height:22px;" name="maximum_width_unit" id="maximum_width_unit" onchange="checktest2()">

            	<option value="" {if $admintab_maxwidth_unit == ''}selected="selected"{/if} >{l s='Please choose unit' mod='squaremeter'}</option>

				<option value="mm" {if $admintab_maxwidth_unit == 'mm'}selected="selected"{/if} >{l s='mm' mod='squaremeter'}</option>

				<option value="cm" {if $admintab_maxwidth_unit == 'cm'}selected="selected"{/if} >{l s='cm' mod='squaremeter'}</option>
				
                <option value="dm" {if $admintab_maxwidth_unit == 'dm'}selected="selected"{/if} >{l s='dm' mod='squaremeter'}</option>

				<option value="m" {if $admintab_maxwidth_unit == 'm'}selected="selected"{/if} >{l s='m' mod='squaremeter'}</option>                

			</select> 

            {else}

            <select style="height:22px;" name="maximum_width_unit" id="maximum_width_unit" onchange="checktest2()">

            	<option value="">{l s='Please choose unit' mod='squaremeter'}</option>

				<option value="mm">{l s='mm' mod='squaremeter'}</option>

				<option value="cm">{l s='cm' mod='squaremeter'}</option>

				<option value="dm">{l s='dm' mod='squaremeter'}</option>

				<option value="m">{l s='m' mod='squaremeter'}</option>                

			</select> 

            {/if}            

		</td>

		</tr>   

           

        <tr>

        <td colspan="2">

        <br />

        {l s='Customer will not be allowed to increase or decrease the applet\'s value above/below the limits.' mod='squaremeter'}

        </td>

        </tr>

      </table>            

      <p style="color:red;" id="errort2"></p> 

      <p style="color:red;" id="errort2_"></p>                

    </fieldset>

<div class="separation"></div>  

	<fieldset style="border:none;">   

      <table>

		<tr>

		<td class="col-left">

			<label>{l s='Min. Depth Value (Ex: 1 unit):' mod='squaremeter'}</label>

		</td>		

		<td style="padding-bottom:5px;">

			<input type="text" name="minimum_depth" id="minimum_depth" size="10" value="{if isset($admintab_mindepth)}{$admintab_mindepth}{/if}" onchange="checktest()"  />  

   			{if isset($admintab_mindepth_unit)}	          

            <select style="height:22px;" name="minimum_depth_unit" id="minimum_depth_unit" onchange="checktest2()">

            	<option value="" {if $admintab_mindepth_unit == ''}selected="selected"{/if} >{l s='Please choose unit' mod='squaremeter'}</option>

				<option value="mm" {if $admintab_mindepth_unit == 'mm'}selected="selected"{/if} >{l s='mm' mod='squaremeter'}</option>

				<option value="cm" {if $admintab_mindepth_unit == 'cm'}selected="selected"{/if} >{l s='cm' mod='squaremeter'}</option>

				<option value="dm" {if $admintab_mindepth_unit == 'dm'}selected="selected"{/if} >{l s='dm' mod='squaremeter'}</option>

				<option value="m" {if $admintab_mindepth_unit == 'm'}selected="selected"{/if} >{l s='m' mod='squaremeter'}</option>                

			</select>

            {else}

            <select style="height:22px;" name="minimum_depth_unit" id="minimum_depth_unit" onchange="checktest2()">

            	<option value="">{l s='Please choose unit' mod='squaremeter'}</option>

				<option value="mm">{l s='mm' mod='squaremeter'}</option>

				<option value="cm">{l s='cm' mod='squaremeter'}</option>

				<option value="dm">{l s='dm' mod='squaremeter'}</option>

				<option value="m">{l s='m' mod='squaremeter'}</option>                

			</select>            

            {/if}

		</td>

		</tr>       

		<tr>

		<td class="col-left">

			<label>{l s='Max. Depth Value (Ex: 20 unit):' mod='squaremeter'}</label>

		</td>		

		<td style="padding-bottom:5px;">

			<input type="text" name="maximum_depth" id="maximum_depth" size="10" value="{if isset($admintab_maxdepth)}{$admintab_maxdepth}{/if}" onchange="checktest()"  />

   			{if isset($admintab_maxheight_unit)}	            

            <select style="height:22px;" name="maximum_depth_unit" id="maximum_depth_unit" onchange="checktest2()">

            	<option value="" {if $admintab_maxdepth_unit == ''}selected="selected"{/if} >{l s='Please choose unit' mod='squaremeter'}</option>

				<option value="mm" {if $admintab_maxdepth_unit == 'mm'}selected="selected"{/if} >{l s='mm' mod='squaremeter'}</option>

				<option value="cm" {if $admintab_maxdepth_unit == 'cm'}selected="selected"{/if} >{l s='cm' mod='squaremeter'}</option>

				<option value="dm" {if $admintab_maxdepth_unit == 'dm'}selected="selected"{/if} >{l s='dm' mod='squaremeter'}</option>

				<option value="m" {if $admintab_maxdepth_unit == 'm'}selected="selected"{/if} >{l s='m' mod='squaremeter'}</option>                

			</select>

            {else}

            <select style="height:22px;" name="maximum_depth_unit" id="maximum_depth_unit" onchange="checktest2()">

            	<option value="">{l s='Please choose unit' mod='squaremeter'}</option>

				<option value="mm">{l s='mm' mod='squaremeter'}</option>

				<option value="cm">{l s='cm' mod='squaremeter'}</option>

				<option value="dm">{l s='dm' mod='squaremeter'}</option>

				<option value="m">{l s='m' mod='squaremeter'}</option>                

			</select>            

            {/if}            

		</td>

		</tr>   

           

        <tr>

        <td colspan="2">

        <br />

        {l s='Customer will not be allowed to increase or decrease the applet\'s value above/below the limits.' mod='squaremeter'}

        </td>

        </tr>

      </table>            

      <p style="color:red;" id="errort4"></p> 

      <p style="color:red;" id="errort5_"></p>              

      </fieldset>    

<div class="separation"></div>

<div class="clear">&nbsp;</div>

<!-- Square Meter Calculation Module -->

<script type="text/javascript">
function overalltest() {
	if ((document.getElementById("errort2").innerHTML!="") || (document.getElementById("errort1").innerHTML!="") || (document.getElementById("errort4").innerHTML!="") || (document.getElementById("errort").innerHTML!="")) {
		disablesave();	
	}
	else if ( (document.getElementById("errort1_").innerHTML!="") || (document.getElementById("errort2_").innerHTML!="") || (document.getElementById("errort3_").innerHTML!="") || (document.getElementById("errort4_").innerHTML!="") || (document.getElementById("errort5_").innerHTML!="")){
		disablesave();	
	}
	else {
		enablesave();
		}
}

function disablesave() {
	document.getElementById("desc-product-save").style.display='none';
	document.getElementById("desc-product-save-and-stay").style.display='none';
	}
	
function enablesave() {
	document.getElementById("desc-product-save").style.display='block';
	document.getElementById("desc-product-save-and-stay").style.display='block';
	}

function checktest(){
	var maxw = document.getElementById('maximum_width');
	var maxh = document.getElementById('maximum_height'); 
	var maxd = document.getElementById('maximum_depth'); 	
	var minw = document.getElementById('minimum_width');
	var minh = document.getElementById('minimum_height'); 	
	var mind = document.getElementById('minimum_depth'); 		
	var conv = document.getElementById('conversion'); 	      
	var maxwc = Number(maxw.value);
	var maxhc = Number(maxh.value);
	var maxdc = Number(maxd.value);	
	var minwc = Number(minw.value);
	var minhc = Number(minh.value);	
	var mindc = Number(mind.value);		
	var convc = Number(conv.value);	

	var checknumberw = (isNaN( maxwc )) ||(isNaN( minwc ))

	if (checknumberw == true) {
  	var y2=document.getElementById("errort2");
  	y2.innerHTML="{l s='Width values should be number and/or decimals should be separated with dot.' mod='squaremeter'}";		
		}
	else
	{  	
  	var y2=document.getElementById("errort2");
  	y2.innerHTML="";			
		}

	var checknumberh = (isNaN( maxhc )) ||(isNaN( minhc )) 

	if (checknumberh == true) {
  	var y1=document.getElementById("errort1");
  	y1.innerHTML="{l s='Height values should be number and/or decimals should be separated with dot.' mod='squaremeter'}";
		}
	else
	{  	
  	var y1=document.getElementById("errort1");
  	y1.innerHTML="";
		}

	var checknumberd = (isNaN( maxdc )) ||(isNaN( mindc )) 

	if (checknumberd == true) {
  	var y6=document.getElementById("errort4");
  	y6.innerHTML="{l s='Depth values should be number and/or decimals should be separated with dot.' mod='squaremeter'}";
		}
	else
	{  	
  	var y6=document.getElementById("errort4");
  	y6.innerHTML="";
		}		

	var checknumberc = (isNaN( convc ))

	if (checknumberc == true) {
  	var y=document.getElementById("errort");
  	y.innerHTML="{l s='Conversion value should be number and/or decimals should be separated with dot.' mod='squaremeter'}";
		}
	else
	{  	
	var y=document.getElementById("errort");
  	y.innerHTML="";	
		}
	overalltest();		
	return false;		
} 

function checktest2(){
	var maxw1 = document.getElementById('maximum_width_unit');
	var maxh1 = document.getElementById('maximum_height_unit'); 
	var maxd1 = document.getElementById('maximum_depth_unit');	
	var minw1 = document.getElementById('minimum_width_unit');
	var minh1 = document.getElementById('minimum_height_unit'); 	
	var mind1 = document.getElementById('minimum_depth_unit'); 		
	var maxwc1 = maxw1.value;
	var maxhc1 = maxh1.value;
	var maxdc1 = maxd1.value;	
	var minwc1 = minw1.value;
	var minhc1 = minh1.value;	
	var mindc1 = mind1.value;		

	var checknumberw = (maxwc1 == minwc1)

	if (checknumberw == false) {
  	var y2=document.getElementById("errort2_");
  	y2.innerHTML="{l s='Width units must be the same.' mod='squaremeter'}";		
		}
	else
	{  	
  	var y2=document.getElementById("errort2_");
  	y2.innerHTML="";			
		}

	var checknumberh = (maxhc1 == minhc1) 

	if (checknumberh == false) {
  	var y1=document.getElementById("errort1_");
  	y1.innerHTML="{l s='Height units must be the same' mod='squaremeter'}";
		}
	else
	{  	
 	var y1=document.getElementById("errort1_");
  	y1.innerHTML="";
		}

	var checknumberd = (maxdc1 == mindc1) 

	if (checknumberd == false) {
  	var y7=document.getElementById("errort5_");
  	y7.innerHTML="{l s='Depth units must be the same' mod='squaremeter'}";
		}
	else
	{  	
  	var y7=document.getElementById("errort5_");
  	y7.innerHTML="";
		}		
	overalltest();		
	return false;		
} 

function checktest3(){
	var typev = document.getElementById('calculation_type').value;
	var convunitv = document.getElementById('conversion_unit').value;	

	var checkmatch = (typev == "surface" && (convunitv=="mm3" || convunitv=="cm3" || convunitv=="dm3"|| convunitv=="m3"|| convunitv==""))
	if (checkmatch == true) 
	{
  			var y4=document.getElementById("errort4_");
  			y4.innerHTML="{l s='If calculator type is surface, then conversion units can only be mm2, cm2, dm2 or m2.' mod='squaremeter'}";
	}
	else
	{
  			var y4=document.getElementById("errort4_");
  			y4.innerHTML="";	
	}
	
	var checkmatch2 = (typev == "volume" && (convunitv=="mm2" || convunitv=="cm2"|| convunitv=="dm2"|| convunitv=="m2" || convunitv==""))
	if (checkmatch2 == true)
	{  	
  			var y3=document.getElementById("errort3_");
  			y3.innerHTML="{l s='If calculator type is volume, then conversion units can only be mm3, cm3, dm3 or m3.' mod='squaremeter'}";	
	}
	else {
  			var y3=document.getElementById("errort3_");
  			y3.innerHTML="";	
		}
	overalltest();
	return false;
} 

</script>
