function registry() {
    if (registry.caller != registry.getInstance) {
        throw new Error("There is no public constructor for MyClass.");
    }
   
    this.instance = null;
    this.keys = new Array();
    this.keyIndex = new Array();    
    
    this.setKey = setKey;
    this.toString = toString;
    this.getKey = getKey;
    this.remove = remove; 
}

registry.getInstance = function () {
    if (this.instance == null) {
        this.instance = new registry();
    }

    return this.instance;
}

function setKey(keyName, keyValue){
    for(var i=0; i < this.keyIndex.length; i++){
        if(this.keyIndex[i] == keyName){
            this.keys[i] = keyValue;
            return;
        }
    }
    
    this.keyIndex.push(keyName);
    this.keys.push(keyValue);
}

function getKey(keyName){
    for(var i=0; i < this.keyIndex.length; i++){
        if(this.keyIndex[i] == keyName){
            return this.keys[i];
        }
    }
    
    return "undefined";
}

function remove(keyName){
    for(var i=0; i < this.keyIndex.length; i++){
        if(this.keyIndex[i] == keyName){
            this.keyIndex.splice(i,1);
            this.keys.splice(i,1);
        }
    }
}

function toString(){
    return  this.keyIndex.toString() + "<br>" + this.keys.toString();
}