How to identify if device's wifi is on? and tips on loading

Is there anyway to know If my device’s WIFI is on, and a progress bar that lets you wait until the loading is finished? my app should have a syncing mode if my app detects, your wifi is on, then the syncing proceeds, then you will have to wait if app is finished syncing, just like loading you have to wait for all items to be loaded.

http://docs.coronalabs.com/daily/api/library/network/setStatusListener.html

http://docs.coronalabs.com/daily/api/library/network/setStatusListener.html