(function(w, h) { //ipc_addr
    "use strict";

    w.isLocal = /^file:\/\//i.test(h) ||
        /^http:\/\/localhost(?:\:\d{2,4})?\//i.test(h);

    // You can change this IP and user:pass during development
    // This (on Chrome with disable-web-security) simulates the server (IP)
    w.cam_addr = w.isLocal ? "http://admin:admin@192.168.1.168/" :
        /^https?:\/\/[^\/]*\//i.exec(h)[0];

    //w.cgi_addr = w.cam_addr + "Pictures/1/Mosaic";
    w.mosaicurl = w.cam_addr + "Pictures/1/Mosaic";
    w.motionurl = w.cam_addr + "Pictures/1/Motion";
    w.setURL = function(ch) { 
        return w.cam_addr + "Pictures/" + ch + "/Mosaic";
    }

}(window, window.location.href));