<%
local dsp = require "luci.dispatcher"
-%>

<script type="text/javascript">
	//<![CDATA[
	var _status = document.getElementsByClassName('_status');
	for(var i = 0; i < _status.length; i++) {
		var section = _status[i].parentElement.parentElement.parentElement.id;
		section = section.substr(section.lastIndexOf("-") + 1);
		XHR.poll(2,'<%=dsp.build_url("admin/services/pppoe-relay/get_status")%>', {
				index: i,
				section: section
			},
			function(x, result) {
				if(x && x.status == 200) {
					if(result.status)
						_status[result.index].innerHTML = '<font color="green"> ✓ </font>';
					else
						_status[result.index].innerHTML = '<font color="red"> X </font>';
				}
			}
		);
	}
	//]]>
</script>