<!--
// Netscape 4 is not supported!  
// Netscape 6 and 9 have been tested.
// IE 6 has been tested.
// Opera 9 has been tested.
// FireFox 2 has been tested

// DHTML DOM interaction

// The following global variables are used for the cross browser modal
var objCBGlobalWindow = null;
var objCBGlobalReference = null;

function cbIsDefined()
{
	var lngCounter;
	for(lngCounter = 0; lngCounter < arguments.length; lngCounter++)
	{
		if (typeof(arguments[lngCounter]) == 'undefined')
		{
			return false;
		}
	}
	return true;
}

function cbIsString()
{
	var lngCounter;
	for(lngCounter = 0; lngCounter < arguments.length; lngCounter++)
	{
		if (typeof(arguments[lngCounter]) != 'string')
		{
			return false;
		}
	}
	return true;
}

function cbIsNumber()
{
	var lngCounter;
	for(lngCounter = 0; lngCounter < arguments.length; lngCounter++)
	{
		if (typeof(arguments[lngCounter]) != 'number')
		{
			return false;
		}
	}
	return true;
}

function cbTrim(strString)
{
	return strString.replace(/^\s+|\s+$/g, '');
}

function cbReturnElement(objUnknown)
{
	var objReturn;
	
	if(typeof(objUnknown) == 'object')
	{
		objReturn = objUnknown;
	}
	else if(typeof(objUnknown) == 'string')
	{
		objReturn = cbGetElementById(objUnknown);
	}
	else
	{
		objReturn = null;
	}
	
	return objReturn;
}

function cbGetElementById(strID, objDocument)
{
	var objElement;

	objDocument = (objDocument == null) ? document : objDocument;

	if(typeof(strID) == 'string')
	{
		if(objDocument.getElementById)
		{
			try
			{
				objElement = objDocument.getElementById(strID);
				if (objElement == null && objDocument.domain == 'localhost')
				{
					objElement = cbGetElementsByName(strID, objDocument);
					if(objElement.length == 1)
					{
						alert('An element name/id mismatch was detected.  The element \'' + strID + '\' has no id.');
					}
					objElement = null;
				}
			}
			catch(e)
			{
				alert('Access to element by id (' + strID + ') appears to have failed.');
				objElement = null;
			}
		}
		else if(document.all)
		{
			try
			{
				objElement = objDocument.all[strID];
			}
			catch(e)
			{
				alert('Access to element by id (' + strID + ') appears to have failed.');
				objElement = null;
			}
		}
		else
		{
			objElement = null;
		}
	}
	return objElement;
}

function cbForms(strForm, objReference)
{
	if(objReference == null)
	{
		objReference = document;
	}
	
	if(strForm == null)
	{
		return ((objReference.forms) ? objReference.forms : objReference.forms);
	}
	else
	{
		try
		{
			return ((objReference.forms[strForm]) ? objReference.forms[strForm] : objReference.forms(strForm));
		}
		catch(e)
		{
			alert('Access to the form ' + strForm + ' appears to have failed.');
			return null;
		}
	}
}

function cbFrames(strFrame, objReference)
{
	if(objReference == null)
	{
		objReference = window;
	}

	if(objReference.frames.length >= 1)
	{	
		return ((objReference.frames[strFrame]) ? objReference.frames[strFrame] : objReference.frames(strFrame));
	}
	
	return null;
}

function cbCreateElement(strTag, objDocument)
{
	if(objDocument == null)
	{
		objDocument = document;
	}
	
	if (objDocument.createElement) 
	{
		return objDocument.createElement(strTag);
	}

	return null;
}

function cbAddEvent(strID, evType, fnHandler)
{
	var objElement = cbReturnElement(strID);
	if(objElement == null)
	{
		return false;
	}

	if (objElement.addEventListener)
	{
		objElement.addEventListener(evType, fnHandler, false);
		return true;
	}
	else if (objElement.attachEvent)
	{
		return objElement.attachEvent('on' + evType, fnHandler);
	}
	else
	{
		objElement['on' + evType] = fnHandler;
		return true;
	}
}

function cbCancelEvent(objEvent)
{
	if(objEvent && objEvent.preventDefault)
	{
		objEvent.preventDefault();
	}
	
	if(objEvent && objEvent.returnValue)
	{
		objEvent.returnValue = false;
	}
	
	if(objEvent && objEvent.event && objEvent.event.preventDefault)
	{
		objEvent.event.preventDefault();
	}
	
	if(objEvent && objEvent.event && objEvent.event.returnValue)
	{
		objEvent.event.returnValue = false;
	}
}

function cbStopPropagation(objEvent)
{
	if(objEvent && objEvent.stopPropagation)
	{
		objEvent.stopPropagation();
	}
	else if(objEvent && objEvent.cancelBubble)
	{
		objEvent.cancelBubble = false;
	}
	
	if(objEvent && objEvent.event && objEvent.event.stopPropagation)
	{
		objEvent.event.stopPropagation();
	}
	else if(objEvent && objEvent.event && objEvent.cancelBubble)
	{
		objEvent.event.cancelBubble = false;
	}	
}

function cbEvent(objEvent)
{
	var objReturn = Object();

	// If this is already prepped, just return it.
	if(objReturn.generatedEvent) return objEvent;	
	
	if(typeof(objEvent) == 'undefined') objEvent = window.event;
	if(!objEvent) return;
	
	// Set our own attribute so we can check things later
	objReturn.generatedEvent = true;
	objReturn.event = objEvent;
	
	// IE only - assume the returnValue is true
	objReturn.returnValue = true;

	// Same on both
	objReturn.altKey = objEvent.altKey;
	objReturn.ctrlKey = objEvent.ctrlKey;
	objReturn.shiftKey = objEvent.shiftKey;
	objReturn.clientX = objEvent.clientX;
	objReturn.clientY = objEvent.clientY;
	objReturn.type = objEvent.type;
	objReturn.screenX = objEvent.screenX;
	objReturn.screenY = objEvent.screenY;
	objReturn.keyCode = objEvent.keyCode || objEvent.charCode || objEvent.which || 0;
	objReturn.charCode = objEvent.charCode || objEvent.keyCode || objEvent.which || 0;
	objReturn.which = objEvent.which || objEvent.keyCode || objEvent.charCode || 0;
	objReturn.target = objEvent.target || objEvent.srcElement;
	objReturn.srcElement = objEvent.srcElement || objEvent.target;

	if (objEvent.relatedTarget)
	{
		objReturn.relatedTarget = objEvent.relatedTarget;
		objReturn.fromElement = objEvent.relatedTarget;
		objReturn.toElement = objEvent.relatedTarget;
	}
	else if (objEvent.type == 'mouseover' && objEvent.fromElement)
	{
		objReturn.relatedTarget = objEvent.fromElement;
		objReturn.fromElement = objEvent.fromElement;
	}
	else if (objEvent.type == 'mouseout')
	{
		objReturn.relatedTarget = objEvent.toElement;
		objReturn.toElement = objEvent.toElement;
	}
	if(objEvent.metaKey) objReturn.metaKey = objEvent.metaKey;
	
	// 0 = none, 1 = left, 2 = right, 3 = middle
	objReturn.button = 0;
	if (objEvent.type.indexOf('click') != -1)
	{
		objReturn.button = 1;
	}
	else if (objEvent.type.indexOf('mouse') != -1)
	{
		if(objEvent.srcElement)
		{
			// objReturn is IE
			if(objEvent.button == 1 || objEvent.button == 3 || objEvent.button == 5)
			{
				objReturn.button = 1;
			}
			else if(objEvent.button == 2 || objEvent.button == 6)
			{
				objReturn.button = 2;
			}
			else if(objEvent.button == 4)
			{
				objReturn.button = 3;
			}
		}
		else
		{
			// Not IE
			if(objEvent.button == 0)
			{
				objReturn.button = 1;
			}
			else if(objEvent.button == 2)
			{
				objReturn.button = 2;
			}
			else if(objEvent.button == 1)
			{
				objReturn.button = 3;
			}
		}
	}
	
	return objReturn;
}

function cbRemoveEvent(strID, evType, fnHandler, blnCapture)
{
	var objElement = cbReturnElement(strID);
	var arrHandler;
	var lngCounter;
	
	if(blnCapture == null)
	{
		blnCapture = true;
	}
	
	if(fnHandler == null)
	{
		fnHandler = obj
	}
	
	if (objElement.removeEventListener)
	{
		objElement.removeEventListener(evType, fnHandler, blnCapture);
		return true;
	}
	else if (objElement.detachEvent)
	{
		var blnReturn = objElement.detachEvent('on' + evType, fnHandler);
		return blnReturn;
	}
}

function cbVisibility(strID, blnShow)
{
	var objElement = cbReturnElement(strID);
	
	if(objElement.style && cbIsDefined(objElement.style.visibility))
	{
		if(cbIsDefined(blnShow))
		{
			objElement.style.visibility = blnShow ? 'visible' : 'hidden';
		}
		return objElement.style.visibility;
	}
	
	return null;
}

function cbGetComputedStyle(strID, strProperty, lngDefault)
{
	var objElement = cbReturnElement(strID);
	var objStyle, lngValue, objDefaultView;
	
	if(objElement == null)
	{
		return null;
	}

	lngValue = 'undefined';
	objDefaultView = document.defaultView;
	
	if(objDefaultView && objDefaultView.getComputedStyle)
	{
		objStyle = objDefaultView.getComputedStyle(objElement, '');
		if(objStyle)
		{
			lngValue = objStyle.getPropertyValue(strProperty);
		}
	}
	else if(objElement.currentStyle)
	{
		lngValue = objElement.currentStyle[strProperty];
	}
	else
	{
		return null;
	}
	
	return lngDefault ? (parseInt(lngValue) || 0) : lngValue;
}

function cbLeft(strID, lngLeft)
{
	var objElement = cbReturnElement(strID);
	if(objElement == null)
	{
		return 0;
	}

	if(cbIsDefined(objElement.style) && cbIsString(objElement.style.left))
	{
		if(cbIsNumber(lngLeft))
		{
			objElement.style.left = lngLeft + 'px';
		}
		else
		{
			lngLeft = parseInt(objElement.style.left);
			if(isNaN(lngLeft))
			{
				lngLeft = cbGetComputedStyle(objElement, 'left', 1);
			}
			if(isNaN(lngLeft))
			{
				lngLeft = 0;
			}
		}
    }
    else if(cbIsDefined(objElement.style) && cbIsDefined(objElement.style.pixelLeft))
    {
		if(cbIsNumber(lngLeft))
		{
			objElement.style.pixelLeft = lngLeft;
		}
		else
		{
			lngLeft = objElement.style.pixelLeft;
		}
	}
	
	return lngLeft;
}

function cbTop(strID, lngTop)
{
	var objElement = cbReturnElement(strID);
	if(objElement == null)
	{
		return 0;
	}
	
	if(cbIsDefined(objElement.style) && cbIsString(objElement.style.top))
	{
		if(cbIsNumber(lngTop))
		{
			objElement.style.top = lngTop + 'px';
		}
		else
		{
			lngLeft = parseInt(objElement.style.top);
			if(isNaN(lngTop))
			{
				lngTop = cbGetComputedStyle(objElement, 'top', 1);
			}
			if(isNaN(lngTop))
			{
				lngTop = 0;
			}
		}
    }
    else if(cbIsDefined(objElement.style) && cbIsDefined(objElement.style.pixelTop))
    {
		if(cbIsNumber(lngTop))
		{
			objElement.style.pixelTop = lngTop;
		}
		else
		{
			lngTop = objElement.style.pixelTop;
		}
	}
	
	return lngTop;
}

function cbClientWidth(objWindow)
{
	if(!objWindow) objWindow = window;
	var objDocument = objWindow.document;
	
	var lngValue = 0;

	if((!objDocument.compatMode || objDocument.compatMode == 'CSS1Compat') && !window.opera && objDocument.documentElement && objDocument.documentElement.clientWidth)
	{
		lngValue = objDocument.documentElement.clientWidth;
	}
	else if(objDocument.body && objDocument.body.clientWidth)
	{
		lngValue = objDocument.body.clientWidth;
	}
	else if(cbIsDefined(objWindow.innerWidth, objWindow.innerHeight, objDocument.height)) 
	{
		lngValue = objWindow.innerWidth;
		if(objDocument.height > objWindow.innerHeight)
		{
			lngValue -= 16;
		}
	}
	
	return lngValue;
}

function cbClientHeight(objWindow)
{
	if(!objWindow) objWindow = window;
	var objDocument = objWindow.document;

	var lngValue = 0;

	if((!objDocument.compatMode || objDocument.compatMode == 'CSS1Compat') && !window.opera && objDocument.documentElement && objDocument.documentElement.clientHeight)
	{
		lngValue = objDocument.documentElement.clientHeight;
	}
	else if(objDocument.body && objDocument.body.clientHeight)
	{
		lngValue = objDocument.body.clientHeight;
	}
	else if(cbIsDefined(objWindow.innerWidth, objWindow.innerHeight, objDocument.width)) 
	{
		lngValue = objWindow.innerHeight;
		if(objDocument.width > objWindow.innerWidth)
		{
			lngValue -= 16;
		}
	}
	
	return lngValue;
}

function cbContentHeight(objDocument)
{
	if(!objDocument) objDocument = document;
	
	var lngHeight = 0;
	var lngScrollHeight;
	var lngOffsetHeight;

	if(objDocument.height)
	{
		lngHeight = objDocument.height;
	}
	else if(objDocument.body)
	{
		if(objDocument.body.scrollHeight)
		{
			lngHeight = lngScrollHeight = parseInt(objDocument.body.scrollHeight, 10);
		}
		if(objDocument.body.offsetHeight)
		{
			lngHeight = lngOffsetHeight = parseInt(objDocument.body.offsetHeight, 10);
		}

		if(lngScrollHeight && lngOffsetHeight)
		{
			lngHeight = Math.max(lngScrollHeight, lngOffsetHeight);
		}		
	
		if(lngHeight == 0 && lngHeight == null)
		{
			DeugToMenu('innerHeight = ' + objDocument.window.innerHeight);
			if(objDocument.window.innerHeight)
			{
				lngHeight = objDocument.window.innerHeight;
			}
		}
	
		if(lngHeight == 0 && lngHeight == null)
		{
			if(objDocument.compatMode == 'CSS1Compat')
			{
				objDocument.documentElement.clientHeight;
			}
		}
	
		if(lngHeight == 0 && lngHeight == null)
		{
			lngHeight = objDocument.body.clientHeight;
		}
	}

	if(lngHeight > 0) lngHeight += 50;
		
	return lngHeight;
}

function cbContentWidth(objDocument)
{
	if(!objDocument) objDocument = document;
	
	var lngWidth = 0;
	var lngScrollWidth;
	var lngOffsetWidth;

	if(objDocument.width)
	{
		lngWidth = objDocument.width;
	}
	else if(objDocument.body)
	{
		if(objDocument.body.scrollWidth)
		{
			lngWidth = lngScrollWidth = parseInt(objDocument.body.scrollWidth, 10);
		}
		if(objDocument.body.offsetWidth)
		{
			lngWidth = lngOffsetWidth = parseInt(objDocument.body.offsetWidth, 10);
		}

		if(lngScrollWidth && lngOffsetWidth)
		{
			lngWidth = Math.max(lngScrollWidth, lngOffsetWidth);
		}		
	
		if(lngWidth == 0 && lngWidth == null)
		{
			DeugToMenu('innerWidth = ' + objDocument.window.innerWidth);
			if(objDocument.window.innerWidth)
			{
				lngWidth = objDocument.window.innerWidth;
			}
		}
	
		if(lngWidth == 0 && lngWidth == null)
		{
			if(objDocument.compatMode == 'CSS1Compat')
			{
				objDocument.documentElement.clientWidth;
			}
		}
	
		if(lngWidth == 0 && lngWidth == null)
		{
			lngWidth = objDocument.body.clientWidth;
		}
	}

	if(lngWidth > 0) lngWidth += 50;	
	return lngWidth;
}

function cbWidth(strID, lngWidth)
{
	var objElement = cbReturnElement(strID);
	
	if(objElement == null)
	{
		return 0;
	}
	
	if(cbIsNumber(lngWidth))
	{
		if(lngWidth < 0)
		{
			lngWidth = 0;
		}
		else
		{
			lngWidth = Math.round(lngWidth);
		}
	}
	else
	{
		lngWidth = -1;
	}

	var blnStyle = cbIsDefined(objElement.style);
	
	if(objElement.ownerDocument == null)
	{
		lngWidth = cbClientWidth(objElement.window);
	}
	else if(objElement.tagName.toLowerCase() == 'html' || objElement.tagName.toLowerCase() == 'body')
	{
		lngWidth = cbClientWidth(objElement.ownerDocument.window);
	}
	else if(blnStyle && cbIsDefined(objElement.offsetWidth) && cbIsString(objElement.style.width))
	{
		if(lngWidth >= 0)
		{
			var lngPadLeft = 0, lngPadRight = 0, lngBorderLeft = 0, lngBorderRight = 0;
			
			if(document.compatMode == 'CSS1Compat')
			{
				lngPadLeft = cbGetComputedStyle(objElement, 'padding-left', 1);
				if(lngPadLeft != null)
				{
					lngPadRight = cbGetComputedStyle(objElement, 'padding-right', 1);
					lngBorderLeft = cbGetComputedStyle(objElement, 'border-left-width', 1);
					lngBorderRight = cbGetComputedStyle(objElement, 'border-right-width', 1);
				}
				else if(cbIsDefined(objElement.offsetWidth, objElement.style.width))
				{
					objElement.style.width = lngWidth + 'px';
					lngPadLeft = objElement.offsetWidth - lngWidth;
				}
			}
			
			lngWidth -= (lngPadLeft + lngPadRight + lngBorderLeft + lngBorderRight);
			
			if(isNaN(lngWidth) || lngWidth < 0)
			{
				return;
			}
			else
			{
				objElement.style.width = lngWidth + 'px';
			}
		}
		
		lngWidth = parseInt(objElement.style.width);
	}
	else if(blnStyle && cbIsDefined(objElement.style.pixelWidth))
	{
		if(lngWidth >= 0)
		{
			objElement.style.pixelWidth = lngWidth;
		}
		lngWidth = objElement.style.pixelWidth;
	}
	return lngWidth;
}

function cbHeight(strID, lngHeight)
{
	var objElement = cbReturnElement(strID);
	
	if(objElement == null)
	{
		return 0;
	}
	
	if(cbIsNumber(lngHeight))
	{
		if(lngHeight < 0)
		{
			lngHeight = 0;
		}
		else
		{
			lngHeight = Math.round(lngHeight);
		}
	}
	else
	{
		lngHeight = -1;
	}
	
	var blnStyle = cbIsDefined(objElement.style);
	
	if(objElement.ownerDocument == null)
	{
		lngHeight = cbClientHeight(objElement.window);
	}
	else if(objElement.tagName.toLowerCase() == 'html' || objElement.tagName.toLowerCase() == 'body') 
	{
		lngHeight = cbClientHeight(objElement.ownerDocument.window);
	}
	else if(blnStyle && cbIsDefined(objElement.offsetHeight) && cbIsString(objElement.style.height))
	{
		if(lngHeight >= 0)
		{
			var lngPadLeft = 0, lngPadRight = 0, lngBorderLeft = 0, lngBorderRight = 0;
			
			if(document.compatMode == 'CSS1Compat')
			{
				lngPadLeft = cbGetComputedStyle(objElement, 'padding-left', 1);
				if(lngPadLeft !== null)
				{
					lngPadRight = cbGetComputedStyle(objElement, 'padding-right', 1);
					lngBorderLeft = cbGetComputedStyle(objElement, 'border-left-width', 1);
					lngBorderRight = cbGetComputedStyle(objElement, 'border-right-width', 1);
				}
				else if(cbIsDefined(objElement.offsetHeight, objElement.style.height))
				{
					objElement.style.height = lngHeight + 'px';
					lngPadLeft = objElement.offsetHeight - lngHeight;
				}
			}
			
			lngHeight -= (lngPadLeft + lngPadRight + lngBorderLeft + lngBorderRight);

			if(isNaN(lngHeight) || lngHeight < 0)
			{
				return;
			}
			else
			{
				objElement.style.height = lngHeight + 'px';
			}
		}
		
		lngHeight = parseInt(objElement.style.height);
	}
	else if(blnStyle && cbIsDefined(objElement.style.pixelHeight))
	{
		if(lngHeight >= 0)
		{
			objElement.style.pixelHeight = lngHeight;
		}
		lngHeight = objElement.style.pixelHeight;
	}

	return lngHeight;
}

function cbBackground(strID, strColor, strImage)
{
	var objElement = cbReturnElement(strID);
	
	if(objElement == null)
	{
		return '';
	}
	
	var strBackground = '';
	
	if(objElement.style)
	{
		if(cbIsString(strColor))
		{
			objElement.style.backgroundColor = strColor;
		}
		if(cbIsString(strImage))
		{
			objElement.backgroundImage = (strImage != '') ? 'url(' + strImage + ')' : null;
		}
		strBackground = objElement.style.backgroundColor;
	}
	
	return strBackground;
}

function cbColor(strID, strColor)
{
	var objElement = cbReturnElement(strID);

	if(objElement == null)
	{
		return '';
	}

	var strOldColor = '';
	
	if(objElement.style && cbIsDefined(objElement.style.color))
	{
		if(cbIsString(strColor))
		{
			objElement.style.color = strColor;
		}
		strOldColor = objElement.style.color;
	}
	
	return strOldColor;
}

function cbInnerHTML(strID, strHTML)
{
	var objElement = cbReturnElement(strID);

	if(!objElement || !cbIsDefined(objElement.innerHTML))
	{
		return null;
	}

	var strString = objElement.innerHTML;

	if(cbIsDefined(strHTML))
	{
		objElement.innerHTML = strHTML;
	}
	
	return strString;
}

function cbInnerText(strID, strText)
{
	var objElement = cbReturnElement(strID);
	if(objElement == null)
	{
		return null;
	}
	
	var strString = '';

	if(objElement.innerText)
	{
		strString = objElement.innerText;
		if(cbIsString(strText))
		{
			objElement.innerText = strText;
		}
	}
	else if(objElement.textContent)
	{
		strString = objElement.textContent;
		if(cbIsString(strText))
		{
			objElement.textContent = strText;
		}
	}
	else
	{
		strString = '';
	}
	
	return strString;
}

function cbAppendChild(objParent, objChild)
{
	if(objParent.appendChild)
	{
		return objParent.appendChild(objChild);
	}
	
	return null;
}

function cbDisplay(strID, strValue)
{
	var objElement = cbReturnElement(strID);
	if(objElement != null && objElement.style && cbIsDefined(objElement.style.display))
	{
		if(cbIsString(strValue))
		{
			try
			{
				objElement.style.display = strValue;
			}
			catch(e)
			{
				objElement.style.display = '';
			}
		}
		
		return objElement.style.display;
	}
	
	return null;
}

function cbOptionAdd(objAlteredDropDown, objOption)
{
	if(objAlteredDropDown.options.add)
	{
		objAlteredDropDown.options.add(objOption);
	}
	else if(objAlteredDropDown.add)
	{
		objAlteredDropDown.add(objOption);
	}
	else if(objAlteredDropDown.appendChild)
	{
		objAlteredDropDown.appendChild(objOption);
	}
	else
	{
		objAlteredDropDown.options[objAlteredDropDown.options.length] = objOption;
	}
}

function cbOptionText(objOption, strText)
{
	var strString;
	
	if(typeof(objOption.text) == 'string')
	{
		strString = objOption.text;
		if(strText != null)
		{
			objOption.text = strText;
		}
	}
	else
	{
		strString = cbInnerText(objOption);
		if(strText != null)
		{
			cbInnerText(objOption, strText);
		}
	}
	
	return strString;
}

function cbImportNode(objSourceNode, objDestNode, blnImportChildren)
{
	// The problem is that we can't copy across documents in most browsers. 
	// So we need to use the importNode.  But that doesn't exist in IE
	// Also..  We need to import to and from the correct documents. 
	// So we passed both across.
	
	var objNew;
	var objSourceDoc = objSourceNode.ownerDocument;
	var objDestDoc = objDestNode.ownerDocument;
	
	if(typeof(objDestDoc.importNode) == 'function')
	{
		objNew = objDestDoc.importNode(objSourceNode, blnImportChildren);
	}
	else
	{
		var objChild;
		var lngCounter;

		if(objSourceNode.nodeType == 1)
		{
			objNew = cbCreateElement(objSourceNode.nodeName, objDestDoc);
			for(lngCounter = 0; lngCounter < objSourceNode.attributes.length; lngCounter++)
			{
				objNew.setAttribute(objSourceNode.attributes[lngCounter].name, objSourceNode.attributes[lngCounter].value);
			}
			objNew.style.cssText = objSourceNode.style.cssText;
		} 
		else if(objSourceNode.nodeType == 3)
		{
			objNew = objDestDoc.createTextNode(objSourceNode.nodeValue);
		}
				
		if(blnImportChildren && objSourceNode.hasChildNodes())
		{
			for(objChild = objSourceNode.firstChild; objChild; objChild = objChild.nextSibling)
			{
				objNew.appendChild(cbImportNode(objChild, objDestNode, true));
			}
		}
	}
			
	return objNew;
}

function cbGetElementsByName(strName)
{
	var arrReturn = null;
	var lngCounter;

	if(!cbIsDefined(strName) || strName == '')
	{
		return Array();
	}

	if(document.getElementsByName)
	{
		try
		{
			arrReturn = document.getElementsByName(strName);
		}
		catch(e)
		{
			alert('Access to elements by name (' + strName + ') appears to have failed.');
		}
	}
	else
	{
		if(document.all)
		{
			for(lngCounter = 0; lngCounter < document.all.length; lngCounter++)
			{
				if(document.all[lngCounter].name == strName)
				{
					arrReturn[arrReturn.length] = document.all[lngCounter];
				}
			}
		}
	}
	
	return arrReturn;
}

function cbGetElementsByTagName(strTagName, objDocument)
{
	if(objDocument == null) objDocument = window.document;
	if(strTagName == null) strTagName = '*';
	
	var arrReturn = null;

	if (objDocument.getElementsByTagName) 
	{ 
		arrReturn = objDocument.getElementsByTagName(strTagName);
		if (strTagName == '*' && (!arrReturn || !arrReturn.length))
		{
			arrReturn = objDocument.all;
		}
	}
	else 
	{ 
		if (strTagName == '*')
		{
			arrReturn = objDocument.all;
		}
		else if (objDocument.all && objDocument.all.tags)
		{
			arrReturn = objDocument.all.tags(strTagName);
		}
	}
	return arrReturn || new Array();
}

function cbGetElementsByClassName(strClassName, objDocument, strTagName, arrStarting)
{
	if(objDocument == null) objDocument = window.document;
	if(strTagName == null) strTagName = '*';
	if(arrStarting == null) arrStarting = new Array();
	
	var arrReturn = arrStarting;
	var objRegEx = new RegExp('(^|\\s)' + strClassName + '(\\s|$)');
	var lngCounter = 0;

	var arrElements = cbGetElementsByTagName(strTagName, objDocument); 
	
	for(lngCounter = 0; lngCounter < arrElements.length; lngCounter++)
	{
		if(objRegEx.test(arrElements[lngCounter].className))
		{
			arrReturn[arrReturn.length] = arrElements[lngCounter];
		}
	}
	
	return arrReturn;
}

function cbAttribute(strID, strName, strValue)
{
	var objElement = cbReturnElement(strID);
	if(objElement != null)
	{
		if(cbIsString(strName, strValue))
		{
			try
			{
				objElement.setAttribute(strName, strValue);
			}
			catch(e)
			{
				objElement.setAttribute(strName, '');
			}
		}
		
		return objElement.getAttribute(strName);
	}
	
	return null;
}

function cbSplit(strString, strDelimiter)
{
	var array = new Array();
	var strTemp = strString;
	var strValue;
	var intLocation = strTemp.indexOf(strDelimiter, 0)
	
	while (intLocation != -1)
	{
		strValue = strTemp.substring(0, intLocation);
		strTemp = strTemp.substring(intLocation + 1);
		array[array.length] = strValue;
		intLocation = strTemp.indexOf(strDelimiter, 0);
	}
	array[array.length] = strTemp;
	
	return array;
}

function cbCookie(strName, strSubKey, strValue, strExpires, strPath)
{
	if(cbIsDefined(strValue))
	{
		// Saving cookie
		var dteExpiration = new Date();
		var strTemp, strGetValue;
	
		if(!cbIsDefined(strName))
		{
			return;
		}
		
		dteExpiration.setTime(dteExpiration.getTime() + 10 * 365 * 24 * 60 * 60 * 1000);
		if(!cbIsDefined(strExpires))
		{
			strExpires = dteExpiration.toGMTString();
		}
		if(!cbIsDefined(strPath))
		{
			strPath = '/';
		}
		
		strName = strName.replace('_', '%5F');
	
		if (strSubKey == '')
		{
			strGetValue = strValue
		}
		else
		{
			strSubKey = strSubKey.replace('_', '%5F');
			strTemp = cbCookie(strName);
			strGetValue = cbCookie(strName, strSubKey);
			if (strGetValue != '')
			{
				strGetValue = strTemp.replace(strSubKey + '=' + strGetValue, strSubKey + '=' + strValue);
			}
			else
			{
				strGetValue = strTemp + (strTemp == '' ? '' : '&') + strSubKey + '=' + strValue;
			}
		}

		document.cookie = strName + '=' + strGetValue + '; expires=' + strExpires + '; path=' + strPath;
	}
	else if(cbIsString(strName))
	{
		var arrCookies = cbSplit(document.cookie, ';');
		var arrKeys;
		var strTemp, strValue = '';
		var intCounter, intCounter2;

		strName = strName.replace('_', '%5F');
	
		for (intCounter = 0; intCounter < arrCookies.length; intCounter++)
		{
			if (arrCookies[intCounter].substring(0, (strName.length + 1)) == (strName + '='))
			{
				if (cbIsString(strSubKey) && strSubKey != '')
				{
					strSubKey = strSubKey.replace('_', '%5F');
					strTemp = arrCookies[intCounter].substring(strName.length + 1);
					arrKeys = cbSplit(strTemp, '&');
					for (intCounter2 = 0; intCounter2 < arrKeys.length; intCounter2++)
					{
						if (arrKeys[intCounter2].substring(0, (strSubKey.length + 1)) == (strSubKey + '='))
						{
							strValue = cbTrim(arrKeys[intCounter2].substring(strSubKey.length + 1));
							break;
						}
					}
				}
				else
				{
					strValue = cbTrim(arrCookies[intCounter].substring(strName.length + 1));
					break;
				}
			}
		}
	
		return strValue;
	}
}

function cbDeleteCookie(strName)
{
	var dteExpiration = new Date();
	var strGetValue = cbCookie(strName);
	var strExpires, strPath = '/';
	
	dteExpiration.setTime(dteExpiration.getTime() - 10 * 365 * 24 * 60 * 60 * 1000);
	
	strExpires = dteExpiration.toGMTString();
	
	document.cookie = strName + '=' + strGetValue + '; expires=' + strExpires + '; path=' + strPath;
}

//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
// Modal Dialog Box support
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
var _lngGlobalSafety;

function cbOpenDialog(strURL, objReference, strParameters, strWindowName)
{
	if(strWindowName == null)
	{
		strWindowName = 'newWin';
	}
	
	strParameters = _cbTranslateParameters(strParameters);
	_cbOpenAllCoverUps();
	objGlobalReference = objReference;
	objGlobalWindow = window.open(strURL, strWindowName, strParameters);

	_lngGlobalSafety = 0;	
	setTimeout('_cbWaitForWindow();', 10);
}

function _cbWaitForWindow()
{
	_lngGlobalSafety++;
	
	if(_lngGlobalSafety >= 1000)
	{
		_cbCloseAllCoverUps();
		objGlobalWindow = null;
		return;
	}
	
	if(!objGlobalWindow)
	{
		setTimeout('_cbWaitForWindow();', 10);
	}
	
	objGlobalWindow.focus();
	cbAddEvent(objGlobalWindow, 'unload', _cbCloseAllCoverUps);

//	setTimeout('_cbCloseAllCoverUps();', 1000);
}

function _cbTranslateParameters(strParameters)
{
	var strOutput = strParameters;
	
	// Check to see if the parameter list is using the showModelessDialog format
	if((strOutput.indexOf(':') != -1) && (strOutput.indexOf(';') != -1))
	{
		strOutput = _cbTranslateShowModalDialogParameters(strOutput);
	}

	var arrOutput = cbSplit(strOutput, ',');
	var nWidth = 0, nHeight = 0;
	for(nLocation = 0; nLocation < arrOutput.length; nLocation++)
	{
		if(arrOutput[nLocation].toString().indexOf('width=') != -1)
		{
			//nWidth = Replace(Replace(arrOutput[nLocation], 'width=', ''), 'px', '');
			nWidth = arrOutput[nLocation].replace(/width=/g, '').replace(/px/g, '');
		}
		if(arrOutput[nLocation].toString().indexOf('height=') != -1)
		{
			//nHeight = Replace(Replace(arrOutput[nLocation], 'height=', ''), 'px', '');
			nHeight = arrOutput[nLocation].replace(/height=/g, '').replace(/px/g, '');
		}
	}	

	// center will be handled by translating it to a left and top
	if((strParameters.toString().indexOf('center=yes') != -1) || (strParameters.toString().indexOf('center:yes') != -1))
	{
		var nScreenX = cbWindowScreenX(), nScreenY = cbWindowScreenY();
		var nInnerWidth = cbViewportWidth(), nInnerHeight = cbViewportHeight();
		strOutput += ',left=' + (nScreenX + (nInnerWidth / 2) - (nWidth / 2)) + 'px';
		strOutput += ',top=' + (nScreenY + (nInnerHeight / 2) - (nHeight / 2)) + 'px';
	}

	return strOutput;
}

function _cbTranslateShowModalDialogParameters(strParameters)
{
	var nLocation, nCommaLocation;
	// First remove all spaces so that we make sure to get the correct replacements
	var strOutput = strParameters.replace(/ /g, '');
	
	// Change all : to = and ; to , 
	strOutput = strOutput.replace(/:/g, '=');
	strOutput = strOutput.replace(/;/g, ',');

	// Strip end and beginning commas so we have a known to deal with	
	if(strOutput.substring(0, 1) == ',')
	{
		strOutput = strOutput.substring(1, strOutput.length);
	}
	if(strOutput.substring(strOutput.length - 1, strOutput.length) == ',')
	{
		strOutput = strOutput.substring(0, strOutput.length - 1);
	}

	// Change all yes and on to 1 and no and off to 0
	strOutput = strOutput.replace(/1,/g, 'yes,');
	strOutput = strOutput.replace(/on,/g, 'yes,');
	strOutput = strOutput.replace(/0,/g, 'no,');
	strOutput = strOutput.replace(/off,/g, 'no,');
	
	// Change the scroll to scrollbars and height width too
	strOutput = strOutput.replace(/scroll=/g, 'scrollbars=');
	strOutput = strOutput.replace(/dialogHeight=/g, 'height=');
	strOutput = strOutput.replace(/dialogWidth=/g, 'width=');
	
	// left and right are supported but different for each browser
	if(window.screenX)
	{
		strOutput = strOutput.replace(/dialogLeft=/g, 'screenX=');
		strOutput = strOutput.replace(/dialogTop=/g, 'screenY=');
	}
	else
	{
		// Turns out this is IE...
		strOutput = strOutput.replace(/dialogLeft=/g, 'left=');
		strOutput = strOutput.replace(/dialogTop=/g, 'top=');
	}

	var arrOutput = cbSplit(strOutput, ",");
	var nWidth = 0, nHeight = 0;
	for(nLocation = 0; nLocation < arrOutput.length; nLocation++)
	{
		if(arrOutput[nLocation].toString().indexOf('width=') != -1)
		{
			//nWidth = Replace(Replace(arrOutput[nLocation], "width=", ""), "px", "");
			nWidth = arrOutput[nLocation].replace(/width=/g, '').replace(/px/g, '');
		}
		if(arrOutput[nLocation].toString().indexOf("height=") != -1)
		{
			//nHeight = Replace(Replace(arrOutput[nLocation], "height=", ""), "px", "");
			nHeight = arrOutput[nLocation].replace(/height=/g, '').replace(/px/g, '');
		}
	}	

	var arrOutput = cbSplit(strOutput, ',');
	// center, dialogHide, help, edge and unadorned are not supported and will be removed
	for (nLocation = 0; nLocation < arrOutput.length; nLocation++)
	{
		if(arrOutput[nLocation].toString().indexOf('center') != -1)
		{
			arrOutput[nLocation] = '';
		}
		if(arrOutput[nLocation].toString().indexOf('dialogHide') != -1)
		{
			arrOutput[nLocation] = '';
		}
		if(arrOutput[nLocation].toString().indexOf('help') != -1)
		{
			arrOutput[nLocation] = '';
		}
		if(arrOutput[nLocation].toString().indexOf('edge') != -1)
		{
			arrOutput[nLocation] = '';
		}
		if(arrOutput[nLocation].toString().indexOf('unadorned') != -1)
		{
			arrOutput[nLocation] = '';
		}
	}
	strOutput = strOutput.replace(',,', ',');
	if(strOutput.substring(0, 1) == ',')
	{
		strOutput = strOutput.substring(1, strOutput.length);
	}
	if(strOutput.substring(strOutput.length - 1, strOutput.length) == ',')
	{
		strOutput = strOutput.substring(0, strOutput.length - 1);
	}
	
	// showModelessDialog always turns off toolbars, locations, menubars and directories
	// Unless they are already turned on, turn them off.
	if(strParameters.indexOf('toolbar') != -1)
	{
		strOutput += ',toolbar=0';
	}
	if(strParameters.indexOf('location') != -1)
	{
		strOutput += ',location=0';
	}
	if(strParameters.indexOf('menubar') != -1)
	{
		strOutput += ',menubar=0';
	}
	if(strParameters.indexOf('directories') != -1)
	{
		strOutput += ',directories=0';
	}
		
	return strOutput;
}

function _cbOpenAllCoverUps(objEvent, arrFrames, objWindow)
{
	if(arrFrames == null) arrFrames = window.top.frames;
	if(objWindow == null) objWindow = window;
	var lngCounter;
	
	if(arrFrames.length == 0)
	{
		arrFrames = new Array();
		arrFrames[0] = window;
	}

	for(lngCounter = 0; lngCounter < arrFrames.length; lngCounter++)
	{
		_cbOpenCoverUp(objEvent, arrFrames[lngCounter], objWindow);
		if(arrFrames[lngCounter].frames.length > 0)
		{
			_cbOpenAllCoverUps(objEvent, arrFrames[lngCounter],  objWindow);
		}
	}	
}

function cbBody(objDocument)
{
	if(objDocument == null) objDocument = document;
	
	if(objDocument && objDocument.body)
	{
		return objDocument.body;
	}
	else
	{
		return cbGetElementsByTagName('BODY', objDocument)[0];
	}
}

function _cbOpenCoverUp(objEvent, objFrame, objCallerWindow)
{
	var objThisWindow = objFrame.window;
	var objThisDocument = objThisWindow.document;
	var objBody = cbBody(objThisDocument);
	var lngWidth, lngHeight;
	
	var objDiv = objThisDocument.createElement('div');
	
	if(objDiv == null) return;
	
	objDiv.id = 'divCoverUp';
	objDiv.name = 'divCoverUp';
	objDiv.style.position = 'absolute';
	
	objDiv.CallerWindow = objCallerWindow;

	objDiv.style.visibility = 'visible';
	objDiv.style.left = '0px';
	objDiv.style.top = '0px';

	lngWidth = cbContentWidth(objThisDocument);
	lngHeight = cbContentHeight(objThisDocument);
	
	if(lngWidth == 0) cbClientWidth(objThisWindow);
	if(lngHeight == 0) cbClientHeight(objThisWindow);
	
	objDiv.style.width = lngWidth + 'px';
	objDiv.style.height = lngHeight + 'px';
	
	if(navigator.userAgent.toString().indexOf("MSIE") != -1)
	{	
		objDiv.style.backgroundImage = 'none';
		objDiv.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="/images/overlay.png", sizingMethod="scale")';
		objDiv.style.width = (parseInt(objDiv.style.width, 10) + ((parseInt(objDiv.style.width, 10) / 5))) + 'px';
		objDiv.style.height = (parseInt(objDiv.style.height, 10) + ((parseInt(objDiv.style.height, 10) / 5))) + 'px';
	}
	else
	{
		objDiv.style.backgroundImage = 'url(/images/overlay.png)';
	}

	cbAddEvent(objDiv, 'focus', _cbRefocusWindow);
	cbAddEvent(objDiv, 'click', _cbRefocusWindow);	
	cbAddEvent(objThisWindow, 'scroll', _cbRefocusWindow);

	_cbHideSelectBoxes(objThisDocument);
	
	objBody.appendChild(objDiv);
}

function _cbCloseAllCoverUps(objEvent, arrFrames, objWindow)
{
	if(arrFrames == null) arrFrames = window.top.frames;
	if(objWindow == null) objWindow = window;
	
	var lngCounter;
	
	if(arrFrames.length == 0)
	{
		arrFrames = new Array();
		arrFrames[0] = window;
	}

	var objDiv = cbGetElementById('divCoverUp', arrFrames[0].window.document);
	if(objDiv && objDiv.CallerWindow.objGlobalWindow != null && !objDiv.CallerWindow.objGlobalWindow.closed)
	{
		setTimeout('_cbCloseAllCoverUps();', 1);
		return;
	}
	
	for(lngCounter = 0; lngCounter < arrFrames.length; lngCounter++)
	{
		_cbCloseCoverUp(objEvent, arrFrames[lngCounter]);
		if(arrFrames[lngCounter].frames.length > 0)
		{
			_cbCloseAllCoverUps(objEvent, arrFrames[lngCounter], objWindow);
		}
	}	
}

function _cbCloseCoverUp(objEvent, objFrame)
{
	var objThisWindow = objFrame.window;
	var objThisDocument = objThisWindow.document;
	var objBody = cbBody(objThisDocument);

	var objDiv = cbGetElementById('divCoverUp', objThisDocument);
	if(objDiv != null)
	{
		if(objDiv.CallerWindow)
		{
			if(objDiv.CallerWindow.objGlobalWindow == null || objDiv.CallerWindow.objGlobalWindow.closed)
			{
				cbRemoveEvent(objDiv, 'focus', _cbRefocusWindow, false)
				cbRemoveEvent(objDiv, 'click', _cbRefocusWindow, false)
				cbRemoveEvent(objThisWindow, 'scroll', _cbRefocusWindow, false);
				objBody.removeChild(objDiv);
				_cbShowSelectBoxes(objThisDocument);
			}
		}
	}
}

function _cbRefocusWindow(objEvent)
{
	objEvent = cbEvent(objEvent);
	
	if(objEvent.target && objEvent.target.CallerWindow)
	{
		if(objEvent.target.CallerWindow.objGlobalWindow != null)
		{
			if(!objEvent.target.CallerWindow.objGlobalWindow.closed)
			{
				objEvent.target.CallerWindow.objGlobalWindow.focus();
			}
		}
	}
}

function _cbHideSelectBoxes(objDocument)
{
	if(navigator.userAgent.indexOf('MSIE') != -1)
	{
		var arrSelects = cbGetElementsByTagName('SELECT', objDocument);
		for(var i = 0; i < arrSelects.length; i++)
		{
			arrSelects[i].setAttribute('PreviousVis', cbVisibility(arrSelects[i]));
			cbVisibility(arrSelects[i], false);
		}
	}
}

function _cbShowSelectBoxes(objDocument)
{
	if(navigator.userAgent.indexOf('MSIE') != -1)
	{
		var arrSelects = cbGetElementsByTagName('SELECT', objDocument);
		for(var i = 0; i < arrSelects.length; i++)
		{
			if(arrSelects[i].getAttribute('PreviousVis') != '')
			{
				cbVisibility(arrSelects[i], arrSelects[i].getAttribute('PreviousVis'));
			}
			else
			{
				cbVisibility(arrSelects[i], true);
			}
		}
	}
}

function cbViewportHeight()
{
	if (window.top.innerHeight != window.undefined) return window.top.innerHeight;
	if (top.document.compatMode	== 'CSS1Compat') return top.document.documentElement.clientHeight;
	if (top.document.body) return top.document.body.clientHeight; 
	return window.undefined; 
}

function cbViewportWidth()
{
	if (window.top.innerWidth != window.undefined) return window.top.innerWidth;
	if (top.document.compatMode == 'CSS1Compat') return top.document.documentElement.clientWidth; 
	if (top.document.body) return top.document.body.clientWidth; 
	return window.undefined; 
}

function cbVScrollPos()
{
	var scTop = 0;
	if(document.body && (document.body.scrollLeft || document.body.scrollTop))
	{
		scTop = document.body.scrollTop;
	}
	else if(cbIsNumber(window.pageYOffset))
	{
		scTop = window.pageYOffset;
	}
	else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop))
	{
		scTop = document.documentElement.scrollTop;
	}
	
	return scTop;
}

function cbHScrollPos()
{
	var scLeft = 0;
	if(document.body && (document.body.scrollLeft || document.body.scrollTop))
	{
		scLeft = document.body.scrollLeft;
	}
	else if(cbIsNumber(window.pageYOffset))
	{
		scLeft = window.pageXOffset;
	}
	else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop))
	{
		scLeft = document.documentElement.scrollLeft;
	}
	
	return scLeft;
}

function cbWindowScreenX()
{
	if(window.screenLeft) return window.screenLeft; else return window.screenX;
}

function cbWindowScreenY()
{
	if(window.screenTop) return window.screenTop; else return window.screenY;
}

function cbLocation(objElement, strVal)
{
	var strReturn;
	
	if(objElement && objElement.location)
	{
		strReturn = objElement.location.href;
	}
	else if(objElement && objElement.contentDocument)
	{
		strReturn = objElement.contentDocument.location.href;
	}

	if(cbIsDefined(strVal))
	{
		if(objElement && objElement.location)
		{
			objElement.location.href = strVal;
		}
		else if(objElement && objElement.contentDocument)
		{
			objElement.contentDocument.location.href = strVal;
		}
	}
	
	return strReturn;
}

function cbParent(strID, bNode)
{
	var objElement = cbReturnElement(strID);
	
	if(objElement != null)
	{
		if(cbIsDefined(objElement.parentNode))
		{
			return objElement.parentNode;
		}
		else if(cbIsDefined(objElement.parentElement))
		{
			return objElement.parentElement;
		}
	}

	return null;
}

function cbReplace(strString, strFindString, strReplaceString, lngStarting)
{
	if(lngStarting == null)
	{
		lngStarting = 0;
	}
	
	var strTemp = strString;
	var intLocation = strTemp.indexOf(strFindString, lngStarting);
	var intLength = strFindString.length;
	var intReplaceLength = strReplaceString.length;

	while (intLocation != -1)
	{
		strTemp = strTemp.substring(0, intLocation) + strReplaceString + strTemp.substr(intLocation + intLength);
		intLocation = strTemp.indexOf(strFindString, (intLocation + intReplaceLength));
	}
	
	return strTemp;
}

function cbChildren(strID)
{
	var objElement = cbReturnElement(strID);
	var arrTemp = new Array();
	var arrTemp2;
	var lngCounter;
	var lngCounter2;

	for(lngCounter = 0; lngCounter < objElement.childNodes.length; lngCounter++)
	{
		arrTemp2 = _cbChildren(objElement.childNodes[lngCounter]);
		
		for(lngCounter2 = 0; lngCounter2 < arrTemp2.length; lngCounter2++)
		{
			arrTemp.push(arrTemp2[lngCounter2]);
		}
	}
	
	return arrTemp;
}

function _cbChildren(strID)
{
	var objElement = cbReturnElement(strID);
	var arrTemp = new Array();
	var lngCounter;
	var lngCounter2;
	
	arrTemp.push(objElement);
		
	for(lngCounter = 0; lngCounter < objElement.childNodes.length; lngCounter++)
	{
		arrTemp2 = _cbChildren(objElement.childNodes[lngCounter]);
		
		for(lngCounter2 = 0; lngCounter2 < arrTemp2.length; lngCounter2++)
		{
			arrTemp.push(arrTemp2[lngCounter2]);
		}
	}
	
	return arrTemp;
}
//-->