<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=luci.dispatcher.build_url("admin", "services", "smartdns", "status")%>', null,
	function(x, data) {
		var tb = document.getElementById('smartdns_status');
		if (data && tb) {
			var links = "";
			if (data.running) {
				links = '<b><font color=green>SmartDNS - <%:RUNNING%></font></b></em>';
				if (data.redirect) {
					if (data.redirect == 1) {
						if (data.ipv4_works == 0) {
							links += "<br></br><b><font color=red><%:IPV4 53 Port Redirect Failure%></font></b>"
						}
						
						if (data.ipv6_works != 2) {
							if (data.ipv6_works == 0) {
								links += "<br></br><b><font color=red><%:IPV6 53 Port Redirect Failure%></font></b>"
							}
						}
					} else if (data.redirect == 2) {
						if (data.dnsmasq_forward == 0) {
							links += "<br></br><b><font color=red><%:Dnsmasq Forwared To Smartdns Failure%></font></b>"
						}
					}
				}
			} else {
				links = '<b><font color=red>SmartDNS - <%:NOT RUNNING%></font></b>';
			}

			tb.innerHTML = links;
		}
	}
);
//]]>
</script>
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
	<p id="smartdns_status">
		<em><%:Collecting data...%></em>
	</p>
</fieldset>
