<!DOCTYPE html>
<% language=javascript %>
<html>
<head lang="en">
    <meta charset="GB2312">
    <title></title>
    <link href="css/style.css" title="style" rel="stylesheet" type="text/css" />
    <script src="js/jquery-1.6.3.min.js"></script>
    <style>
        i{font-style:normal}
        .kaiguanTD td{text-align: center;}
    </style>

</head>
<body style="background: #F3F3F3">
<div class='type2317 empty' style=' margin: 10px;'>
  <table width="100%">
    <tr>
    <td width="300px" style="text-align: center;"><img src="img/ico-dio.png" style="width: 100%;text-align: center;"></td>
    <td>
    <table width='100%'>
        <tr><td style='border: none'> <h1>开关量</h1></td></tr>
        <tr><td style='width: 200px;'>基本信息</td><td>SID:<span class='SID2317'> </span>&nbsp;&nbsp;&nbsp;编址:<span class='Addr2317'> </span>&nbsp;&nbsp;&nbsp;数据端口:<span class='Port2317'> </span></td></tr>
        <tr><td style='width: 200px;'>更新时间</td><td><span class='DateUpd2317'> </span></td></tr>
        <tr><td style='width: 200px;'>监测项状态</td><td><span class='State2317'> </span></td></tr>
    </table>

    <h1 style='margin:30px 10px 10px 10px;'>开关值</h1>
    <table width='100%' class="kaiguanTD">
        <tr> <td><h1>ADC1</h1></td> <td><h1>ADC2</h1></td> <td><h1>ADC3</h1></td> <td><h1>ADC4</h1></td></tr>
        <tr> <td><i class="D01"></i></td> <td><i class="D02"></i></td> <td><i class="D03"></i></td>  <td><i class="D04"></i></td></tr>
    </table>
    </td>
    </tr>
  </table>

    <a href='javascript:history.back()' class='back' style='color: #fff'>返回</a>
    </div>
<script>
var itype=2317;
var tescape=5000,time;

<% db_Open("/NandFlash/tmp/dbDat0.db3"); %>
var sid=<% write(sid);%>;
var tag1=<% write(tag1);%>;
var json=<% db_QryAdv("select * from tbDio where SID="+sid,0); %>
<% db_Close(); %>
	
	
var unit = "mA";
if ((tag1 % 10) >= 1)
	unit = "V";
	
    $(function(){
        if (tescape>0)
        {
            time=setInterval(ajax,tescape);
        }
    });
    function ajax(){
        $.ajax({
            type: "POST",
            url: "omdev/smdat0.asp",
            data: "itype="+itype+"&sid="+sid,
            dataType:"json",
            success: function(msg){
                list3(msg)
            }
        });
    }
   list3(json);
    function list3(data){
        $.each(data.recs,function(i,n){
            $(".SID2317").html(n.SID);
            $(".Addr2317").html(n.Addr);
            $(".Port2317").html(n.Port%256);
            $(".DateUpd2317").html(n.DateUpd);
            $(".State2317").html(window.parent.parseState(n.State));

            $(".D01").html(n.D01/100 + unit);
            $(".D02").html(n.D02/100 + unit);
            $(".D03").html(n.D03/100 + unit);
            $(".D04").html(n.D04/100 + unit);

        });
		$("span:contains('故障'),span:contains('告警'),span:contains('闭合'),span:contains('关闭')").addClass("red").removeClass("ger");
		$("span:contains('正常')").addClass("ger").removeClass("red");
    }
</script>
</body>
</html>