kaServers = function()
{
	this.current = -1;
	this.servers;
}

kaServers.prototype.setServers = function(servs)
{
	this.servers = servs;
}

kaServers.prototype.nextIndex = function()
{
	this.current++;
	this.current = this.current % this.servers.length;

	return this.current;
}

kaServers.prototype.next = function(key)
{
	if (key) return this.servers[this.hash(key)];
	else return this.servers[this.nextIndex()];
}

// returns the index (in the list of servers) for the given
// key using a hash algorithm based on the key argument.
kaServers.prototype.hash = function(key)
{
	return Math.abs(key % this.servers.length);
}

kaServers.prototype.isEmpty = function()
{
	return this.servers == undefined;
}
