changes to make all layers work over SSL, external .js file load over SSL or changed to locally served if no SSL option available