function TMap() {
	//****************//
	// PUBLIC
	//****************//

	/**
	 * put a value in the map
	 * @param name
	 * @param value
	 */
	this.put = TMap__put;

	/**
	 * get a value from the map
	 * @param name
	 * @return the value retrieved from the map, or null if not found
	 */
	this.get = TMap__get;
	
	/**
	 * get the number of name/value pairs in the map
	 * @return the pair count
	 */
	this.getCount = TMap__getCount;

	/**
	 * get an array of all the names in the map
	 * @return an array of names
	 */
	this.getKeys = TMap__getKeys;

	/**
	 * remove an item from the array
	 * @param name
	 */
	this.remove = TMap__remove;
	
	/**
	 * clear the map
	 */
	this.clear = TMap__clear;
	
	//****************//
	// PRIVATE
	//****************//
	this.arr = new Array();
}
function TPair(name, val) {
	this.name = name;
	this.value = val;
}

function TListener() {
	//****************//
	// PUBLIC
	//****************//
	/**
	 * post a new message
	 * @param msg a text message
	 * @param obj an optional object/value that is required by the handler
	 */
	this.post = TListener__post;
	
	/**
	 * add an object to the listeners
	 * @param name the reference
	 * @param obj the object that will be handling the events
	 *   - must support a "listenEvent(msg, obj)" method being called
	 */
	this.add = TListener__add;
	
	/**
	 * remove an object from the listeners
	 * @param name the reference (same as the reference when added)
	 */
	this.remove = TListener__remove;
	
	//****************//
	// PRIVATE
	//****************//
	//this is a map of name->objects, however cannot create a map here as we only have the declaration (not the definition)
	this.listeners = null;
}

function TEventManager() {
	//****************//
	// PUBLIC
	//****************//

	/**
	 * register an event
	 * @param id the event constant
	 * @param action the function or method to call
	 */
	this.addEvent = TEventManager__addEvent;
	
	/**
	 * get the events of a particular type
	 * @param id the event constant
	 * @return an array of EventObject
	 */
	this.getEvents = TEventManager__getEvents;
	
	/**
	 * write the events to the document (this should be done at the end of the page)
	 */
	this.write = TEventManager__write;
	
	this.formName = "frmBody";	//default form name
	
	//constants
	this.WINDOW_UNLOAD = 1;
	this.WINDOW_LOAD = 3;
	this.WINDOW_RESIZE = 4;
	this.WINDOW_SCROLL = 5;
	this.WINDOW_FOCUS = 6;
	this.DOCUMENT_FORM_SUBMIT = 2;
	this.DOCUMENT_CLICK = 7;
	
	//****************//
	// PRIVATE
	//****************//
	this.arr = new Array();

	//inline constructor	
	if (document.customObjects==null) {
		document.customObjects = new TMap();
	}
	if (document.customObjects.get("Debug Status")==null) {
		document.customObjects.put("Debug Status", "false");
	}
	//add this object to the customObjects
	document.customObjects.put("eventHandler", this);
}
//private class used by TEventManager
function TEventObject(id, action) {
	this.id = id;
	this.action = action;
}

function TSelectListLoader() {
	/**
	 * the form the selects reflect
	 * NOT REQUIRED: if not specified, all the forms are searched
	 */
	this.formName = null;
	
	/**
	 * load the select's
	 */
	this.load = TSelectListLoader__load;
	
	/**
	 * add a new select option
	 * @param listname - the name of the select element
	 * @param optname - the option text
	 * @param optval - the value of the option
	 */
	this.add = TSelectListLoader__add;
	
	/* === private === */
	
	this.getSelectElement = TSelectListLoader__getSelectElement;
	this.map = new TMap();
}

function TSelectListOption(name, value, selected) {
	this.name = name;
	this.value = value;
	this.selected = selected;
}

function TPanel(name) {
	// public properties
	this.Name = name;
	this.Position = new TPosition(0, 0);
	this.Size = new TSize(0, 0);
	this.Contents = "";
	
	// public methods
	this.AddToControl = TPanel__AddToControl;
	this.Repaint = TPanel__Repaint;
	
	this.Hide = TPanel__Hide;
	this.Show = TPanel__Show;
	
	// private properties
	this.elementReference = null;
}

function TSize(h, w) {
	// public properties
	this.Height = h;
	this.Width = w;
}

function TPosition(x, y) {
	// public properties
	this.X = x;
	this.Y = y;
	this.MousePosition = null; //one of null, 'topleft', 'topright', 'bottomleft', 'bottomright'
	this.MousePositionX = 0;
	this.MousePositionY = 0;
}
