
  /////////////////////////////////////////////////////
  //                                                 //
  //          C-NOOFS Forecast Viewer v0.6           //
  //               Web User Interface                //
  //                                                 //
  /////////////////////////////////////////////////////

UserInputGroup = function(name)
{
	this.name = name;
	this.uis = new Array();
}

/**
 * Stores the name of this UIG
 * @type String
 */
UserInputGroup.prototype.name = "";


/**
 * Stores the user input objects corralled by this group
 * @type Array
 */
UserInputGroup.prototype.uis;


/**
 * Add a UI to this group
 * @param name Name to store obj under
 * @param obj Object to add to group
 */
UserInputGroup.prototype.add = function(item_key, obj)
{
	this.uis[item_key] = obj
}


/**
 * Retreive all the items a user selected in this group
 * @return 2D Array of values
 */
UserInputGroup.prototype.getSelected = function()
{
 	var ret = {};
 	var uiskey;
 	
	for ( uiskey in this.uis )
	{
	 	if ( !YAHOO.lang.isUndefined(this.uis[uiskey]) )
	 	{
			ret[uiskey] = this.uis[uiskey].getSelected();
		}
	}
	return ret;
}


/**
 * Retrieve all selected items in the form of an XML document
 * @return XML document
 */
UserInputGroup.prototype.getSelectedXML = function()
{
	var ret = "";
 	var uiskey;
 	
	for ( uiskey in this.uis )
	{
	 	if ( !YAHOO.lang.isUndefined(this.uis[uiskey]) )
	 	{
			ret += this.uis[uiskey].getSelectedXML();
		}
	}
	
	return ret;
}


/**
 * Set the handler to be executed when the user changes an input
 * @param handler Handler to be called on change in input
 */
UserInputGroup.prototype.setChangeHandler = function(handler)
{
 	var uiskey;
 	
	for ( uiskey in this.uis )
	{
	 	if ( !YAHOO.lang.isUndefined(this.uis[uiskey]) )
	 	{
	 		this.uis[uiskey].setChangeHandler(handler);
		}
	}	
}
