var cameraman = null;

function CameraMan(id) {
    var _self = this;
    this.id = id;

    this.getApp = function () {
        var name = _self.id;
        return (navigator.appName.indexOf ("Microsoft") != -1 ? window : document)[name];
    };

    this.takePhoto = function () {
        _self.getApp().takePhoto();
    };
    this.sendPhoto = function () {
        _self.getApp().sendPhoto();
    };

    this._tookPhoto = function () {
        $('#' + _self.id).trigger('tookPhoto');
    };
    this._sentPhoto = function (url) {
        $('#' + _self.id).trigger('sentPhoto', url);
    };
}

cameraman = new CameraMan();

var cameraman = null;

function CameraMan(opts) {
    var _self = this;
    this.options = opts;
    this.id = opts.id;

    this.getApp = function () {
        var name = _self.id;
        return (navigator.appName.indexOf ("Microsoft") != -1 ? window : document)[name];
    };

    this.takePhoto = function () {
        _self.getApp().takePhoto();
    };
    this.sendPhoto = function () {
        _self.getApp().sendPhoto();
    };

    this._tookPhoto = function () {
        if (_self.options.tookPhoto) {
            _self.options.tookPhoto.apply(_self);
        }
    };
    this._sentPhoto = function (url) {
        if (_self.options.sentPhoto) {
            _self.options.sentPhoto.apply(_self, url);
        }
    };
}

cameraman = new CameraMan();

Create a camera using options with callbacks, not just an id