	/*//---------------------------------------------*/
	/*// Name: Site - Global Scripts				 */
	/*// Language: JavaScript						 */
	/*//---------------------------------------------*/


	/*//---------------------------------------------*/
	/*// Name: InitializeGlobal()					 */
	/*// Desc: Entry Point for Onload Event			 */
	/*//---------------------------------------------*/
	function InitializeGlobal()
	{
		if ( ( InitializeGlobal.arguments ) && ( InitializeGlobal.arguments.length == 2 ) )
		{
			secureSiteRoot = InitializeGlobal.arguments[0]+"/";
			resourceRoot += InitializeGlobal.arguments[1]+"/";
		}

		if ( typeof( InitializeSite ) == "function" )
			InitializeSite();

		SetExternalLinkTargets();

		if ( typeof( InitializeLocal ) == "function" )
			InitializeLocal();
	}

	/*//---------------------------------------------*/
	/*// Name: SetExternalLinkTargets()				 */
	/*// Desc: Modify External Links for Standards	 */
	/*//---------------------------------------------*/
	function SetExternalLinkTargets()
	{
		if ( !document.getElementsByTagName )
			return;

		var anchors = document.getElementsByTagName( "a" );
		for ( var i=0;i<anchors.length;i++ )
		{
			var anchor = anchors[i];
			if ( ( anchor.getAttribute( "href" ) ) && ( anchor.getAttribute( "rel" ) == "newWindow" ) )
				anchor.target = "_blank";
		}
	}

	/*//---------------------------------------------*/
	/*// Name: OpenWindow()							 */
	/*// Desc: Display Sized Popup					 */
	/*//---------------------------------------------*/
	function OpenWindow( cAddress, pTargetWnd, cTargetId, iWinWidth, iWinHeight, bBuffered, bDisplayScrollBars )
	{
		if ( pTargetWnd != null && !pTargetWnd.closed && 3 <= parseInt( navigator.appVersion ) ) {
			pTargetWnd.focus();
			return;
		}
		else
		{
			var iBufferSize = ( bBuffered ) ? 15 : 0;
			pTargetWnd = window.open( cAddress,cTargetId,'toolbar=0,location=0,directories=0,scrollbars=' + ( ( bDisplayScrollBars ) ? '1' : '0' ) + ',status=0,resizable=0,width=' + ( iWinWidth + iBufferSize ) + ',height=' + ( iWinHeight + iBufferSize ) );
		}
	}

	/*//---------------------------------------------*/
	/*// Name: GetDataValue()						 */
	/*// Desc: Retrieves Form Data					 */
	/*//---------------------------------------------*/
	function GetDataValue( objectName )
	{
		var dataObject = document.getElementById( objectName );
		if ( dataObject == null )
			return null;

		var dataValue = '';
		switch ( dataObject.nodeName.toLowerCase() )
		{
			case "select":
				if ( dataObject.selectedIndex == -1 )
				{
					dataValue = '';
					break;
				}

				dataValue = dataObject.options[ dataObject.selectedIndex ].value;
				break;
			case "div":
				var checkInput = dataObject.firstChild;
				while ( checkInput != null )
				{
					if ( checkInput.nodeName.toLowerCase() == "input" )
					{
						if ( checkInput.checked )
						{
							dataValue = checkInput.value;
							break;
						}
					}
					checkInput = checkInput.nextSibling;
				}
				break;
			default:
				dataValue = ( dataObject.type == "checkbox" ) ? dataObject.checked : dataObject.value;
				break;
		}

		return dataValue;
	}

	/*//---------------------------------------------*/
	/*// Name: ValidateFormData()					 */
	/*// Desc: Validates Form Data					 */
	/*//---------------------------------------------*/
	function ValidateFormData()
	{
		if ( ( ValidateFormData.arguments == null ) || ( ValidateFormData.arguments.length % 2 ) )
			return false;

		var checkScan = new RegExp( "([^(]*)(\\(([^,]+),([^)]+)\\))?", "i" );
		var checkLabelScan = new RegExp( "(.*)-([^\\d]+)(\\d+)?", "i" );
		var checkSucceeded = true;
		var errorString = "The following errors have occurred:\r\n";
		var additionalConjunction = ", ";
		var finalConjunction = ", and ";

		for ( var i = 0;i < ValidateFormData.arguments.length - 1;i += 2 )
		{
			var dataObject = document.getElementById( ValidateFormData.arguments[i] );
			if ( dataObject == null )
				continue;

			var dataObjectLabel = ValidateFormData.arguments[i];
			if ( document.getElementById( ValidateFormData.arguments[i]+"-label" ) != null )
			{
				dataObjectLabel = document.getElementById( ValidateFormData.arguments[i]+"-label" ).innerHTML;
			}
			else
			{
				var labelResult = checkLabelScan.exec( dataObjectLabel );
				if ( labelResult != null )
				{
					if ( document.getElementById( labelResult[1]+"-label" ) != null )
					{
						labelResult[3] += '';
						if ( ( labelResult[3] == null ) || ( labelResult[3] == '' ) || ( labelResult[3] == 'undefined' ) )
							dataObjectLabel = document.getElementById( labelResult[1]+"-label" ).innerHTML + " (" + labelResult[2] + ")";
						else
							dataObjectLabel = document.getElementById( labelResult[1]+"-label" ).innerHTML + " (" + labelResult[2] + " " + labelResult[3] + ")";
					}
				}
			}

			var dataValue = GetDataValue( ValidateFormData.arguments[i] );
			if ( ( ValidateFormData.arguments[i+1].search( /optional/i ) != -1 ) && ( dataValue == '' ) )
				continue;

			var checkList = ValidateFormData.arguments[i+1].split( ";" );
			var errorSet = "";
			var currentError = "";
			var conjunction = "";
			var currentSucceeded = true;
			for ( var j = 0;j < checkList.length;j++ )
			{
				var checkResult = checkScan.exec( checkList[j] );
				if ( checkResult != null )
				{
					var errorMessage = "";
					switch( checkResult[1] )
					{
						case "required":
						{
							if ( !dataValue )
								errorMessage = "is a required field";
							break;
						}

						case "length":
						{
							var min = checkResult[3]*1;
							var max = checkResult[4]*1;

							if ( ( min == max ) && ( dataValue.length != max ) )
								errorMessage = "must be "+max+" characters";
							else if ( ( dataValue.length < min ) || ( dataValue.length > max ) )
								errorMessage = "must be between "+min+" and "+max+" characters";
							break;
						}

						case "value":
						{
							var min = checkResult[3]*1;
							var max = checkResult[4]*1;
							var check = dataValue*1;

							if ( ( min == max ) && ( check != max ) )
								errorMessage = "must be "+max;
							else if ( ( check < min ) || ( check > max ) )
								errorMessage = "must be between "+min+" and "+max;
							break;
						}

						case "pattern":
						{
							var patternScan = new RegExp( document.getElementById( ValidateFormData.arguments[i]+"-dataPattern" ).innerHTML, "i" );
							var patternResult = patternScan.exec( dataValue );
							if ( patternResult == null )
								errorMessage = "is not in a valid format";
							break;
						}

					}

					if ( errorMessage != "" )
					{
						if ( currentError != "" )
						{
							errorSet += conjunction + currentError;
							conjunction = additionalConjunction;
						}
						currentError = errorMessage;
						checkSucceeded = currentSucceeded = false;
					}

					if ( ( checkResult[1] == "required" ) && ( !currentSucceeded ) )
						break;
				}
			}

			if ( errorSet != "" )
				conjunction = finalConjunction;

			if ( currentError != "" )
				errorSet += conjunction + currentError;

			if ( !currentSucceeded )
				errorString += "- "+dataObjectLabel+" " + errorSet + ".\r\n";

		}

		if ( !checkSucceeded )
			alert( errorString );

		return checkSucceeded;
	}
