/*
	applications.js
*/

function Applications()
{
	this.items = new Array();
	this.add = Applications_add;
	this.getByID = Applications_getByID;
	this.render = Applications_render;
}

function Applications_add(aApp)
{
	this.items[this.items.length] = aApp;
}

function Applications_getByID(aID)
{
	for (i=0; i<this.items.length; i++)
	{
		if (this.items[i].ID == aID)
			return this.items[i];
	}
	return null;
}

function Applications_render(aCombo)
{
	aCombo.options.length = 0;
	for (i=0; i<this.items.length; i++)
	{
		var aApp = this.items[i];
		aCombo.options[i] = new Option(aApp.name, aApp.ID);
	}
}

function Application(aID, aName)
{
	this.ID = aID;
	this.name = aName;
	this.versions = new Array();
	this.addVersion = Application_addVersion;
	this.render = Application_render;
}

function Application_addVersion(aVersion)
{
	this.versions[this.versions.length] = aVersion;
}

function Application_render(aCombo)
{
	aCombo.options.length = 0;
	for (i=0; i<this.versions.length; i++)
	{
		var aVersion = this.versions[i];
		aCombo.options[i] = new Option(aVersion.label, aVersion.ID);
	}
}

function Version(aID, aLabel)
{
	this.ID = aID;
	this.label = aLabel;
}
