//-------- Collection Objects --------
function Hashtable()
{
    this.Keys = new Array();
    this.Values = new Array();
}

Hashtable.prototype.Add = function(a_strKey, a_strValue)
{
    //this.Keys[]
}


function ArrayList()
{
    this.Values = new Array();
}

ArrayList.prototype.GetValues = function()
{
	return this.Values;
}

ArrayList.prototype.Add = function(a_strValue)
{
    this.Values[this.Values.length] = a_strValue;
}

ArrayList.prototype.Remove = function(a_strValue)
{
    var arrNewValues = new Array;
    for (var i = 0; i < this.Values.length; i++)
    {
        if (this.Values[i] != a_strValue)
        {
            arrNewValues[arrNewValues.length] = this.Values[i];
        }
    }
    this.Values = arrNewValues;
}

ArrayList.prototype.GetCount = function()
{
    return this.Values.length;
}

ArrayList.prototype.Contains = function(a_strValue)
{
    for (var i = 0; i < this.Values.length; i++)
    {
        if (this.Values[i] == a_strValue)
        {
            return true;
        }
    }
    return false;
}

ArrayList.prototype.Serialize = function()
{
    var strSerializedValues = ""; 
    var strSeparator = "";
    for (var i = 0; i < this.Values.length; i++)
    {
    	if (this.Values[i] != "")
    	{
        	strSerializedValues = strSerializedValues + strSeparator + this.Values[i];
        	strSeparator = "#";
        }
    }
    return strSerializedValues;
}

ArrayList.prototype.Deserialize = function(a_strValues)
{
    var arrValues = a_strValues.split('#'); 
    if (arrValues)
    {
	    for (var i = 0; i < arrValues.length; i++)
	    {
	        this.Add(arrValues[i]);
	    }
    }
}

//-------- Conversion Tools --------

function Decimal2Hex(a_nValue) 
{
    var strHD = "0123456789ABCDEF";
    var nResult = strHD.substr(a_nValue&15,1);
    while (a_nValue > 15) 
    {
        a_nValue>>=4;
        nResult = strHD.substr(a_nValue&15,1) + nResult;
    }
    return nResult;
}

function Hex2Decimal(a_nValue) 
{
    return parseInt(a_nValue, 16);
}

//-------- Serialization Tools --------

function SerializeToString(a_arrValues)
{
    var strSerializedValues = ""; 
    var strSeparator = "";
    for (var i = 0; i < a_arrValues.length; i++)
    {
        strSerializedValues = strSerializedValues + strSeparator + a_arrValues[i];
        strSeparator = "#";
    }
    return strSerializedValues;
}

//-------- Debug Tools --------

function DebugObject(a_oObject)
{
    var strInfo = "";
    for (oProperty in a_oObject)
    {
        strInfo = strInfo + oProperty + "\n";
    }
    alert(strInfo);
}