// JavaScript Document


function HashMap()
{
	this.map = new Array();
	this.size = 0;
	this.rs = "&"
	this.fs = "="
	
	switch ( arguments.length )
	{
	case 0:
		break;
		
	case 1:
		var rawValue = arguments[0];
		var end = rawValue.length;
		
		var p = 0;
		var s = rawValue.substring( p, rawValue.indexOf( this.rs ) );
		var n = 0;
		while ( p < end )
		{
			var pf = 0;
			var sf = s;
			
			var key = sf.substring( pf, sf.indexOf( this.fs ) );
			pf = sf.indexOf( this.fs ) + 1;
			var value = sf.substring( pf, sf.length );
			this.put( key, value )
				
			p += s.length + 1;
			s = rawValue.substring( p, rawValue.indexOf( this.rs, p ) );

			n++;
		}

		break;
	}
}

HashMap.prototype.put = function( key, value )
{
//alert( "put: " + key + ", " + value )
	this.map[key] = value;
	this.size++;
}

HashMap.prototype.getKey = function( index )
{
	var i = 0;
	for ( key in this.map )
	{
		if ( i == index ) { return key; }
		i++;
	}
	
	return "undefined at " + i;
}

HashMap.prototype.get = function( key )
{
	return this.map[key];
}

HashMap.prototype.getSize = function()
{
	return this.size
}

HashMap.prototype.toString = function()
{
	var result = ""
	
	for ( key in this.map )
	{
		result += key + this.fs + this.map[key] + this.rs
	}

	return result
}

