﻿function Dictionary(){this.count = 0;this.Obj = new Object();this.exists = Dictionary_exists;this.add = Dictionary_add;this.remove = Dictionary_remove;this.removeAll = Dictionary_removeAll;this.values = Dictionary_values;this.keys = Dictionary_keys;this.items = Dictionary_items;this.getVal = Dictionary_getVal;this.setVal = Dictionary_setVal;this.setKey = Dictionary_setKey;}
function Dictionary_exists(sKey){return (this.Obj[sKey])?true:false;}
function Dictionary_add(sKey,aVal){var K = String(sKey);if(this.exists(K)) return false;this.Obj[K] = aVal;this.count++;return true;}
function Dictionary_remove(sKey){var K = String(sKey);if(!this.exists(K)) return false;delete this.Obj[K];this.count--;return true;}
function Dictionary_removeAll(){for(var key in this.Obj) delete this.Obj[key];this.count = 0;}
function Dictionary_values(){var Arr = new Array();for(var key in this.Obj) Arr[Arr.length] = this.Obj[key];return Arr;}
function Dictionary_keys(){var Arr = new Array();for(var key in this.Obj) Arr[Arr.length] = key;return Arr;}
function Dictionary_items(){var Arr = new Array();for(var key in this.Obj){var A = new Array(key,this.Obj[key]);Arr[Arr.length] = A;}return Arr;}
function Dictionary_getVal(sKey){var K = String(sKey);return this.Obj[K];}
function Dictionary_setVal(sKey,aVal){var K = String(sKey);if(this.exists(K))this.Obj[K] = aVal;else this.add(K,aVal);}
function Dictionary_setKey(sKey,sNewKey){var K = String(sKey);var Nk = String(sNewKey);if(this.exists(K)){if(!this.exists(Nk)){this.add(Nk,this.getVal(K));this.remove(K);}}else if(!this.exists(Nk)) this.add(Nk,null);}
