restructured some javascript functions.  looked into issue with addon re...

...loading when ip is wrongly identified as online then goes offline again