<!-- Reusable templates for gain meters -->

<!-- Horizontal VU Template -->
<script type="text/template" id="template-vu-h">
    <table class="gainmeter-vu-top vu horizontal" cellspacing="3" cellpadding="0">
        <tr>
            {%
                var redSwitch = Math.round(data.lightCount * 0.6666667);
            for (var i=0; i<data.lightCount; i++) { 
                var lightClass = (i >= redSwitch) ? 'vu-red-off' : 'vu-green-off';
            %}
            <td width="{{data.lightWidth}}" height="{{data.lightHeight}}" 
                class="vulight vu{{i}} {{lightClass}}"></td>
            {% } %}
        </tr>
    </table>
</script>


<!-- Vertical VU Template -->
<script type="text/template" id="template-vu-v">
    <table class="vu vertical">
        {%
        var redSwitch = Math.round(data.lightCount * 0.6666667);
        var lightClass = 'vu-red-off';
        for (var i=data.lightCount-1; i>=0; i--) { 
            var lightClass = (i >= redSwitch) ? 'vu-red-off' : 'vu-green-off';
        %}
        <tr><td width="{{data.lightWidth}}" height="{{data.lightHeight}}" 
            class="vulight vu{{i}} {{lightClass}}"></td></tr>
        {% } %}
    </table>
</script>
