Hotspot script to show the gateway status

HI

Im trying to do a script in the login.html to show the status of the internet gateway.
for example if no ping from gw the login.html must show: “sorry but in this moment our services are down, try later”…

The initial idea was:

$(if variable == 'no')
sorry but in this moment our........
$(endif)

but not exist a variable that saves the status of gw. (from http://www.mikrotik.com/testdocs/ros/2.9/ip/hotspot.php ).
Maybe a feature like this will be good.

who can give me another idea only using the mikrotik and no external servers?


Thanks in advance