 <div class="cbi-section-create cbi-tblsection-create">

        <table class="cbi-section-table" style="width:810px; margin-left:5px">
                <tr class="cbi-section-table-descr">
                        <th class="cbi-section-table-cell"><%:Status%></th>
                        <th class="cbi-section-table-cell"><%:Value%></th>
                </tr>
                <tr class="cbi-section-table-row" style="font=normal">
                        <th class="cbi-section-table-cell" id="param" style="font-weight:normal">
                        </th>
                        <th class="cbi-section-table-cell" id="value" style="font-weight:normal">
                        </th>
                </tr>
        </table>

          <script type="text/javascript">//<![CDATA[
        XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "services", "versatile","versatile2_value")%>', null,
                function(x, mArray)
                {
                        var status1 = document.getElementById('param');
                        var status2 = document.getElementById('value');
                        var c=<%=luci.sys.exec("cat /etc/config/versatile2 | grep Digital | wc -l")%>;
                        if (mArray.mwandetail)
                        {
                                var i=0,min=8400;
                                var text1="",text2="",result="";
                                for (i = 0; i < 1; i++) {
                                        if (mArray.mwandetail[i])
                                        {
                                        var res = mArray.mwandetail[i];
                                                if (res && c == 1)
                                                {
                                                        text1 += "Digital output" + "<br>";
                                                        if( res == 1)
                                                        {
                                                                text2 += "CLOSE/ON" + "<br>";
                                                        }
                                                        else
                                                        {
                                                                text2 += "OPEN/OFF" + "<br>";
                                                        }
                                                }
                                                else if (res && c == 0)
                                                {
                                                        text1 += "Analog input" + "<br>";
                                                        result = (res - min)/151;
                                                        res = Math.round(result * 10)/10;
                                                        if( res < 0.1)
                                                        {
                                                            res = Math.round(res);
                                                        }
                                                        text2 += String.format("%.1f", res) + "V" + "<br>";
                                                }
                                        }
                                }
                                status1.innerHTML = String.format('%s', text1);
                                status2.innerHTML = String.format('%s', text2);
                        }
                        else
                        {
                                status.innerHTML = 'No information available';
                        }
                }
        );

        //]]></script>

</div>
