{*
*	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.
*}
{if ($page_name == 'product')}
<!-- Square Meter Calculation Module -->
{if $admintab_addquan == 'yes'}
<style type="text/css">
#labels p {
float:left;
width:18%;
}
#squaremeter {
margin-left:15px;
width:90%;
}
</style>
{else}
<style type="text/css">
#labels p {
	float:left;
	width:29%;
}
#squaremeter {
margin-left:52px;
width:56%;
}
</style>
{/if}
<br /><br /><br />
 <fieldset id="squaremeter" >
 {if $admintab_addquan == 'yes'}
  <legend>&nbsp;{l s='Please enter surface/quantity' mod='squaremeter'}&nbsp;</legend>
 {else}
  <legend>&nbsp;{l s='Please enter surface' mod='squaremeter'}&nbsp;</legend>  
 {/if}
<div align="center">
<div id="labels">
<p>{l s='Width' mod='squaremeter'}&nbsp;({$admintab_minwidth_unit})</p>
<p>&nbsp;&nbsp;</p>
<p>{l s='Height' mod='squaremeter'}&nbsp;({$admintab_minheight_unit})</p>
{if $admintab_addquan == 'yes'}
<p>&nbsp;&nbsp;</p>
<p>{l s='Piece(s)' mod='squaremeter'}</p>
{/if}
</div>
<div id="fields">
<p id="width"><input id="quantity_wanted_alt" type="text" value="{$admintab_minwidth}" name="qty_alt" onchange="check_width()"></input></p>
<p id="multiplicationsign"><font face="Verdana, Geneva, sans-serif" size="+1">{l s='X' mod='squaremeter'}&nbsp;&nbsp;</font></p>
<p id="height"><input id="quantity_wanted_alth" type="text" value="{$admintab_minheight}" name="qty_alth" onchange="check_height()"></input></p>
{if $admintab_addquan == 'yes'}
<p id="multiplicationsign"><font face="Verdana, Geneva, sans-serif" size="+1">{l s='X' mod='squaremeter'}&nbsp;&nbsp;</font></p>
<p id="quantitym"><input id="quantity" type="text" value="1" name="quantity" onchange="check_quantity()"></input></p>
{/if}
</div>
</div>
</fieldset>
<div id="dimension" align="center"></div>
<div id="conversion" align="center" style="color:#060">{l s='Note that 1 order quantity is sized' mod='squaremeter'}&nbsp;{$admintab_conversion}&nbsp;{$admintab_conversion_unit}<br /></div>

<div id="totalprice" align="right" style="{if $admintab_dispprice == 'pricenototalprice'}display:none{else}display:block{/if}">
<input style="{if ($admintab_dispprice == 'pricetotalprice') OR ($admintab_dispprice == 'nopricetotalprice')}display:none{else}display:block{/if}" type="button" name="submit" id="totalprice_product_button" onclick="totalpriceinfo()" value="{l s='Click to See the Updated Total Price' mod='squaremeter'}" class="button"/><br /><div id="totalpriceinfo"></div><br />
</div>

<script type="text/javascript">

$(document).ready(function () {
    var searchValue = "";
    setInterval(checkTextboxChanged, 0.5);

    function checkTextboxChanged() {
        var currentValue = $('#quantity_wanted').val();
        if (currentValue != searchValue) {
            searchValue = currentValue;
            TextboxChanged();
        }
    }

    function TextboxChanged() {
        // do your magic here
		prod();
    }
});
</script>
<!-- Square Meter Calculation Module -->
{/if}