
function DS_KeyMapManager() {
    //////////////////////////////////////////////////
    // keyboard event meta handler for managing keymaps
    //////////////////////////////////////////////////

    this._on = true;

    this.turnOn = function () { this._on = true; }
    this.turnOff = function () { this._on = false; }
    this.activeKeyMapper = function (e) {}
    this.setKeyMapper = function (mapper) {this.activeKeyMapper = mapper;}
        
    this.handleKey = function handleKey(e) {
	//////////////////////////////////////////////////
	// keyboard event handler
	//////////////////////////////////////////////////
        if (!this._on) return true;
        if (e == null) { // ie
	    kcode = event.keyCode;
        } else { // mozilla
    	if (e.altKey || e.ctrlKey) {
    	    // moz doesn't override ctrl keys,
    	    // eg, Ctrl-N won't bypass this function to open new window
    	    return true;
    	}
    	kcode = e.which;
        }
        key = String.fromCharCode(kcode).toLowerCase();
        return this.activeKeyMapper(key);
    }
    
}

