	
	//=========================================================================
	// This function performs validity checks on the first part of the estimate
	// request form and displays an informative message to the user if any 
	// errors occurred.
	// If no error has occured the second page of the form will be displayed.
	//=========================================================================
	function NextPage() {
	
	var hReturnInfo;
	var bReturnValue = true;
	var dCurrentDate = new Date();
	var sCurrentDate = (dCurrentDate.getMonth() + 1) + '/' + dCurrentDate.getDate() + '/' + dCurrentDate.getFullYear();
	var iIndex;
	
		//Clear the error messages and the marked fields.
		ResetErrorDisplay(); 

		try {

			//Format the move date properly.
			document.getElementById('dateOfMove').value = FormatDate(document.getElementById('dateOfMove').value);
				
			//Check if the user entered a valid date.
			hReturnInfo = CompareDates(document.getElementById('dateOfMove').value, sCurrentDate, 'GE'); 

			if (hReturnInfo.ReturnCode > 0) {
				if (hReturnInfo.ReturnCode != 9)
					throw new UserError('dateOfMove', hReturnInfo.ErrorDescription ,2);
				else
					throw new UserError('dateOfMove', 'Please enter a future date.' ,2);
			}
			
			//Check if the user has entered the origin city name.
			if (IsEmpty(document.getElementById('fromCity').value).ReturnCode > 0)
				throw new UserError('fromCity', 'Please enter the origin city name', 2)
				
      //Check if the user selected the origin state.
			if (document.getElementById('cboFromState').selectedIndex == 0)
				throw new UserError('cboFromState', 'Please select the origin state.', 2)

			//Check if the user entered a valid origin zip code. 
			hReturnInfo = IsValidZipCode(document.getElementById('fromZip').value, false); 
			if (hReturnInfo.ReturnCode > 0)
				throw new UserError('fromZip', hReturnInfo.ErrorDescription ,2);
      
      //Check if the user has entered the destination city name.
			if (IsEmpty(document.getElementById('toCity').value).ReturnCode > 0)
				throw new UserError('toCity', 'Please enter the destination city name', 2)

			//Check if the user selected the destination state.
			if (document.getElementById('cboToState').selectedIndex == 0)
				throw new UserError('cboToState', 'Please select the destination state.', 2)

			//Check if the user entered a valid destination zip code. 
			hReturnInfo = IsValidZipCode(document.getElementById('toZip').value, true); 
			if (hReturnInfo.ReturnCode > 0)
				throw new UserError('toZip', hReturnInfo.ErrorDescription ,2);

			//Check if the user selected the size of the move
			if (document.getElementById('moveSize').selectedIndex == 0)
        throw new UserError('moveSize', 'Please select the approximate size of the move.', 2)

			// add by gorden, 2008-07-2
			document.getElementById('txMove_Contents').value = document.getElementById('moveSize').options[document.getElementById('moveSize').selectedIndex].text;

		}
		
		//If an exeption was raised an error message will be displayed.
		catch (hUserError) {
			hUserError.DisplayError();
			bReturnValue = false;
		}			

		//If no error was found then the second page of the estimate request
		//form will be displayed. 
		if (bReturnValue) {
			document.getElementById('estPart1').style.display = 'none';
			document.getElementById('estPart2').style.display = 'block';
		}

	}

	
	//=========================================================================
	// This function performs validity checks on the second part of the estimate
	// request form and displays an informative message to the user if any 
	// errors occurred.
	// If no error has occured the form will be submitted.
	//=========================================================================
	function frmInfo_onsubmit() {
	
	var hReturnInfo;
	var bReturnValue = true;
	var iIndex;
	
		//Clear the error messages and the marked fields.
		ResetErrorDisplay(); 

		try {

			//Check if the user entered his full name.
			if (IsEmpty(document.getElementById('txtFullName').value).ReturnCode > 0)
				throw new UserError('txtFullName', 'Please enter your full name.', 1)

			//Check if the user entered a valid phone number. 
			hReturnInfo = IsValidPhoneNumber(document.getElementById('txtPhone').value, false); 
			if (hReturnInfo.ReturnCode > 0)
				throw new UserError('txtPhone', hReturnInfo.ErrorDescription ,1);

			//Format the phone number properly.
			document.getElementById('txtPhone').value = FormatPhoneNumber(document.getElementById('txtPhone').value);
			
			//Check if the user entered a valid additional phone number. 
			hReturnInfo = IsValidPhoneNumber(document.getElementById('txtAdditionalPhone').value, true); 
			if (hReturnInfo.ReturnCode > 0)
				throw new UserError('txtAdditionalPhone', hReturnInfo.ErrorDescription ,1);
      
			//Format the additional phone number properly.
			document.getElementById('txtAdditionalPhone').value = FormatPhoneNumber(document.getElementById('txtAdditionalPhone').value);

			//Check if the user entered a valid e-mail address. 
			hReturnInfo = IsValidEMailAddress(document.getElementById('txtEMail').value, false); 
			if (hReturnInfo.ReturnCode > 0)
				throw new UserError('txtEMail', hReturnInfo.ErrorDescription ,1);	

		}
		
		//If an exeption was raised an error message will be displayed.
		catch (hUserError) {
			hUserError.DisplayError();
			bReturnValue = false;
		}			

		return bReturnValue;

	}

