function Theme()
{
}

Theme.prototype = new WebObject();

// private static Theme[] _loadedThemes = new Theme[0];
Theme._loadedThemes = [];

// public abstract Skin getSkin(String componentName);
Theme.prototype.getSkin = WebObject.ABSTRACT_METHOD;

// public abstract Object getProperty(String propertyName[, Object default]);
Theme.prototype.getProperty = WebObject.ABSTRACT_METHOD;

// public abstract String getName();
Theme.prototype.getName = WebObject.ABSTRACT_METHOD;

Theme.onThemeChanged = new EventDelegate();

// public static Theme getCurrentTheme();
Theme.getCurrentTheme = function()
{
	return this.currentTheme;
}

// public static Theme installTheme(String name);
Theme.changeTheme = function(name, callback)
{	
	var theme = Theme._loadedThemes[name];
	
	if(theme)
	{
		Theme.install(theme);
		
		if(callback)
		{
			callback(true);
		}
	} else
	{
		include("theme/" + name + "/Theme.js", callback);
	}
}

// public static Theme installTheme(Theme theme)
Theme.install = function(theme)
{
	if(isUndefined(theme.prototype.hasInterface) || !theme.prototype.hasInterface(Theme))
	{
		throw new Error("Theme.install(theme = " + theme + ") - theme does not expose the Theme interface!");
	} else
	{
		this.currentTheme = new theme;
		this.onThemeChanged.fireEvent(this.currentTheme);
	}
}
