﻿Type.registerNamespace("Telerik.Web.UI");

Telerik.Web.UI.AttributeCollection = function (owner)
{
	this._owner = owner;
	this._data = {};
	this._keys = [];
}

Telerik.Web.UI.AttributeCollection.prototype = 
{
	getAttribute : function (key)
	{
		return this._data[key];
	},
	
	setAttribute : function (key, value)
	{
		this._add(key, value);
		
		var attributeEntry = {};
		attributeEntry[key] = value;

		this._owner._notifyPropertyChanged("attributes", attributeEntry);
	},
	
	_add : function (key, value)
	{
		if (Array.indexOf(this._keys, key) < 0)
			Array.add(this._keys, key);
			
		this._data[key] = value;
	},
	
	removeAttribute : function (key)
	{
		Array.remove(this._keys, key);
		
		delete this._data[key];
	},
	
	_load : function (json)
	{
		for (var key in json)
			this._add(key, json[key]);
	},
	
	get_count : function ()
	{
		return this._keys.length;
	}
}

Telerik.Web.UI.AttributeCollection.registerClass('Telerik.Web.UI.AttributeCollection');
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();