/* Blue River Digital API - Element **********************************
 *	
 *	This API contains all the functions needed to manipulate DOM
 *	elements using ID.
 *
 *********************************************************************/

/* Get Element * *******************************************************
 *
 *	TAKES:		Element ID Name
 * 	RETURNS:	The object associated with the given elment id name
 *
 *************************************************************************/
 
	function getElement(elementId)
	{
	   	 return document.getElementById(elementId);
	}

/* Get Value * *******************************************************
 *
 *	TAKES:		Element ID Name
 * 	RETURNS:	The value associated with the given elment id name
 *
 *************************************************************************/
 
	function getValue(elementId)
	{
		var thisElement 		= getElement(elementId);
		var thisElementValue 	= null;
		
		if (thisElement)
		{
		    switch(thisElement.getTagName)
		    {
		        case "select":
		            
		            thisElementValue = thisElement.options[thisElement.selectedValue].value;    
		            break;
		            
		        default:    
		        
		            thisElementValue = thisElement.value;
		            break;
		    }
		}
		
		return thisElementValue;
		
	}
	
/* Get InnerHTML * *******************************************************
 *
 *	TAKES:		Element ID Name
 * 	RETURNS:	The innerHTML value associated with the given elment id name
 *
 *************************************************************************/
 
	function getInnerHTML(elementId)
	{
		var thisElement 		= getElement(elementId);
		var thisElementValue 	= null;
		
		if (thisElement)
		{
		    thisElementValue = Trim(thisElement.innerHTML);
		}
		
		return thisElementValue;
		
	}


/*  Iterate Element List  ********************************************************
 *
 *	TAKES:		Element List, Iterate Action Function
 * 	RETURNS:	NOTHING
 *	NOTE:		The Element List produces an iterator object with two values:
 *					1. element	[0]
 *					2. index 	[1]
 *					
 *				The Iterate Action Function must provide a definition for these values:
 *					EX: function(element, index)
 *
 *	EX CALL:	iterateElementList(exampleList, exampleFunc);
 *
 ********************************************************************************/
 
 	function iterateElementList(elementList, iterateAction)
	{
		if ((elementList != null) & (iterateAction != null))
		{
			if (thisBrowser != "Firefox")
			{
				// Manual Iteration ************************
				if (elementList.length > 0)
				{
					var element = "";
					
					for(var index=0; index<elementList.length; index++)
					{
						element = elementList[index];
						iterateAction(element, index);
					}
				}
				
			}
			else
			{
				// Javascript 1.7 Support ******************
				var iterator = Iterator(elementList);
				
				try
				{
					while(true)
					{
						var iteratorElement = iterator.next();
						var index 	= iteratorElement[0];
						var element = iteratorElement[1];
						
						iterateAction(element, index);
					}
				}
				catch (err)
				{
					if (!err instanceof StopIteration)
					{
						alert("ERROR: Iterate Element List\n\n" + err.description);	
					}
					else
					{
						// Iteration Complete
					}
				}
				
			} // IE
		}
	}
	
/* Get Checked Value * *******************************************************
 *
 *	TAKES:		Checkbox Element ID Name
 * 	RETURNS:	The value associated with the given elment id name if it is checked.
 *
 *************************************************************************/
 
	function getCheckedValue(elementId)
	{
		var thisElement 		= getElement(elementId);
		var thisElementValue 	= null;
		
		if (thisElement)
		{
			if ((thisElement.getAttribute("type") == "checkbox") & (thisElement.checked))
			{
				thisElementValue = thisElement.value;
			}
		}
		return thisElementValue;
	}
	
/* Get Checked Values * *******************************************************
 *
 *	TAKES:		Checkbox Element Group Name
 * 	RETURNS:	Comma separated values associated with the given elment group name if it is checked.
 *
 *************************************************************************/
 
	function getCheckedValues(elementGroupName)
	{
		var checkboxElements 	= document.getElementsByTagName("input");
		var elementValues 		= "";
		var temp = "";
		
		var iterateAction = function(checkboxElement, ctr)
		{
			if (checkboxElement.name == elementGroupName)
			{
				if ((checkboxElement.getAttribute("type") == "checkbox") & (checkboxElement.checked))
				{
					if (elementValues != "")
					{
						elementValues += ", "; 	
					}
					
					elementValues += checkboxElement.value;
				}
			} // Check Name
		}
		
		iterateElementList(checkboxElements, iterateAction);
		
		return elementValues;
	}

	
/*  Check Checkbox Limit  * *******************************************************
 *
 *	TAKES:		Checkbox Element, Checkbox Name, max number of checkboxes
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
 	function checkCheckboxLimitChoice(checkboxElement, maxNum)
	{
		if (checkboxElement)
		{
			var checkboxArray	= checkboxElement.id.split(".");
			var checkboxName 	=  checkboxArray[0];
			var checkboxValues 	= getCheckedValues(checkboxName);
			var valueArray 		= checkboxValues.split(", ");
			
			if (valueArray.length > maxNum)
			{
				if (checkboxElement.id.indexOf("LabelText") > 0)
				{
					checkboxElement = getElement(checkboxElement.id.replace(".LabelText", ""));
				}
				
				checkboxElement.checked = false;
			}
		}
	}
	
	
/* Get Radio Value By Group Tag* *******************************************************
 *
 *	TAKES:		Uses a regular expression to collect the radio buttons based on their
 *				similar Id values.
 * 	RETURNS:	The value associated with the checked radio button.
 *
 *************************************************************************/
 
 	function getRadioValueByGroupTag(idTag)
	{
		var radioElements = getTagGroup("input", idTag);
		var checkedValue = "";
		var temp = "idTag: " + idTag + "\n";
		
		var iterateAction = function(radioElement, ctr)
		{
			temp += radioElement.value + "\n";
			if (radioElement.checked)
			{
				checkedValue = radioElement.value;
			}
		}
		
		iterateElementList(radioElements, iterateAction);
		alert(temp);
		return checkedValue;
	}
	
/* Get Radio Value * *******************************************************
 *
 *	TAKES:		Common radio name attribute that groups the radio buttons together
 * 	RETURNS:	The value associated with the checked radio button.
 *
 *************************************************************************/
 
 	function getRadioValue(radioElementsName)
	{
	    var checkedValue = "";

	    $("input").each(function (index) {
	        if ($(this).attr("id").indexOf(radioElementsName + ".") != -1) {

	            if (this.checked) {
	                checkedValue = $(this).val();
	            }
	           
	        }
	    });

	    //alert(checkedValue);

	    return checkedValue;
        
        /*var radioElements = document.getElementsByName(radioElementsName)
		
		var iterateAction = function(radioElement, ctr)
		{
			if (radioElement.checked)
			{
				checkedValue = radioElement.value;
			}
		}
		
		iterateElementList(radioElements, iterateAction); 
		
		return checkedValue;
        */
	}

/* Get Checked Group Value * *******************************************************
 *
 *	TAKES:		Element List
 * 	RETURNS:	Comma Separated string containing all the checked values
 *
 *************************************************************************/
 
	function getCheckedGroupValue(elementList)
	{
		var groupValue = null;
		
		var iterateAction = function(element, ctr)
		{
			var thisValue = getCheckedValue(element.id);
			
			if (thisValue != null)
			{
				if (groupValue != null)
				{
					groupValue += "," + thisValue; 	
				}
				else
				{
					groupValue = thisValue;
				}
			}
		}
		
		iterateElementList(elementList, iterateAction);
		
		return groupValue;
	}
	
/*  Hide Element * *******************************************************
 *
 *	TAKES:		Element ID
 * 	RETURNS:	Sets the display of the element object to "none" which
 *				has the effect of hidding the object.
 *
 *************************************************************************/
	
	function hideElement(elementId)
	{
		var thisElement = getElement(elementId);
	    
	    if (thisElement)
	    {
		   thisElement.style.display = "none";
	    }
	}
	
	
/*  Show Element * *******************************************************
 *
 *	TAKES:		Element ID
 * 	RETURNS:	Sets the display of the element object to "block" which
 *				has the effect of making the object visable.
 *
 *************************************************************************/
	
	function showElement(elementId)
	{
	    var thisElement = getElement(elementId);
	    
	    if (thisElement)
	    {
		    thisElement.style.display = "block";
	    }
	}
	
/*  Disable Element * *******************************************************
 *
 *	TAKES:		Element ID Name
 * 	RETURNS:	Sets the disable of the element object to "true" which
 *				has the effect of disabling the object.
 *
 *************************************************************************/
	
	function disableElement(elementId)
	{
		var thisElement = getElement(elementId);
	    
	    if (thisElement)
	    {
		    thisElement.disabled = true;
	    }
	}
	
	
/*  Enable Element * *******************************************************
 *
 *	TAKES:		Element ID Name
 * 	RETURNS:	Sets the disable of the element object to "false" which
 *				has the effect of enabling the object.
 *
 *************************************************************************/
	
	function enableElement(elementId)
	{
		var thisElement = getElement(elementId);
	    
	    if (thisElement)
	    {
		    thisElement.disabled = false;
	    }
	}
	
/*  Is Visable * *******************************************************
 *
 *	TAKES:		Element ID Name
 * 	RETURNS:	True if the element is visable, false if it is not
 *
 *************************************************************************/
	
	function isVisible(elementId)
	{
	    var thisElement = getElement(elementId);
	    
	    if (thisElement)
	    {
		    if (thisElement.style.display == "none")
		    {
			    return false;	
		    }
		    else
		    {
			    return true;	
		    }
	    }
        
        return false;
	}

 /* Contains  Point * *******************************************************
 *
 *	TAKES:		Element, Point X, Point Y
 * 	RETURNS:	True if the Element contains the Point
 *	NOTES:		
 *
 *************************************************************************/
 
 	function containsPoint(element, xValue, yValue)
	{
		var objectUpperLeft 	= new Array(getElementX(element), getElementY(element));
		var objectUpperRight	= new Array(getElementX(element) + getWidth(element), getElementY(element));
		var objectLowerLeft		= new Array(getElementX(element), getElementY(element) + getHeight(element));
		var objectLowerRight	= new Array(getElementX(element) + getWidth(element), getElementY(element) + getHeight(element));
		
		/*var temp = "objectUpperLeft: (" + objectUpperLeft[0] + ", " + objectUpperLeft[1] + ")\n";
		temp += "objectUpperRight: (" + objectUpperRight[0] + ", " + objectUpperRight[1] + ")\n";
		temp += "objectLowerLeft: (" + objectLowerLeft[0] + ", " + objectLowerLeft[1] + ")\n";
		temp += "objectLowerRight: (" + objectLowerRight[0] + ", " + objectLowerRight[1] + ")\n\n";
		temp += "Point: (" + xValue + ", " + yValue + ")\n";
		*/
		//alert(temp);
		
		if ((xValue > objectUpperLeft[0]) & (yValue > objectUpperLeft[1]) &
			(xValue < objectUpperRight[0]) & (yValue > objectUpperLeft[1]) &
			(xValue > objectLowerLeft[0]) & (yValue < objectLowerLeft[1]) &
			(xValue < objectLowerRight[0]) & (yValue < objectLowerRight[1]))
		{
			
			return true;	
		}
		else
		{
			
			return false;	
		}
	}
	
 /* Contains  Mouse Point * *******************************************************
 *
 *	TAKES:		Element
 * 	RETURNS:	True if the Element contains the Mouse Point
 *	NOTES:		- Requires that the "getMousePosition" function be set to the
 *				"onmousemove" event trigger.
 *				- This function will often be used in conjunciton with the 
 *				"onmouseout" event, which seems to fire on the last pixel of the
 *				element, so that the mouse cursor is actually technically inside
 *				the element when this event fires (along the left and bottom edges).
 *				As a result this function accounts for this 1 pixel discrepancy when
 *				the mouse cursor is exiting the element along the left and bottom
 *				edges.
 *
 *************************************************************************/
 
 	function containsMousePoint(element)
	{
		var mouseOffsetX		= 0;
		var mouseOffsetY		= 0;
		var elementUpperLeft 	= new Array(getElementX(element), getElementY(element));
		
		if (mousePositionX > elementUpperLeft[0])
		{
			mouseOffsetX = 1
		}
		
		if (mousePositionY > elementUpperLeft[0])
		{
			mouseOffsetY = 1
		}
		
		return containsPoint(element, mousePositionX + mouseOffsetX, mousePositionY + mouseOffsetY);
	}
	
	
/*  Get Width ********************************************************
 *
 *	TAKES:		Element Object
 * 	RETURNS:	The Width of the element object.
 *
 *************************************************************************/	

	function getWidth(element)
	{
		return element.offsetWidth;
	}
	
	
/*  Get Height * *******************************************************
 *
 *	TAKES:		Element Object
 * 	RETURNS:	The Height of the element object.
 *
 *************************************************************************/
 
	function getHeight(element)
	{
		return element.offsetHeight;
	}
	

/*  Get Element Position X * *******************************************************
 *
 *	TAKES:		Element Object
 * 	RETURNS:	The X position of the element object
 *
 *************************************************************************/
	
	function getElementX(contentElement)
	{
		var iReturnValue = 0;
		while(contentElement != null)
		{
			iReturnValue += contentElement.offsetLeft;
			contentElement = contentElement.offsetParent;
		}
		
		return iReturnValue;
	}
	

/*  Get Element Position Y * *******************************************************
 *
 *	TAKES:		Element Object
 * 	RETURNS:	The Y position of the element object
 *
 *************************************************************************/
	
	function getElementY(contentElement)
	{
		var iReturnValue = 0;
		while(contentElement != null)
		{
			iReturnValue += contentElement.offsetTop;
			contentElement = contentElement.offsetParent;
		}
		
		return iReturnValue;

	}

/*  Get Position X * *******************************************************
 *
 *	TAKES:		Element Object
 * 	RETURNS:	The X position of the center of the webpage based on the width
 *				of the element object
 *	NOTE:		This function is based on a standard website width space of 818px,
 *				and calculates the center position of the element object within that
 *				space.  This eliminates the abiguity of various monitor sizes,
 *				resolutions, and aspect ratios.
 *
 *************************************************************************/
	
	function getPosX(contentElement)
	{
		var posX;
		
		posX = getWindowWidth()/ 2;  					// Center with window
		posX = posX - getWidth(contentElement)/2;		// Center based on Element width
		
		return posX + "px";	
	}
	

/*  Get Position Y * *******************************************************
 *
 *	TAKES:		NOTHING
 * 	RETURNS:	The value of the scroll offset plus 100px
 *	NOTE:		Used for postioning elements 100px below the top of the page
 *
 *************************************************************************/

	function getPosY()
	{
		return getPageYOffset() + 100 + "px";
	}


/*  Set Position X * *******************************************************
 *
 *	TAKES:		Element Object, X position value
 * 	RETURNS:	NOTHING, changes the X position of the element object.
 *
 *************************************************************************/
 
	function setPosX(element, posXValue)
	{
	    
			element.style.left = posXValue + "px";
	   
	}
	
	
/*  Set Position Y * *******************************************************
 *
 *	TAKES:		Element Object, Y position value
 * 	RETURNS:	NOTHING, changes the Y position of the element object.
 *
 *************************************************************************/
	
	function setPosY(element, posYValue)
	{
	    
			element.style.top	= posYValue + "px";	
	 
	}


/*  Set Background Color * *******************************************************
 *
 *	TAKES:		Element Id, color code value (e.g. #000000)
 * 	RETURNS:	NOTHING, sets the background color of the element object to the
 *				given color value.
 *
 *************************************************************************/
 
	function setBackgroundColor(elementId, colorValue)
	{
	    if (elementId != "")
	    {
		    getElement(elementId).style.backgroundColor = colorValue;
	    }
	}
	
	
/*  Fade Out Element * *******************************************************
 *
 *	TAKES:		Element Object, Starting Fade Opacity Value, Fade Rate value between 1 and 100
 * 	RETURNS:	NOTHING
 *	NOTE:		Fades the element object at the rade rate specified.
 *
 *************************************************************************/
	
	function fadeOutElement(fadeElementId, fadeOpacity, fadeRate)
	{
		fadeOpacity = fadeOpacity - fadeRate;
		
		if (fadeOpacity < 0) { fadeOpacity = 0; }
		
		setOpacity(fadeElementId, fadeOpacity)
		
		if (fadeOpacity > 0)
		{
			setTimeout("fadeOutElement('" + fadeElementId + "', " + fadeOpacity + ", " + fadeRate + ")", 10);
		}
		
	}
	
/*  Fade Out Element Callback * *******************************************************
 *
 *	TAKES:		Element Object, Starting Fade Opacity Value, Fade Rate value between 1 and 100
 * 	RETURNS:	NOTHING
 *	NOTE:		Fades the element object at the rade rate specified.
 *
 *************************************************************************/
	
	function fadeOutElementCallback(fadeElementId, fadeOpacity, fadeRate, callback)
	{
		fadeOpacity = fadeOpacity - fadeRate;
		
		if (fadeOpacity < 0) { fadeOpacity = 0; }
		
		setOpacity(fadeElementId, fadeOpacity)
		
		if (fadeOpacity > 0)
		{
			setTimeout("fadeOutElementCallback('" + fadeElementId + "', " + fadeOpacity + ", " + fadeRate + ", '" + callback + "')", 10);
		}
		else
		{
			eval(callback);
		}
		
	}
	
/*  Fade Element * *******************************************************
 *
 *	TAKES:		Element Object, Starting Fade Opacity Value, Fade Rate value between 1 and 100
 * 	RETURNS:	NOTHING
 *	NOTE:		Fades the element object at the rade rate specified.
 *
 *************************************************************************/
	
	function fadeInElement(fadeElementId, fadeOpacity, fadeRate)
	{
		fadeOpacity = fadeOpacity + fadeRate;
		
		if (fadeOpacity > 100) { fadeOpacity = 100; }
		
		setOpacity(fadeElementId, fadeOpacity)
		
		if (fadeOpacity < 100)
		{
			setTimeout("fadeInElement('" + fadeElementId + "', " + fadeOpacity + ", " + fadeRate + ")", 50);
		}
		
	}


/*  Set Focus * *******************************************************
 *
 *	TAKES:		Element Object Id
 * 	RETURNS:	NOTHING
 *	NOTE:		Sets the focus of the element that corresponds to the 
 *				element object Id.
 *
 *************************************************************************/
 
	function setFocus(elementId)
	{
		if (elementId != "")
		{
			document.getElementById(elementId).focus();
		}
	}
	
	
/*  Set Opacity * *******************************************************
 *
 *	TAKES:		Element Object Id
 * 	RETURNS:	NOTHING
 *	NOTE:		Sets the opacity of the element
 *
 *************************************************************************/
 
	function setOpacity(elementId, opacityValue)
	{
		if (elementId != "")
		{
			var fadeElement = getElement(elementId);
			
			fadeElement.style.filter = "alpha(opacity=" + opacityValue + ");"; // IE
			fadeElement.style.zoom = "1";
			fadeElement.style.MozOpacity = opacityValue/100; // FireFox
			fadeElement.style.opacity = opacityValue/100; // CSS Standard
			
		}
	}
	
	
/*  Get Opacity * *******************************************************
 *
 *	TAKES:		Element Object Id
 * 	RETURNS:	NOTHING
 *	NOTE:		Sets the opacity of the element
 *
 *************************************************************************/
 
	function getOpacity(elementId)
	{
		if (elementId != "")
		{
			var fadeElement = getElement(elementId);
			var opacityValue = 0;
			
			if (IE)
			{
				// Internet Explorer
				opacityValue = fadeElement.style.filter.replace("alpha(opacity=", "");
				opacityValue = opacityValue.replace(");", "");
			}
			else
			{
				// Mozilla, Firefox, Safari
				opacityValue = fadeElement.style.MozOpacity * 100;
			}
			
			return opacityValue;
		}
	}
	
	
/*  Get Tag Group * *******************************************************
 *
 *	TAKES:		Element tag, regular expression that describes the id pattern
 *				of the  group of tag elements you're looking for.
 * 	RETURNS:	Element Array of matched element tag ids with the provided regular
 *				expression.
 *	NOTE:		Uses concat to load the element array
 *
 *************************************************************************/
	
	function getTagGroup(elementTag, regExp)
	{
		var tagArray = document.getElementsByTagName(elementTag);
		var elementArray = new Array();
		
		for(var ctr=0; ctr < tagArray.length; ctr++)
		{
			if ((tagArray[ctr].id).search(regExp) != -1)
			{
				if (elementArray.length > 0)
				{
					elementArray = elementArray.concat(new Array(tagArray[ctr]));
				}
				else
				{
					elementArray = new Array(tagArray[ctr]);
				}
			}
		}
		
		return elementArray;
	}
	
/*  Apply To Tag Group * *******************************************************
 *
 *	TAKES:		Element tag, regular expression that describes the id pattern
 *				of the  group of tag elements you're looking for, Javascript function
 *				that will be called on all elements found.
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
	
	function applyToTagGroup(elementTag, regExp, applyFunction)
	{
		var tagArray = document.getElementsByTagName(elementTag);
		var tagElement = "";
		
		if (tagArray.length > 0)
		{
			for(var ctr=0; ctr < tagArray.length; ctr++)
			{
				tagElement = tagElements[ctr];
				
				if ((tagElement.id).search(regExp) != -1)
				{
					applyFunction(tagElement);
				}
			}
		}
	}
	
/*  Get Elements By Attribute * *******************************************************
 *
 *	TAKES:		Attribute Name
 * 	RETURNS:	Element Array of matched elements with the given attribute
 *
 *************************************************************************/
	
	function getElementsByAttribute(attributeName)
	{
		var allElements 	= document.getElementsByTagName("*")	
		var thisElement 	= "";
		var thisAttribute	= "";
		var elementArray 	= new Array();
		
		if (attributeName != "")
		{
			if (allElements.length > 0 )
			{
				for(var ctr=0; ctr<allElements.length; ctr++)
				{
					thisElement = allElements[ctr];
					thisAttribute = thisElement.getAttributeNode(attributeName);
					
					if (thisAttribute)
					{
						if (elementArray.length > 0)
						{
							elementArray = elementArray.concat(new Array(thisElement));
						}
						else
						{
							elementArray = new Array(thisElement);
						}
					}
				}
			}
		}
		
		return elementArray;
	}
	
/*  Toggle Element * *******************************************************
 *
 *	TAKES:		Toggle Id
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
	function toggleElement(toggleId)
	{
		var toggleThisElement = getElement(toggleId);
		
		if (toggleThisElement)
		{
			if (isVisible(toggleId))
			{
				hideElement(toggleId);
			}
			else
			{
				showElement(toggleId);
			}
		}
	}
	
/*  Toggle Checkbox Element * *******************************************************
 *
 *	TAKES:		Toggle Id
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
	function toggleCheckboxElement(toggleId)
	{
		var toggleThisElement = getElement(toggleId);
		
		if (toggleThisElement)
		{
			if (toggleThisElement.checked)
			{
				toggleThisElement.checked = false;
			}
			else
			{
				toggleThisElement.checked = true;
			}
		}
		
	}
	
/*  Toggle Radio Element * *******************************************************
 *
 *	TAKES:		Toggle Id
 * 	RETURNS:	NOTHING
 *
 *************************************************************************/
 
	function toggleRadioElement(toggleId)
	{
		var toggleThisElement = getElement(toggleId);
		
		if (toggleThisElement)
		{
			var radioElements = getTagGroup("input", toggleId.split(".")[0]);
			
			var iterateAction = function(radioElement, ctr)
			{
				if (radioElement.id == toggleThisElement.id)
				{
					radioElement.checked = true;	
				}
				else
				{
					radioElement.checked = false;	
				}
				
			}
			
			iterateElementList(radioElements, iterateAction);
			
		}
		
	}
	
/*  Remove All Children * *******************************************************
 *
 *	TAKES:		Parent Node Element
 * 	RETURNS:	NOTHING
 *	NOTE:		Removes all the child nodes within the Parent Node Element
 *
 *************************************************************************/
	
	function removeAllChildren(parentNode)
	{
		if (parentNode)
		{
			while(parentNode.firstChild)
			{
				parentNode.removeChild(parentNode.firstChild);	
			}
		}
	}
	
/*  Remove All Table Rows * *******************************************************
 *
 *	TAKES:		Table Element
 * 	RETURNS:	NOTHING
 *	NOTE:		Removes all the rows within the Table Element
 *
 *************************************************************************/
	
	function removeAllTableRows(tableElement)
	{
		if (tableElement)
		{
			while(tableElement.rows.length > 0)
			{
				tableElement.deleteRow(0);	
			}
		}
	}

/*  Create Table * *******************************************************
 *
 *	TAKES:		Number of Rows, Number of Columns
 * 	RETURNS:	Empty table structure with specified number of columns and
 *				rows.
 *	NOTE:		
 *
 *************************************************************************/
	
	function createTable(numRows, numColumns)
	{
		var newTable			= document.createElement("table");
		var newTableBody 		= document.createElement("tbody");
		
		newTable.cellPadding = "0";
		newTable.cellSpacing = "0";
		newTable.width = "100%";
		
		
		for(var ctrRow=0; ctrRow<numRows; ctrRow++)
		{
			var newRow = document.createElement("tr");
		
			for(var ctrCol=0; ctrCol<numColumns; ctrCol++)
			{
				var newCell = document.createElement("td");
				newRow.appendChild(newCell);
			}
			
			newTableBody.appendChild(newRow);
		}
		
		newTable.appendChild(newTableBody);
		
		return newTable;
	}
