
function TableManager(cid)
{
	/* ACTIONS - These strings each contain an href to the specified action.  The destination href must 
	             satisfy the specs listed 			 
	*/
	this.onRetreiveNavData;					/* Based on the same query as the action below, this action generates an array containing the rowUID
																	   for each row.  This is needed to manage the navigation links above and below the page data
																	*/
																	
	this.onRetreiveCurrentPage;			/* Based on the same query as the above action, this action generates an array containing all row data
																	   needed to display the current page of rows 
																	*/
																																	 
	this.onCreateRow;								/* The page to load when a new row is requested */
	this.onModifyRow;								/* The page to load when an existing row needs to be modified */
	this.onDeleteRow;								/* Action taken when row should be deleted */
	
	/* ELEMENT IDS */
	this.containerId = cid;											/*  */
	
	/* SETTINGS */	
	this.tableLabel;									/*  */
	this.rowsPerPage									/*  */
	this.rowIndexName;								/*  */
	this.frameHeight;									/*  */
	this.imgFolder;										/*  */
	this.enableSort = false;					/*  */
	
	this.table_class = "";						/*  */
	this.toolbox_class = "";					/*  */
	this.table_head_class = "";				/*  */
	this.nav_top_class = "";					/*  */
	this.nav_bottom_class = "";				/*  */
	this.nav_normalPage_class = "";		/*  */
	this.nav_currentPage_class = "";	/*  */
	this.rows_color1_class = "";			/*  */
	this.rows_color2_class = "";			/*  */
	this.rows_colorHighlight_class;		/*  */
	
	this.ani_resizeIncrement = 50;		/* how many pixels to move for each resizing step */
	this.ani_resizeSpeed = 10;				/* the spped at which to resize */
	
	
	
	
	/* PRIVATE SETTINGS */
	var self = this;
	this.cols = new Array();
	this.currentRowUID;
	this.rows_total;
	this.pages_total = 0;
	this.pages_current = 1;
	this.pendingRowUID_highlight;
	this.tbody;
	this.filterObj = new FilterGenerator(this.containerId + "_filters");
	this.filterItems = new Array();
	this.id_nav_top = this.containerId + "_navTop";
	this.id_nav_bottom = this.containerId + "_navBottom";
	
	// attach onload event
	var self = this;
	this.addLoadEvent(function() { self.generateTable(); });
	
	
	
	
	this.aniOpen = function(targetId, href, finalHeight)
	{
		var targetObj = document.getElementById(targetId);
		
		if(targetObj.resizingDirection != "close")
		{
			// keep resizing
			if(targetObj.clientHeight < (finalHeight - this.ani_resizeIncrement + 1))
			{
				var self = this;
				targetObj.style.height = (targetObj.clientHeight + this.ani_resizeIncrement) + "px";
				window.setTimeout(function() { self.aniOpen(targetId, href, finalHeight); }, this.ani_resizeSpeed); 
			}
			// done resizing...assign href
			else
			{
				targetObj.style.height = finalHeight + "px";
				if(href.length > 0)
					getFrame(targetId).location.href = href;
			}	
		}
  };
	
	
	this.aniClose = function(targetId, onDone)
	{
		var targetObj = document.getElementById(targetId);
		
		if(targetObj.resizingDirection != "open")
		{
			// keep resizing
			if(targetObj.clientHeight > this.ani_resizeIncrement)
			{
				var self = this;
				targetObj.style.height = (targetObj.clientHeight - this.ani_resizeIncrement) + "px";
				window.setTimeout(function() { self.aniClose(targetId, onDone); });
			}
			// hide iframe and call onDone
			else
			{
				targetObj.style.height = "0px";
				targetObj.parentNode.removeChild(targetObj);
				onDone();
			}
		}
	};
}
	
	
	
	
	
	
	
	
	
	
	
	
	
	
/******
*
*
*  Init
*
*
******/
TableManager.prototype.generateTable = function()
{
	// create table
	var container = document.getElementById(this.containerId);
	
		// toolbox
		var toolbox = document.createElement("div");
		toolbox.className = this.toolbox_class;
			var toolbox_title = document.createElement("div");
			toolbox_title.style.fontWeight = "bold";
			toolbox_title.style.fontSize = "larger";
			toolbox_title.innerHTML = this.tableLabel + " Tools:";
		toolbox.appendChild(toolbox_title);
			var toolbox_filters = document.createElement("div");
			toolbox_filters.id = this.containerId + "_filters";
			//this.filterObj = new FilterGenerator(this.containerId + "_filters");
			var self = this;
			this.filterObj.setOnUpdate(this, this.onFilterUpdate);
			for(var i=0; i<this.filterItems.length; i++)
				this.filterObj.addFilter(this.filterItems[i]);
		toolbox.appendChild(toolbox_filters);
	container.appendChild(toolbox);
	
		var nav_top = document.createElement("div");
		nav_top.id = this.id_nav_top;
		nav_top.className = this.nav_top_class;
		container.appendChild(nav_top);
		
		var table = document.createElement("table");
		this.table = table;
		table.id = "table_data";
		table.tableManager = this;
		table.className = this.table_class;
		table.setAttribute("cellPadding", 0);
		table.setAttribute("cellSpacing", 1);
		table.style.width = "100%";
			var thead = table.createTHead();
			thead.className = this.table_head_class;
			thead.style.align = "center";
				var hRow = thead.insertRow(-1);
					var col0 = document.createElement("th");
						var col0_span = document.createElement("span");
						col0_span.innerHTML = "Actions";
						col0.appendChild(col0_span);
					hRow.appendChild(col0);
					
					for(var i=0; i<this.cols.length; i++)
					{
						var col = document.createElement("th");
							var col_span = document.createElement("span");
							col_span.tableManager = this;
							col_span.sortName = this.cols[i].colName;
							col_span.innerHTML = this.cols[i].colLabel;
							// sort...need to finish
							if(this.enableSort)
							{
								col_span.style.cursor = "pointer";
								col_span.style.fontWeight = "bold";
								col_span.onclick = function() { this.tableManager.sortBy = this.sortName; this.tableManager.updateTable(); } 
							}
							col.appendChild(col_span);
						hRow.appendChild(col);
					}
				
			var tbody = document.createElement("tbody");
			//tbody.id = "table_data_body";
			this.tbody = tbody;
			table.appendChild(tbody);
		container.appendChild(table);
		
		var nav_bottom = document.createElement("div");
		nav_bottom.id = this.id_nav_bottom;
		nav_bottom.className = this.nav_bottom_class;
		container.appendChild(nav_bottom);
	
	this.filterObj.generateFilters();
	
	// setup navigation
	this.retreiveNavData();
	
	// generate page
	this.updateTable_retreiveRows();
	
};
	
TableManager.prototype.addColumn = function(colName, colLabel, doExpand, noWrap, cssText)
{
	var newCol =  { };
	newCol.colName = colName;
	newCol.colLabel = colLabel;
	newCol.doExpand = doExpand;
	newCol.noWrap = noWrap;
	newCol.cssText = cssText;
	this.cols[this.cols.length] = newCol;
};

TableManager.prototype.addFilter = function(filterItem)
{
	this.filterItems[this.filterItems.length] = filterItem;
	
}

TableManager.prototype.setupFirstFilter = function(name, operator, value)
{
	this.filterObj.setupFirstFilter(name, operator, value);
}

TableManager.prototype.onFilterUpdate = function()
{
	this.updateTable();
}
	
	
	
	
	
	
	
/******
*
*
*  Helper Methods
*
*
******/
TableManager.prototype.href_getRows = function(getType)
{	
	var href;
	if(getType == "page")
	{
		href = this.onRetreiveCurrentPage;
		href = href_appendQueryString(href, "showRows_perPage", this.rowsPerPage);
		href = href_appendQueryString(href, "showRows_offset", (this.pages_current == 0) ? 0 : (this.pages_current-1) * this.rowsPerPage);
	}
	else if(getType == "nav")
		href = this.onRetreiveNavData;
	
	// add sort
	href = this.href_appendQueryString(href, "sortBy", this.sortBy);
	
	// add filters to url
	href = this.filterObj.generateQueryString(href);
	
	href = this.href_appendQueryString(href, "dId", rand());
	
	return href;
};


TableManager.prototype.numCols = function()
{
	return this.table.getElementsByTagName("thead")[0].getElementsByTagName("th").length;
};


TableManager.prototype.getRowIndex = function(rowUID)
{
	var rowIndex = null;
	for(var i=0; i<this.tbody.rows.length; i++)
	{
		if(this.tbody.rows[i].id == ("row_" + rowUID))
		{
			rowIndex = i;
			break;
		}
	}
	return rowIndex;
};

TableManager.prototype.getRowIndexById = function(id)
{
	var rowIndex = null;
	for(var i=0; i<this.tbody.rows.length; i++)
	{
		if(this.tbody.rows[i].id == id)
		{
			rowIndex = i;
			break;
		}
	}
	return rowIndex;
};






















/******
*
*
*  Highlight (Blink) Row Methods
*
*
******/
TableManager.prototype.highlightRow = function(rowUID)
{
	// does the row exist?
	if(this.getRowIndex(rowUID))
		this.blinkRow(rowUID);
}


TableManager.prototype.blinkRow = function(rowUID)
{
		this.blinkRow_do(rowUID, 10);
}

TableManager.prototype.blinkRow_do = function(rowUID, counter)
{
	var row = document.getElementById("row_" + rowUID);
	
	// continue blinking while counter is still positive
	if(counter-- > 0)
	{
		row.className = (row.className == row.nativeClassName) ? this.rows_colorHighlight_class : row.nativeClassName;
		var self = this;
		window.setTimeout(function() { self.blinkRow_do(rowUID, counter); }, 200);
	}
	// revert original settings when done
	else
		row.className = row.nativeClassName;
}










TableManager.prototype.updateTable = function()
{
	this.retreiveNavData();
	this.updateTable_retreiveRows();
}



	
	
	
	
	
	
	
	
	
	
	
	

/******
*
*
*  Navigation Methods
*
*
******/
TableManager.prototype.retreiveNavData = function()
{
	var iframe_nav = this.iframe_request();
	var href = this.href_getRows("nav");
	this.getFrame(iframe_nav).location.href = href;
};


/*
	updateNavigation - Called whenever the row data has potentially changed in content or order; ie, create, modify, delete 
	row, change sort order */
TableManager.prototype.updateNavigation = function(rows)
{
	this.pages_total = Math.ceil(rows.length / this.rowsPerPage);
	
	var navChange = false;
	if(this.pages_current > this.pages_total)
	{
		navChange = true;
		this.pages_current = this.pages_total;
	}
	
	// locate current page if there's a current row selected
	if(!isNaN(parseInt(this.currentRowUID)))
		for(var i=0; i<rows.length; i++)
			if(rows[i] == this.currentRowUID)
				this.pages_current = Math.ceil((i+1) / this.rowsPerPage);
	
	this.generateNavigation();
	
	// update table if there's a row waiting to be highlighted
	//if(this.pendingRowUID_highlight || navChange)
	//	this.updateTable_retreiveRows();
};


/*
	generateNavigation - called whenever we need to update what "page" of rows we're currently viewing */
TableManager.prototype.generateNavigation = function()
{	
	var navContainers = new Array(document.getElementById(this.id_nav_top), document.getElementById(this.id_nav_bottom));
	
	// h == 0 == top navigation;   h == 1 == bottom navigation
	for(var h=0; h<navContainers.length; h++)
	{
		// remove old navigation code
		this.removeAllChildren(navContainers[h]);		
		
		var div_container = document.createElement("div");
		div_container.className = (h == 0 ? this.id_nav_top : this.id_nav_bottom);
		div_container.style.paddingLeft = "10px";
		div_container.style.paddingRight = "10px";
		div_container.style.marginLeft = "1px";
		div_container.style.marginRight = "1px";
		
		// create container (old-school table)
		var table_container = document.createElement("table");
		table_container.setAttribute("cellPadding", 0);
		table_container.setAttribute("cellSpacing", 0);
		table_container.style.width = "100%";
		var row = table_container.insertRow(-1);
		var addRow_container = row.insertCell(-1);
		addRow_container.style.width = "150px";
		var nav_container = row.insertCell(-1);
		nav_container.style.textAlign = "right";
		div_container.appendChild(table_container);
		
			// build navigation block
			var div_nav = document.createElement("div");
			div_nav.style.textAlign = "right";
			//if(this.nav_container_class.length > 0)
			//	div_nav.className = this.nav_container_class;
				
			// padding
			var padding = document.createElement("span");
			padding.style.paddingRight = "8px";
			
			// previous
			var previous = document.createElement("span");
			previous.tableManager = this;
			if(this.pages_current != 1)
			{
				previous.style.cursor = "pointer";
				previous.onclick = function() { this.tableManager.updateNavigation_previous(); }
			}
			previous.className = (this.nav_normalPage_class.length > 0 ? this.nav_normalPage_class : "");
			previous.innerHTML = "«";
			div_nav.appendChild(previous);
			div_nav.appendChild(padding);
			
			// numbers
			for(var i=1; i<=this.pages_total; i++)
			{
				var number = document.createElement("span");
				number.tableManager = this;
				if(this.pages_current != i)
				{
					number.style.cursor = "pointer";
					number.onclick = function() { this.tableManager.updateNavigation_goto(this.innerHTML); }
				}
				number.className = (this.pages_current == i ? (this.nav_currentPage_class.length > 0 ? this.nav_currentPage_class : "") : (this.nav_normalPage_class.length > 0 ? this.nav_normalPage_class : ""));
				number.innerHTML = i;
				div_nav.appendChild(number);
				div_nav.appendChild(padding.cloneNode(true));
			}
			
			// next
			var next = document.createElement("span");
			next.tableManager = this;
			if(this.pages_current != this.pages_total)
			{
				next.style.cursor = "pointer";
				next.onclick = function() { this.tableManager.updateNavigation_next(); }
			}
			next.className = (this.nav_normalPage_class.length > 0 ? this.nav_normalPage_class : "");
			next.innerHTML = "»";
			div_nav.appendChild(next);
			nav_container.appendChild(div_nav);
			
			// add row code
			if(h == 0)
			{
				var div_addRow = document.createElement("div");
				//div_addRow.style.border = "1px solid red";
				div_addRow.style.textAlign = "left";
				div_addRow.innerHTML = "[Add " + this.tableLabel + "]";
				div_addRow.style.cursor = "pointer";
				div_addRow.style.fontWeight = "bold";
				
				// attach an event to the "Add Row" button
				div_addRow.tableManager = this;
				div_addRow.onclick = function() { this.tableManager.toggleRowDetails(-1); }
				
				addRow_container.appendChild(div_addRow);
			}
			
		navContainers[h].appendChild(div_container);
	}
};


TableManager.prototype.updateNavigation_previous = function()
{
	// only go on if there are more pages to continue on to
	if(this.pages_current > 1)
	{
		this.currentRowUID = null;

		this.pages_current--;
		// repopulate table with new current page
		this.updateTable_retreiveRows();
		// update navigation code
		this.generateNavigation();
	}
};


TableManager.prototype.updateNavigation_goto = function(pageNum)
{
	this.pages_current = pageNum;
	this.currentRowUID = null;
	
	// repopulate table with new current page
	this.updateTable_retreiveRows();
	// update navigation code
	this.generateNavigation();
};


TableManager.prototype.updateNavigation_next = function()
{
	// only go on if there are more pages to continue on to
	if(this.pages_current < this.pages_total)
	{
		this.currentRowUID = null;
		
		this.pages_current++;
		// repopulate table with new current page
		this.updateTable_retreiveRows();
		// update navigation code
		this.generateNavigation();
	}
};
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
/******
*
*
*  Row Generation Methods
*
*
******/	
TableManager.prototype.updateTable_retreiveRows = function()
{
	while(this.tbody.rows.length > 1)
		this.tbody.deleteRow(this.tbody.rows.length-1); 
		
	// display "loading rows" for user
	var row = document.createElement("tr");
		row.className = this.rows_color1_class;
			var td_empty = document.createElement("td");
			td_empty.style.width = "100%";
			td_empty.style.fontStyle = "italic";
			td_empty.colSpan = this.numCols();
			td_empty.appendChild(document.createTextNode("Loading rows..."));
			row.appendChild(td_empty);
		this.tbody.appendChild(row);
	
	// generate link to retreive rows page
	var href = this.href_getRows("page");
	iframeId = iframe_request();
	
	getFrame(iframeId).location.href = href;
};


TableManager.prototype.generateRows = function(rows)
{
	// this will delete the "loading rows..." message, along with any other unforseen rows
	while(this.tbody.rows.length > 0)
		this.tbody.deleteRow(this.tbody.rows.length-1); 

	// no rows
	if(rows.length == 0)
	{
		//alert('hi');
		var row = document.createElement("tr");
			row.className = eval("this.rows_color1_class");
			var td = document.createElement("td");
				td.colSpan = this.numCols();
				td.style.fontStyle = "italic";
				td.style.textAlign = "center";
				td.appendChild(document.createTextNode("Could not find any rows"));
			row.appendChild(td);
		this.tbody.appendChild(row);
	}
	else
	{
		// loop through each row
		for(i=0; i<rows.length; i++)
		{
			var row = document.createElement("tr");
			row.className = eval("this.rows_color" + ((i % 2) + 1) + "_class");
			row.nativeClassName = row.className;
			row.id = "row_" + rows[i][this.rowIndexName];
				// action column
				var td_0 = document.createElement("td");
				td_0.style.textAlign = "center";
					// create modify icon
					var img_modify = document.createElement("img");
					img_modify.tableManager = this;
					img_modify.rowUID = rows[i][this.rowIndexName];
					img_modify.src = this.imgFolder + "/icon_modify.gif";
					img_modify.border = 0;
					img_modify.onclick = function() { this.tableManager.toggleRowDetails(this.rowUID); }
					img_modify.style.cursor = "pointer";
					td_0.appendChild(img_modify);
				
					// create delete icon
					var img_delete = document.createElement("img");
					img_delete.tableManager = this;
					img_delete.rowUID = rows[i][this.rowIndexName];
					img_delete.src = this.imgFolder + "/icon_delete.gif";
					img_delete.border = 0;
					img_delete.onclick = function() { this.tableManager.deleteRow(this.rowUID); }
					img_delete.style.cursor = "pointer";
					td_0.appendChild(img_delete);
				row.appendChild(td_0);
				
				// loop through each column
				for(var j=0; j<this.cols.length; j++)
				{
					var td = document.createElement("td");
						
						td.style.cssText = this.cols[j].cssText;
						td.setAttribute("style", this.cols[j].cssText);
						if(this.cols[j].cssText.indexOf("padding") == -1)
							td.style.padding = "0px 5px 0px 5px";
						var cellContent = document.createElement("span");
						if(this.cols[j].noWrap)
							cellContent.style.whiteSpace = "nowrap";
						if(this.cols[j].doExpand)
						{
							cellContent.tableManager = this;
							cellContent.rowUID = rows[i][this.rowIndexName];
							cellContent.onclick = function() { this.tableManager.toggleRowDetails(this.rowUID); }
							cellContent.style.cursor = "pointer";
						}
						cellContent.appendChild(document.createTextNode(rows[i][this.cols[j].colName]));
					td.appendChild(cellContent);
					row.appendChild(td);
				}
				
			this.tbody.appendChild(row);
		}
	}
	// highlight row if needed
	if(this.pendingRowUID_highlight)
	{
		this.highlightRow(this.pendingRowUID_highlight);
		this.pendingRowUID_highlight = null;
	}
};





















/******
*
*
*  Row Data Management Methods
*
*
******/	
TableManager.prototype.toggleRowDetails = function(rowUID)
{	
	rowId = "row_" + rowUID + "_details_tr";
	
	// already exists?  close it down
	if(document.getElementById(rowId))					
		this.closeDetails(rowUID, false);
		
	// doesn't exist yet?  open it up
	else																					
	{	
		// a rowIndex of -1 means we're creating a new row instead of modifying an existing row; therefore, we'll insert
		// the row at the beginning
		var rowIndex = (rowUID >= 0 ? this.getRowIndex(rowUID)+1 : 0);
		var row = this.tbody.insertRow(rowIndex);
		row.id = "row_" + rowUID + "_details_tr";
			var cell = row.insertCell(-1);
			cell.style.width = "100%";
			cell.id = "row_" + rowUID + "_row_td";
			cell.colSpan = this.numCols();
			cell.setAttribute("vAlign", "top");
			cell.className = (rowIndex == 0 ? this.rows_color2_class : this.tbody.rows[rowIndex-1].nativeClassName);
				// div that will contain the iframe
				var div_details = document.createElement("div");
				var targetId = "row_" + rowUID + "_manage";					
				div_details.id = targetId;
				div_details.style.width = "100%";
				div_details.style.textAlign = "left";
				div_details.align = "left";
				div_details.style.borderBottom = "3px solid black";
				cell.appendChild(div_details);
		this.openDetails(rowUID, targetId, true);
	}
};


TableManager.prototype.openDetails = function(rowUID)
{
	if(!document.getElementById("row_" + rowUID + "_iframe"))
	{
		// construct our iframe
		var contentFrame = document.createElement("iframe");
		contentFrame.id = "row_" + rowUID + "_iframe";
		contentFrame.resizingDirection = "open";
		contentFrame.name = contentFrame.id;
		contentFrame.rowUID = rowUID;
		contentFrame.allowTransparency = true;
		contentFrame.style.width = "100%";
		contentFrame.style.height = "0px";
		contentFrame.style.display = "";
		contentFrame.style.borderWidth = "0px";
		contentFrame.frameBorder = 0;
		contentFrame.scrolling = "yes";
		
		// generate link to management page
		var href = "";
		if(rowUID > 0)
		{
			href = this.onModifyRow;
			href = href_appendQueryString(href, this.rowIndexName, rowUID);
		}
		else
			href = this.onCreateRow;
		href = href_appendQueryString(href, "dId", rand());
		
		// append iframe to the element provided
		targetObj = document.getElementById("row_" + rowUID + "_manage");
		targetObj.appendChild(contentFrame);
		
		var self = this;
		document.getElementById("row_" + rowUID + "_iframe").resizingDirection = "open";
		this.aniOpen(contentFrame.id, href, this.frameHeight, function() { self.openDetails_onDone(rowUID); });
	}
};

TableManager.prototype.openDetails_onDone = function(rowUID)
{
	document.getElementById("row_" + rowUID + "_iframe").resizingDirection = "none";
}

TableManager.prototype.closeDetails = function(rowUID, gotoRowUID)
{
	if(arguments.length == 1)
		gotoRowUID = null;
		
	var self = this;
	document.getElementById("row_" + rowUID + "_iframe").resizingDirection = "close";
	this.aniClose("row_" + rowUID + "_iframe", function() { self.closeDetails_onDone(rowUID, gotoRowUID); });
};

TableManager.prototype.closeDetails_onDone = function(rowUID, gotoRowUID)
{
	document.getElementById("row_" + rowUID + "_details_tr").parentNode.removeChild(document.getElementById("row_" + rowUID + "_details_tr"));
	if(gotoRowUID)
	{
		this.currentRowUID = gotoRowUID;
		this.pendingRowUID_highlight = gotoRowUID;
		//this.retreiveNavData();
		this.updateTable_retreiveRows();
		//this.updateNavigation();
	}
};


TableManager.prototype.deleteRow = function(rowUID)
{
	if(confirm("Are you sure you want to delete this row?"))
	{
		var iframe_delete = this.iframe_request();
		
		var href = this.onDeleteRow;
		href = href_appendQueryString(href, this.rowIndexName, rowUID);
		href = href_appendQueryString(href, "dId", rand());
		
		this.getFrame(iframe_delete).location.href = href;
	}
}

TableManager.prototype.deleteRow_onDone = function()
{
	this.currentRowUID = null;
	this.retreiveNavData();
	this.updateTable_retreiveRows();
}

















/******
*
*
*  Utility Methods
*
*
******/	
TableManager.prototype.iframe_counter = 1;
TableManager.prototype.iframe_request = function()
{
	var iframe_loader = document.createElement("iframe");
	var iframe_id = "iframe_loader_" + iframe_counter++;
	iframe_loader.id = iframe_id;
	iframe_loader.name = iframe_id;
	iframe_loader.style.left = 0;
	iframe_loader.style.top = 0;
	iframe_loader.style.border = "0px solid black";
	iframe_loader.style.width = "500px";
	iframe_loader.style.height = "300px";
	iframe_loader.style.display = "none";
	
	document.body.appendChild(iframe_loader);
	return iframe_id;
};

TableManager.prototype.getFrame = function(iframeId)
{
	return document.getElementById(iframeId).contentWindow;
};


TableManager.prototype.href_appendQueryString = function(href, varName, varValue)
{
	if(href.indexOf('?') >= 0)
		href += "&" + varName + "=" + varValue;
	else
		href += "?" + varName + "=" + varValue;
	return href;
};


TableManager.prototype.removeAllChildren = function(node)
{
	while (node.hasChildNodes())
	  node.removeChild(node.firstChild);
};


TableManager.prototype.addLoadEvent = function(func) 
{
  if(window.addEventListener)
	{
		window.addEventListener("load", func, false);
	}
	else
		window.attachEvent("onload", func);
}
