 // ************************************************************************************************

// ************************************* Rate Quote Validation ***********************************************

// ************************************************************************************************



function valid_form(form_obj,page_name,first_error,tab_num,checkZip)

{


	var form_element = null;          // Field name

	var error_message = "";

	var error_message_to_display = "";

	var is_error = 0;	

	var field_value = "";

	var error_ind = 0;	

	var ldl = -1;			// Limited Documentation Loan	

	var fico_score = "";	// FICO Score

	var hidden_field = false;

	if (form_obj != null && form_obj != "NoForm")

	{		

		

		// Validating Lender Information

	

		if (page_name == "next_or_previous")
		{
			hidden_field = false;
		}		

		// Validating Lender Loan Number

		

		if (form_obj.page_from!=null && (form_obj.page_from.value=='getRateMI' || form_obj.page_from.value=='rateQuote'))

		{
			
			if (page_name == "next_or_previous")

			{

				if (form_obj.Lenderloanno.type == "hidden")

				{	// If field is hidden - no validation

					hidden_field = true;

				}

				else {

					hidden_field = false;

				}

			}



			if (form_obj.Lenderloanno != null && !hidden_field)

			{     // If Lenderloanno is present on the page	

				error_message = val_lender_loan_no(form_obj);

				if (error_message != ""){	

					error_message_to_display += "\n" + error_message;

					is_error = 1;

					if (error_ind == 0){

						error_ind = 1;

					}

				}

			}	

		}

		// Validation Property Information 

		

				

		// Validating Zip Code

		

		if (page_name == "next_or_previous"){

			if (form_obj.Zip.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		

		if (form_obj.Zip != null && !hidden_field){     // If Zip Code field is present on the page

							

			error_message = val_zip_code(form_obj);	

			if (error_message != ""){			

				error_message_to_display += "\n" + error_message;	

				is_error = 1;

				if (error_ind == 0){

					error_ind = 2;

				}

			}

		}
		//*************** Changes for Eorg 4.2 Validation of Following field values in Rate Quote*************/	
		/////////START/////////////////
		// Validating Property Type
		
		if (page_name == "next_or_previous"){

			if (form_obj.Propertytype.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		

		if (form_obj.Propertytype != null && !hidden_field){     // If Property Type field is present on the page

			

			error_message = val_property_type(form_obj);	

			if (error_message != ""){			

				error_message_to_display += "\n" + error_message;	

				is_error = 1;

				if (error_ind == 0){

					error_ind = 3;

				}

			}

		}
		////////////////////
		//validation for du/lp reco
		if (page_name == "next_or_previous"){
			if (form_obj.UnderwritingRecommendation.type == "hidden"){	// If field is hidden - no validation
				hidden_field = true;
			}
			else {
				hidden_field = false;
			}
		}
		if(form_obj.UnderwritingRecommendation !=null)
		{
			var fieldvalue = ""
			var error_message  = ""
			fieldvalue = formobj.UnderwritingRecommendation.value;
			if(fieldvalue == "Select")
			{
				error_message = "Please select a valid entry for DU/LP Recommendation."
			}
			if (error_message != "")
			{	
				setErrorLabels(error_message, form_obj, "DU/LP Recommendation:")
				setErrorLabels(error_message, form_obj, "DU/LP Recommendation")
				error_message_to_display += "\n" + error_message;
				is_error = 1;
				if (error_ind == 0)
				{
					error_ind = 94;
				}
			}	
		}
		
		//Added for eOrig 10.0 
		// If doc type is DU then DU/LP also should be DU type.
		var duLp = formobj.UnderwritingRecommendation.value;
		var docType = formobj.Limiteddocpgm.value;
		if(docType == 'DU'){
			if(!(duLp == '2215' || duLp =='2216' || duLp =='2219' || 
				duLp == '15209' || duLp == '2220' || duLp == '2248' ||
				duLp == '2221' || duLp == '2249' || duLp == '2223' || 
				duLp == '2332' || duLp == '2222' || duLp == '2217' || 
				duLp == '2218' || duLp =='15303' || duLp =='15304' || 
				duLp =='15305' || duLp =='15306' || duLp =='15282' || 
				duLp =='15283' || duLp =='15284' || duLp =='15285' || 
				duLp =='15286' || duLp =='15287' || duLp =='15288' || 
				duLp =='15289' || duLp =='15307' || duLp =='15308')){
				 error_message = "If \"DU\" has been selected as the Documentation Type, a DU-related value must also be selected in the DU/LP Recommendation field";
				 if (error_message != "")
				{	
				 setErrorLabels(error_message, form_obj, "DU/LP Recommendation:")
 				 setErrorLabels(error_message, form_obj, "DU/LP Recommendation")
 				 	setErrorLabels(error_message, form_obj, "Documentation Type");
					setErrorLabels(error_message, form_obj, "Documentation Type:");
 				 
				error_message_to_display += "\n" + error_message;
				is_error = 1;
				if (error_ind == 0)
				{
					error_ind = 94;
				}
				}
			}
		 }
		if(docType == 'LP'){
			if(!(duLp == '2225' || duLp == '2226'|| duLp == '2227'|| duLp == '2228')){
				error_message = "If \"LP\" has been selected as the Documentation Type, a LP-related value must also be selected in the DU/LP Recommendation field";
				 setErrorLabels(error_message, form_obj, "DU/LP Recommendation:")
 				 setErrorLabels(error_message, form_obj, "DU/LP Recommendation")
 				 setErrorLabels(error_message, form_obj, "Documentation Type");
				setErrorLabels(error_message, form_obj, "Documentation Type:");
				error_message_to_display += "\n" + error_message;
				is_error = 1;
				if (error_ind == 0)
				{
					error_ind = 94;
				}
			}
		 }
		if(docType == 'LPAcceptPlus'){
			if(!(duLp == '2224')){
				 error_message = "If \"LP Accept Plus\" has been selected as the Documentation Type, 'LP Accept Plus' must also be selected in the DU/LP Recommendation field.";
				if (error_message != "")
				{	
				 setErrorLabels(error_message, form_obj, "DU/LP Recommendation:")
 				 setErrorLabels(error_message, form_obj, "DU/LP Recommendation")
 					setErrorLabels(error_message, form_obj, "Documentation Type");
				setErrorLabels(error_message, form_obj, "Documentation Type:");
 				 
				 error_message_to_display += "\n" + error_message;
				 is_error = 1;
				if (error_ind == 0)
				{
					error_ind = 94;
				}
				}
			}
		 }
		// if(docType == 'Full'){
			//if(!(duLp == '0')){
			 //error_message = "If \"Full\" has been selected as the Documentation Type, 'None' must be selected in the DU/LP Recommendation field.";
				// setErrorLabels(error_message, form_obj, "DU/LP Recommendation:")
  				 //setErrorLabels(error_message, form_obj, "DU/LP Recommendation")
  			 	//setErrorLabels(error_message, form_obj, "Documentation Type");
				//setErrorLabels(error_message, form_obj, "Documentation Type:");
  				 
				//error_message_to_display += "\n" + error_message;
				//is_error = 1;
				//if (error_ind == 0)
			//	{
				//	error_ind = 94;
			//	}
		//	}
		// }
		////////////////////
		////////////////////
		//////////////
	
		// Validating Occupancy Status
		

		if(docType == 'DU/LP/Approved AUS' || docType == 'StatedSISA' || docType == 'StatedSIVA' || docType == 'StatedVISA' || docType == 'NIVA' || docType == 'No Ratio FICO' || docType == 'NoDoc' ){

				 error_message = "Documentation Type that has been expired is selected";
				 setErrorLabels(error_message, form_obj, "Documentation Type");
				 setErrorLabels(error_message, form_obj, "Documentation Type:");
				error_message_to_display += "\n" + error_message;
				is_error = 1;
				if (error_ind == 0)
				{
					error_ind = 94;
				}
			//}
		 }
		if (page_name == "next_or_previous"){

			if (form_obj.Occupancystatus.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		

		if (form_obj.Occupancystatus != null && !hidden_field){     // If Occupancy Status field is present on the page

			

			error_message = val_Occupancy_status(form_obj);	

			if (error_message != ""){			

				error_message_to_display += "\n" + error_message;	

				is_error = 1;

				if (error_ind == 0){

					error_ind = 4;

				}

			}

		}

		// Validating Number of Units
		
		if (page_name == "next_or_previous"){
			if (form_obj.noofUnits.type == "hidden"){	// If field is hidden - no validation
				hidden_field = true;
			}
			else {
				hidden_field = false;
			}
		}
		
		if (form_obj.noofUnits != null && !hidden_field){     // If Number of Units field is present on the page
			
			error_message = val_no_of_units(form_obj);	
			if (error_message != ""){		
				error_message_to_display += "\n" + error_message;		
				is_error = 1;
				if (error_ind == 0){
					error_ind = 5;
				}
			}
		}


		/////////END/////////////////

		// Validating Sales Price

			

		if (page_name == "next_or_previous")

		{

			if (form_obj.Salesprice.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		

	//	if(!hiddenfield)

		  

  

		//if (form_obj.Salesprice != null && !hidden_field)

		{     // If Sales Price field is present on the page

			error_message = val_sales_price_loan_purpose(form_obj,tab_num);//val_sales_price(form_obj);	

			if (error_message != "")

			{		

				setErrorLabels(error_message, form_obj, "Sales Price:")
				setErrorLabels(error_message, form_obj, "Sales Price")
				error_message_to_display += "\n" + error_message;

				is_error = 1;

				if (error_ind == 0){

					error_ind = 6;

				}

			}

		}

		

		// Validating Appraised

		

		if (page_name == "next_or_previous"){

			if (form_obj.Appraisedvalue.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		

		if (form_obj.Appraisedvalue != null && !hidden_field){     // If Appraised Value field is present on the page

			//alert("Before Validating Appraisal Value");

			error_message = val_appraised_value(form_obj);	

			//alert("After Validating Appraisal Value");

			if (error_message != ""){

				error_message_to_display += "\n" + error_message;

				is_error = 1;

				if (error_ind == 0){

					error_ind = 7;

				}

			}

		}

		

		

		// Validating Loan Information

		//*************** Changes for Eorg 4.2 Validation of Following field values in Rate Quote*************/	
		/////////START/////////////////
		// Validating Amortization Type
		
		if (page_name == "next_or_previous"){

			if (form_obj.Amortizationtype.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		

		if (form_obj.Amortizationtype != null && !hidden_field){     // If Amortization Type field is present on the page

			

			error_message = val_Amortization_type(form_obj);	

			if (error_message != ""){			

				error_message_to_display += "\n" + error_message;	

				is_error = 1;

				if (error_ind == 0){

					error_ind = 8;

				}

			}

		}

		// Validating Loan Type
		
		if (page_name == "next_or_previous"){
			if (form_obj.Loantype.type == "hidden"){	// If field is hidden - no validation
				hidden_field = true;
			}
			else {
				hidden_field = false;
			}
		}

		if (form_obj.Loantype != null && !hidden_field){     // If Loan Type field is present on the page
			error_message = val_Loan_type(form_obj);	
			if (error_message != ""){			
				error_message_to_display += "\n" + error_message;	
				is_error = 1;
				if (error_ind == 0){
					error_ind = 21;
				}
			}
		}
		
		// Validating Amortization Type and Loan Type
		if (form_obj.Amortizationtype != null && form_obj.Loantype != null && !hidden_field)
		{
			var fieldvalueAmortizationType = form_obj.Amortizationtype.options[form_obj.Amortizationtype.selectedIndex].value;
			var fieldvalueLoanType = form_obj.Loantype.options[form_obj.Loantype.selectedIndex].value;
			var error_message  = "";
			
			if ( (fieldvalueAmortizationType=="PotlNegAm" ) &&
			     (fieldvalueLoanType=="FixedRate" || fieldvalueLoanType=="2-StepMtg" || fieldvalueLoanType=="GrowingEquityMtg" || fieldvalueLoanType=="GPM-Start-UpMtg")
			   ) 
			{
			   error_message  = "Please select a valid Amortization Type for this Loan Type.";
			}
			
			if (error_message != "")
			{	
				setErrorLabels(error_message, form_obj, "Amortization Type:")
				setErrorLabels(error_message, form_obj, "Loan Type:")
				setErrorLabels(error_message, form_obj, "Amortization Type")
				setErrorLabels(error_message, form_obj, "Loan Type")
				error_message_to_display += "\n" + error_message;
				is_error = 1;
				if (error_ind == 0)
				{
					error_ind = 8;
				}
			}
		}		
		// Validating Loan Purpose
		
		
		if (page_name == "next_or_previous"){

			if (form_obj.Loanpurpose.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		if (form_obj.Loanpurpose != null && !hidden_field){     // If Occupancy Status field is present on the page

			

			error_message = val_Loan_purpose(form_obj);	

			if (error_message != ""){			

				error_message_to_display += "\n" + error_message;	

				is_error = 1;

				if (error_ind == 0){

					error_ind = 9;

				}

			}

		}
		
		/////////END/////////////////
		
		

		// Validating Loan Amount 

			

		if (page_name == "next_or_previous"){

			if (form_obj.Loanamount.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}					

		

		if (form_obj.Loanamount != null && !hidden_field){     // If Loanamount field is present on the page

			error_message = val_loan_amount(form_obj);

			if (error_message != "")

			{	

				error_message_to_display += "\n" + error_message;

				is_error = 1;

				if (error_ind == 0){

					error_ind = 10;

				}

			}

		}



		// Validating Loan Term

		

		if (page_name == "next_or_previous"){

			if (form_obj.Loanterm.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		

		if (form_obj.Loanterm != null && !hidden_field){     // If Loan Term field is present on the page

			error_message = val_loan_term(form_obj);

			if (error_message != ""){	

				error_message_to_display += "\n" + error_message;

				is_error = 1;

				if (error_ind == 0){

					error_ind = 11;

				}

			}

		}



		// Validating Amortization Term

		

		if (page_name == "next_or_previous"){

			if (form_obj.Amortizationterm.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		

		if (form_obj.Amortizationterm != null && !hidden_field){     // If Amortization Term field is present on the page

			error_message = val_amortization_term(form_obj);

			if (error_message != ""){	

				error_message_to_display += "\n" + error_message;

				is_error = 1;

				if (error_ind == 0){

					error_ind = 12;

				}

			}

		}

		

		// Validating Interest Only Term

		

		if (page_name == "next_or_previous"){

			if (form_obj.interestOnlyTerm.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		

		if (form_obj.interestOnlyTerm != null && !hidden_field){     // If Interest Only Term field is present on the page

			error_message = val_interestonly_term(form_obj);

			if (error_message != ""){	

				error_message_to_display += "\n" + error_message;

				is_error = 1;

				if (error_ind == 0){

					error_ind = 13;

				}

			}

		}

		// Validating PITI
		
		if (page_name == "next_or_previous"){
			if (form_obj.PITI.type == "hidden"){	// If field is hidden - no validation
				hidden_field = true;
			}
			else {
				hidden_field = false;
			}
		}
		
		if (form_obj.PITI != null && !hidden_field){     // If PITI field is present on the page
			error_message = val_piti(form_obj);
			if (error_message != ""){	
				error_message_to_display += "\n" + error_message;
				is_error = 1;
				if (error_ind == 0){
					error_ind = 14;
				}
			}
		}
		
		// Validating Long Term Debt
		
		if (page_name == "next_or_previous"){
			if (form_obj.Longtermdebt.type == "hidden"){	// If field is hidden - no validation
				hidden_field = true;
			}
			else {
				hidden_field = false;
			}
		}
		
		if (form_obj.Longtermdebt != null && !hidden_field){     // If Long Term Debt field is present on the page
			error_message = val_long_term_debt(form_obj);
			if (error_message != ""){	
				error_message_to_display += "\n" + error_message;
				is_error = 1;
				if (error_ind == 0){
					error_ind = 15;
				}
			}
		}

		// Validating Monthly Income
		
		if (page_name == "next_or_previous" && form_obj.Monthlyincome != null){		
			if (form_obj.Monthlyincome.type == "hidden"){	// If field is hidden - no validation
				hidden_field = true;
			}
			else {
				hidden_field = false;
			}
		}
		
		if (form_obj.Monthlyincome != null && !hidden_field){     // If Long Term Debt field is present on the page		
			error_message = val_monthly_income(form_obj.Monthlyincome.value);
			if (error_message != ""){	
				error_message_to_display += "\n" + error_message;
				is_error = 1;
				if (error_ind == 0){
					error_ind = 16;
				}
			}
		}

		// Validating DU Performance Grade
		
		if (page_name == "next_or_previous"){
			if (form_obj.duPerformanceGrade.type == "hidden"){	// If field is hidden - no validation
				hidden_field = true;
			}
			else {
				hidden_field = false;
			}
		}
		
		if (form_obj.duPerformanceGrade != null && !form_obj.duPerformanceGrade.disabled && form_obj.duPerformanceGrade.selectedIndex == 0 && !hidden_field){     // If Affordable Program field is present on the page
			error_message = "A DU Indicator value must be selected in association with this DU recommendation.";
			setErrorLabels(error_message, formobj, "DU Indicator:");
			if (error_message != ""){	
				error_message_to_display += "\n" + error_message;
				is_error = 1;
				if (error_ind == 0){
					error_ind = 17;
				}
			}
		}

		// Validating Mortgage Insurance Type

		/*

		if (page_name == "next_or_previous"){

			if (form_obj.MItype.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		

		if (form_obj.MItype != null && !hidden_field){     // If Mortgage Insurance Type field is present on the page

			error_message = val_mi_type(form_obj);

			if (error_message != ""){	

				error_message_to_display += "\n" + error_message;

				is_error = 1;

				if (error_ind == 0){

					error_ind = 39;

				}

			}

		}

		*/



		//validating Customer Product and Affordable loan program

		/*

		if (page_name == "next_or_previous"){

			if (form_obj.CustomerProduct.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

			if (form_obj.AffordableLoanProgram.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		if(!hidden_field)

		{		

			var affordableLoanPGM = form_obj.AffordableLoanProgram.selectedIndex;

				if ((form_obj.CustomerProduct != null && !form_obj.CustomerProduct.value =="") && (affordableLoanPGM != null && !affordableLoanPGM == "0")){ // If Coverage field is present on the page

					var error = "Only one value for the Loan Program should be provided - either from the Affordable/Loan Program or the Customer Product field.";

					setErrorLabels(error, formobj, "Customer Product:");

					setErrorLabels(error, formobj, "Affordable/Loan Program:");

					error_message = error;

					if (error_message != ""){	

						error_message_to_display += "\n" + error_message;

						is_error = 1;

						if (error_ind == 0){

							error_ind = 39;

						}

					}

				}

		}

		*/

		// Validating Coverage

		

		if (page_name == "next_or_previous"){

			if (form_obj.Coverage.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		

		if (form_obj.Coverage != null && !hidden_field){     // If Coverage field is present on the page

			error_message = val_coverage(form_obj);

			if (error_message != ""){	

				error_message_to_display += "\n" + error_message;

				is_error = 1;

				if (error_ind == 0){

					error_ind = 18;

				}

			}

		}



		

		// Validating FICO Score  for getRate

		if (page_name == "next_or_previous")

		{

			if (form_obj.FICOscore.type == "hidden")

			{	// If field is hidden - no validation

				hidden_field = true;

			}

			else 

			{

				hidden_field = false;

			}

		}



		if (form_obj.FICOscore != null && !hidden_field)

		{     // If FICO Score field is present on the page

			error_message = val_fico_score_only(form_obj);

			if (error_message != "")

			{	

				error_message_to_display += "\n" + error_message;

				is_error = 1;

				if (error_ind == 0)

				{

					error_ind = 19;

				}

			}

		}

		// Validating Limited Documentation Program

				

		if (page_name == "next_or_previous"){

			if (form_obj.Limiteddocpgm.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		

		if (form_obj.Limiteddocpgm != null && !hidden_field){     // If Limited Documentation Program field is present on the page

			error_message = val_limited_doc_program(form_obj);

			if (error_message != ""){	

				error_message_to_display += "\n" + error_message;

				is_error = 1;

				if (error_ind == 0){

					error_ind = 20;

				}

			}

		}
		
		//eorig9:Feat119:Total Debt Ratio changes
		// Validating Total Debt Ratio
		
		if (page_name == "next_or_previous"){
			if (form_obj.CustDebtToIncomeRatio.type == "hidden"){	// If field is hidden - no validation
				hidden_field = true;
			}
			else {
				hidden_field = false;
			}
		}
		
		if (form_obj.CustDebtToIncomeRatio != null && !hidden_field){     // If Total Debt Ratio is present on the page
			error_message = val_total_debt_ratio(form_obj);
			if (error_message != ""){	
				error_message_to_display += "\n" + error_message;
				is_error = 1;
				if (error_ind == 0){
					error_ind = 21;
				}
			}
		}
		//End total debt ratio changes



				

		if (is_error == 1)

		{

			if (first_error == "")

			{

				error_message_to_display_in_alert = error_message_to_display;

			}

			else 

			{

				error_message_to_display_in_alert = first_error;

			}



			//alert(" AM Error Alert 1");

			display_error_message(error_message_to_display_in_alert);

			

			// make a local post to JSP  to Display the Red Label's

			//formobj.target = "content";

			//formobj.action = formobj.LabelErrorPage.value;

			form_obj.method="post";

			//form_obj.submit();
			
			return false;

		}		
		
		return true;			// Form is valid

	}

}





// *****************************************************************************************

// Validating Lender Loan Number

// *****************************************************************************************

function val_lender_loan_no(formobj)

{

	var error = "";

	var fieldvalue = "";

	

	fieldvalue = stripWhitespace(formobj.Lenderloanno.value);

	//fieldvalue = stripCharsInBag(fieldvalue, "-");

	

	if (isEmpty(fieldvalue)){

		error = form_error_blank_with_a("Lender Loan Number", "text");

	}

	/*else if(!isAlphanumeric(fieldvalue)){

		error = form_error("Lender Loan No.", "alphanumeric");

	}*/

	setErrorLabels(error, formobj, "Lender Loan Number:")
	setErrorLabels(error, formobj, "Lender Loan Number")
	return error;

}



// *****************************************************************************************

// Validating Zip Code

// *****************************************************************************************

function val_zip_code(formobj){

	var error = "";

	var fieldvalue = "";

	

	fieldvalue = stripWhitespace(formobj.Zip.value);

	

	if (isEmpty(fieldvalue))

	{

		error = "Please enter a valid Zip Code for this property.";//form_error_blank("Zip Code", "text");

	}

	else if (!isInteger(fieldvalue)){

		error = form_error("Zip Code", "numeric values");

	}

	else if (fieldvalue.length != 5){

		error = "Zip Code should be 5 digits long.";	

	}

	//else if (fieldvalue == 0 || fieldvalue == 11111 || fieldvalue == 22222 || fieldvalue == 33333 || fieldvalue == 44444 || fieldvalue == 55555 || fieldvalue == 66666 || fieldvalue == 77777 || fieldvalue == 88888 || fieldvalue == 99999){

	else if (fieldvalue == 0){

		error = "Please enter a valid Zip Code for this property.";

	}

	else if (fieldvalue == 0)

	{

		error = "Please enter a valid Zip Code for this property.";

	}

	setErrorLabels(error, formobj, "Zip Code:0");
	setErrorLabels(error, formobj, "Zip Code");

	return error;

}

// *****************************************************************************************

// *****************************************************************************************

//  Validating Property Type

// *****************************************************************************************

function val_property_type(formobj)
{
var error_message = "";
  if(form_obj.Propertytype!=null)
{
	
	if(form_obj.Propertytype.value=="Select")
	{
		error_message = "Please select a valid entry for Property Type.";
		if (error_message != "")
		{
			setErrorLabels(error_message, form_obj, "Property Type:")
			setErrorLabels(error_message, form_obj, "Property Type")			
		}
	}
   }
return(error_message);
}

// *****************************************************************************************
// Validating Number of Units
// *****************************************************************************************
function val_no_of_units(formobj){
	var error = "";
	var fieldvalue_property = -1;
	var fieldvalue_no_of_units = -1;
	
	if (formobj.Propertytype != null){
		fieldvalue_property = formobj.Propertytype.selectedIndex;
	}
	fieldvalue_no_of_units = formobj.noofUnits.selectedIndex;	

	if (fieldvalue_property == 8){
		if (fieldvalue_no_of_units == 0){
			error = "With Property Type of Multi-Family, the Number of Units should be either 2, 3, or 4.";
		}		
	}
	setErrorLabels(error, formobj, "Number Of Units:");
	setErrorLabels(error, formobj, "Number Of Units");

	return error;
}


// *****************************************************************************************

//  Validating Occupancy Status

// *****************************************************************************************

function val_Occupancy_status(formobj)
{
var error_message = "";
  if(form_obj.Occupancystatus!=null)
{
	
	if(form_obj.Occupancystatus.value=="Select")
	{
		error_message = "Please select a valid entry for Occupancy Status.";
		if (error_message != "")
		{
			setErrorLabels(error_message, form_obj, "Occupancy Status:")
			setErrorLabels(error_message, form_obj, "Occupancy Status")			
		}
	}
   }
return(error_message);
}
// *****************************************************************************************

// Validating Sales Price

// *****************************************************************************************



function val_sales_price_loan_purpose(formobj, tab)

{

	//alert("TAB is :"+tab);

	var error = "";

	var salePriceValue = "";

	var loanPurposeValue = "";

	if(formobj != null)

	{

		if(formobj.Salesprice != null)

		{

			salePriceValue = stripWhitespace(formobj.Salesprice.value);

			//alert("Sales Price is :"+salePriceValue);

		}

		if(formobj.Loanpurpose != null)

		{

			if(formobj.Loanpurpose.type != "hidden")

				loanPurposeValue = formobj.Loanpurpose.selectedIndex;

			else

				loanPurposeValue = formobj.Loanpurpose.value;			

			//	

			//alert("Loan Purpose is :"+loanPurposeValue);

		}

	//alert("Sales Price Loan Purpose 1...");	

	if (tab != 12 && tab != 13 && tab != 14 && tab != 21 && tab != 23 && tab != 24 && tab != 31 && tab != 32 && tab != 34 && tab != 41 && tab != 42 && tab != 43)

	{	

		//alert("Sales Price Loan Purpose P 1...");	

		if(formobj.Salesprice != null && formobj.Loanpurpose != null)

		{

			//alert("Sales Price Loan Purpose A...");					
			
			//if(loanPurposeValue == "2" || loanPurposeValue == "3" || loanPurposeValue == "5" || loanPurposeValue == "Rate/Term Refinance" || loanPurposeValue == "Cash-Out Refinance" || loanPurposeValue == "Streamline Refinance")
			//if(loanPurposeValue == "3" || loanPurposeValue == "4" || loanPurposeValue == "6" || loanPurposeValue == "Rate/Term Refinance" || loanPurposeValue == "Cash-Out Refinance" || loanPurposeValue == "Streamline Refinance") //eOrig 4.4.1
			if(loanPurposeValue == "3" || loanPurposeValue == "4" || loanPurposeValue == "6" || loanPurposeValue == "7" || loanPurposeValue == "9" || loanPurposeValue == "Rate/Term Refinance" || loanPurposeValue == "Cash-Out Refinance" || loanPurposeValue == "Construction-Refinance" || loanPurposeValue == "Rehabilitation-Refinance" || loanPurposeValue == "Streamline Refinance")
			{

			    //alert("Sales Price Loan Purpose B...");						

				if (!isEmpty(salePriceValue))

				{

					if(salePriceValue > 0 || salePriceValue < 0)

						error = "Sales Price must be blank when Loan Purpose is Refinance.";

					else

						error = val_sales_price(formobj);

				}

			}
			//Changes on 10th june
			//else if(loanPurposeValue == "0" || loanPurposeValue == "1" || loanPurposeValue == "4" || loanPurposeValue == "Purchase" || loanPurposeValue == "Purchase-Relocation" || loanPurposeValue == "Construction-Purchase")
			//else if(loanPurposeValue == "1" || loanPurposeValue == "2" || loanPurposeValue == "5" || loanPurposeValue == "Purchase" || loanPurposeValue == "Purchase-Relocation" || loanPurposeValue == "Construction-Purchase") //eOrig 4.4.1
			else if(loanPurposeValue == "1" || loanPurposeValue == "2" || loanPurposeValue == "5" || loanPurposeValue == "8" || loanPurposeValue == "Purchase" || loanPurposeValue == "Purchase-Relocation" || loanPurposeValue == "Construction-Purchase" || loanPurposeValue == "Rehabilitation-Purchase")			
			{

			    //alert("Sales Price Loan Purpose B.1...");						

				if (isEmpty(salePriceValue))

				{

					//alert("Sales Price Loan Purpose B.1.1..");						

					error = "Sales Price must be entered for the Loan Purpose you selected.";

				}

				else

				{

					//alert("Sales Price Loan Purpose B.1.2..");

					if(salePriceValue <= 0)

						error = "Sales Price must be entered for the Loan Purpose you selected.";

					else						

						error = val_sales_price(formobj);

				//	if (!isFloat(salePriceValue))

				//	{

				//		error = form_error("Sales Price", "numeric values");

				//	}

				}		

			} // else

		} // if(formobj.Salesprice != null && formobj.Loanpurpose != null)

	}

	else if(formobj.Salesprice != null)

	{

		//alert("Sales Price Loan Purpose A.1..");	

		error = val_sales_price(formobj);

	}		

	}// if(formobj != null)

	//alert("Error Message is :"+error);

	return error;

}



function val_sales_price(formobj){

	var error = "";

	var fieldvalue = "";

	fieldvalue = stripWhitespace(formobj.Salesprice.value);

	if (!isEmpty(fieldvalue))

	{		

		if (!isFloat(fieldvalue))

		{

			error = form_error("Sales Price", "numeric values");

		}

	}

	setErrorLabels(error, formobj, "Sales Price:");	
	setErrorLabels(error, formobj, "Sales Price");	
	return error;

}







// *****************************************************************************************

// Validating Appraised Value

// *****************************************************************************************

function val_appraised_value(formobj)

{

	var error = "";

	var fieldvalue = "";



//	alert("Inside App Value");	

	fieldvalue = stripWhitespace(formobj.Appraisedvalue.value);

//	alert("Inside App Value -->"+fieldvalue);		

	if (isEmpty(fieldvalue))

	{

		error = "Please enter a valid Appraisal Value for this property.";//form_error_blank_with_a("Appraisal Value Amount", "text");

		//return error;

	}

	else if (isNaN(fieldvalue))

	{

		error = form_error("Appraisal Value Amount", "numeric values");

		//return error;

	}



	else if (!(fieldvalue > 0))

	{

		error = form_error("Appraisal Value Amount", "greater than zero");

		//return error;

	}

//	alert(error);

	setErrorLabels(error, formobj, "Appraisal Value:");
	setErrorLabels(error, formobj, "Appraisal Value");

//	alert(formobj.LabelError.value);

	return error;

}

// *****************************************************************************************
// *****************************************************************************************
//  Validating Amortization Type
// *****************************************************************************************
function val_Amortization_type(formobj)
{
    var error_message = "";
    if(form_obj.Amortizationtype!=null)
    {
	    if(form_obj.Amortizationtype.options[form_obj.Amortizationtype.selectedIndex].value=="Select")
	    {
		    error_message = "Please select a valid entry for Amortization Type.";
		    if (error_message != "")
		    {
			    setErrorLabels(error_message, form_obj, "Amortization Type:")
			    setErrorLabels(error_message, form_obj, "Amortization Type")
		    }
        }
    }
    return(error_message);
}
// *****************************************************************************************
//  Validating Loan Type
// *****************************************************************************************
function val_Loan_type(formobj)
{
    var error_message = "";
    if(form_obj.Loantype!=null)
    {
	    if(form_obj.Loantype.options[form_obj.Loantype.selectedIndex].value=="Select")
	    {
		    error_message = "Please select a valid entry for Loan Type.";
		    if (error_message != "")
		    {
			    setErrorLabels(error_message, form_obj, "Loan Type")
			    setErrorLabels(error_message, form_obj, "Loan Type:")
		    }
        }
    }
    return(error_message);
}
// *****************************************************************************************

//  Validating Loan Purpose

// *****************************************************************************************

function val_Loan_purpose(formobj)
{
var error_message = "";
  if(form_obj.Loanpurpose!=null)
{
	
	if(form_obj.Loanpurpose.value=="Select")
	{
		error_message = "Please select a valid entry for Loan Purpose.";
		if (error_message != "")
		{
			setErrorLabels(error_message, form_obj, "Loan Purpose")
			setErrorLabels(error_message, form_obj, "Loan Purpose:")
		}
	}
   }
return(error_message);
}



// *****************************************************************************************

// Validating Loan Amount

// *****************************************************************************************

function val_loan_amount(formobj){

	var error = "";

	var fieldvalue = "";

	

	fieldvalue = stripWhitespace(formobj.Loanamount.value);

	

	if (isEmpty(fieldvalue))

	{

		error = "Please enter the Original Loan Amount for this record.";//form_error_blank("Original Loan Amount", "text");

	}

	

	else if (!isFloat(fieldvalue)){

		error = form_error("Original Loan Amount", "numeric values");

	}

	else if (!(fieldvalue > 0)){

		error = form_error("Original Loan Amount", "greater than zero");

	}
//The Upper Limit 650,000 has been removed - release 8.1
//	else if (fieldvalue > 650000){//Br 4.1
//		error = form_error("Original Loan Amount", "less than or equal to $650,000");
//	}//Br4.1

	setErrorLabels(error, formobj, "Loan Amount:");
	setErrorLabels(error, formobj, "Loan Amount");
	return error;

}

// *****************************************************************************************



	// *****************************************************************************************

// Validating Loan Term

// *****************************************************************************************

function val_loan_term(formobj){

	var error = "";

	var fieldvalue = "";

	fieldvalue = stripWhitespace(formobj.Loanterm.value);



	if (isEmpty(fieldvalue))

	{

		error = "Please enter a Loan Term for this record.";//form_error_blank("Loan Term", "text");

	}

	else if (!isInteger(fieldvalue))

	{

		error = form_error("Loan Term", "numeric values");

	}

	else if (fieldvalue < 36 || fieldvalue > 480){

		error = "Loan Term should be in a range from 36 to 480.";

	}

	setErrorLabels(error, formobj, "Loan Term:");
	setErrorLabels(error, formobj, "Loan Term");
	return error;

}

function isValidLoanTerm(formobj)

{

	var fieldvalue = stripWhitespace(formobj.Loanterm.value);

	retValue = false;

	if(!isEmpty(fieldvalue))

	{

		if (isInteger(fieldvalue))

		{

			if (fieldvalue < 36 || fieldvalue > 480)

				retValue = false;

			else

				retValue = true;

		}

	}

	

	return retValue;

}

// *****************************************************************************************



// *****************************************************************************************

// Validating Amortization Term

// *****************************************************************************************

function val_amortization_term(formobj){

	var error = "";

	var fieldvalue = "";

	var loanterm = "";

	fieldvalue = stripWhitespace(formobj.Amortizationterm.value);

	loanterm   = stripWhitespace(formobj.Loanterm.value);

	

	if (isEmpty(fieldvalue))

	{

		error = "Please enter an Amortization Term for this record.";//form_error_blank("Amortization Term", "text");

	}

	else if (!isInteger(fieldvalue)){

		error = form_error("Amortization Term", "numeric values");

	}

	else if (fieldvalue < 36 || fieldvalue > 480){

		error = "Amortization Term should be in a range from 36 to 480.";

	}

	else if (form_obj.Loantype!=null && form_obj.Loantype.options[form_obj.Loantype.selectedIndex].value=="GrowingEquityMtg"){

		if(isValidLoanTerm(formobj))

			if(Number(fieldvalue) <= Number(loanterm))

				error = "Loan Term must be less than Amortization Term for this Loan Type."

				setErrorLabels(error, formobj, "Loan Term:");
				setErrorLabels(error, formobj, "Loan Term");
				return error;
    }

	else 

	{

		if(isValidLoanTerm(formobj))

			if(Number(fieldvalue) < Number(loanterm))

				error = "The Amortization Term must be greater than or equal to the Loan Term."

    }



	setErrorLabels(error, formobj, "Amortization Term:");
	setErrorLabels(error, formobj, "Amortization Term");
	return error;

}

// *****************************************************************************************

// *****************************************************************************************

// Validating Interest Only Term

// *****************************************************************************************

function val_interestonly_term(formobj){

	var error = "";
	var fieldvalue = "";
	var loanterm = "";
	var mitype = "";

	fieldvalue = stripWhitespace(formobj.interestOnlyTerm.value);
	loanterm   = stripWhitespace(formobj.Loanterm.value);
	amortizationterm = stripWhitespace(formobj.Amortizationterm.value);
	
	////// changes for br req# 4926////////////////////////////////	
	
	if(formobj.MItype+"" != "undefined" )
	{
		mitype  = formobj.MItype.value;
	}
    //////////////////////////////////////////	
	
	/*if (isEmpty(fieldvalue))
	{
	error = "Please enter an Interest Only Term for this record.";//form_error_blank("Interest Only Term", "text");
	}
	else*/

	if(!isEmpty(fieldvalue))
	{
		if (!isInteger(fieldvalue)){

			error = form_error("Interest Only Term", "numeric values");

		}
		else if (fieldvalue < 0 || fieldvalue > 480){

			error = "Interest Only Term should be in a range from 1 to 480.";

		}
		else if(isValidLoanTerm(formobj) && (Number(fieldvalue) > Number(loanterm))){
			error = "The Interest Only Term must be less than or equal to the Loan Term.\nYou only need to fill this field out if your loan has an interest only term as well.";

	    }
	    else if(val_amortization_term(formobj)=="" && (Number(fieldvalue) >= Number(amortizationterm))){
			error = "The Interest Only Term must be less than the Amortization Term.\nYou only need to fill this field out if your loan has an interest only term as well.";

	    }

		setErrorLabels(error, formobj, "Interest Only Term:");
		setErrorLabels(error, formobj, "Interest Only Term");
	}
    else //changes for br req #4926 ------- [ Td #5072 ]
	{
	    if (formobj.Amortizationtype!=null && formobj.Amortizationtype.options[formobj.Amortizationtype.selectedIndex].value=="InterestOnly")
	    {
	        error ="Please enter an Interest Only Term for this record.";	    
	    }
	    /*else if((mitype != null)&&(mitype != "") && mitype=="Lender Paid")
	    {
	        error ="Please enter an Interest Only Term for this record.";
	    }*/
	    setErrorLabels(error, formobj, "Interest Only Term"); 
	    setErrorLabels(error, formobj, "Interest Only Term:"); 
	}


	return error;

}

// *****************************************************************************************
// Validating PITI
// *****************************************************************************************
function val_piti(formobj){
	var error = "";
	var fieldvalue = "";
	fieldvalue = stripWhitespace(formobj.PITI.value);
	
	/* Copied from Form_Validate.js and modified so that the value is optional.
	   All other validations remain same.
	if (isEmpty(fieldvalue) || (Number(fieldvalue) < 1))
	{
		error = "Please enter PITI information for this record.";//form_error_blank("PITI", "text");
		//error = "Please enter PITI - Subject Property information for this record.";
	}else */
	if (!isEmpty(fieldvalue))
	{
		if(Number(fieldvalue) >= 100000)
		{
			error = "Please enter a valid PITI information for this record.";//form_error_blank("PITI", "text");
			//error = "Please enter PITI - Subject Property information for this record.";
		}
		else if (!isFloat(fieldvalue))
		{
			error = form_error("PITI", "numeric values");
			//error = form_error("PITI - Subject Property", "numeric values");
			
		}
		else if (!isInteger(fieldvalue) && isFloat(fieldvalue))
		{		
			if (!check_decimal(fieldvalue,2))
			{
				error = "PITI should contain no more than two digits after decimal point.";
				//error = "PITI - Subject Property should contain no more than two digits after decimal point.";
			}
		}else
		{
		formobj.PITI.value=Math.round(fieldvalue);
		}
	}
	setErrorLabels(error, formobj, "PITI - Subject Property:");
	setErrorLabels(error, formobj, "PITI - Subject Property");
	return error;
}
// *****************************************************************************************

// *****************************************************************************************
// Validating Long Term Debt
// *****************************************************************************************
// Copied from Form_Validate.js 
function val_long_term_debt(formobj){
	var error = "";
	var fieldvalue = "";
	fieldvalue = stripWhitespace(formobj.Longtermdebt.value);
	
	if (!isEmpty(fieldvalue)){
		if (!isFloat(fieldvalue)){
			error = form_error("All Other Monthly Payments", "numeric values");
		}
		else if (!isInteger(fieldvalue) && isFloat(fieldvalue)){
			if (!check_decimal(fieldvalue,2)){
				error = "All Other Monthly Payments should contain no more than two digits after decimal point.";
			}
		}
	}
	setErrorLabels(error, formobj, "All Other Monthly Payments:");
	setErrorLabels(error, formobj, "All Other Monthly Payments");	
	return error;
}


// *****************************************************************************************



// *****************************************************************************************
// Validating Monthly Income
// *****************************************************************************************
function val_monthly_income(monthly_income)
{
	var error = "";
	if (!isEmpty(monthly_income))
	{
		if (!isFloat(monthly_income))
		{
			error = "Monthly Income should be numeric values.";//form_error_borrower("Monthly Income", "numeric", type);
		}	
	}
	setErrorLabels(error, formobj, "Monthly Income:");
	setErrorLabels(error, formobj, "Monthly Income");	
	return error;
}

function isValidLoanTerm(formobj)

{

	var fieldvalue = "";

	if(formobj.Loanterm!=null)

		fieldvalue = stripWhitespace(formobj.Loanterm.value);

	else

		fieldvalue = stripWhitespace(formobj.Amortizationterm.value);

	retValue = false;

	if(!isEmpty(fieldvalue))

	{

		if (isInteger(fieldvalue))

		{

			if (fieldvalue < 36 || fieldvalue > 480)

				retValue = false;

			else

				retValue = true;

		}

	}

	

	return retValue;

}







// *****************************************************************************************

// Validating Mortgage Insurance Type

// *****************************************************************************************

function val_mi_type(formobj){

	var error = "";

	var fieldvalue = "";

	

	fieldvalue = formobj.MItype.selectedIndex;	

	if (fieldvalue == 0){

		error = form_error_blank("Mortgage Insurance Type", "select");

	}

	return error;

}

// *****************************************************************************************

//**********************************************************************************************************



function form_error_blank(field_name, field_type){

	var error_blank = "";

	

	if (field_type == "text")

	{

		//error_blank = "Please enter valid " + field_name + " information.";

		error_blank = "Please enter valid " + field_name + ".";

	}

	else if (field_type == "select"){

		error_blank = "Please select " + field_name + ".";

	}

	return error_blank;

}

//***********************************************************************************************************



// *****************************************************************************************

// Validating Coverage

// *****************************************************************************************

function val_coverage(formobj){

	var error = "";

	var fieldvalue = "";

	var valid_val = 0;

	

	var coverage = new Array(20);	

	

	coverage = [4,6,7,8,10,12,14,16,17,18,20,22,23,25,26,27,28,30,31,32,33,35,37,40,42];

		

	fieldvalue = stripWhitespace(formobj.Coverage.value);

	

	if (isEmpty(fieldvalue))

	{

		error = "Please enter a Coverage Percent for this record.";//form_error_blank("Coverage", "text");

	}

	else if (!isInteger(fieldvalue))

	{

		//error = form_error("Coverage", "integer");

		error = "Please enter a Coverage Percent for this record." ;//form_error_blank("Coverage", "text");

	}

	else { 

		for(i = 0; i < coverage.length; i++){			

			if (Number(fieldvalue) == coverage[i]){

				valid_val = 1;

				break;

			}

		}

		if (valid_val == 0) {

			error = "Please provide a valid MI Coverage Percent. Valid values are:\n4, 6, 7, 8, 10, 12, 14, 16, 17, 18, 20, 22, 23, 25, 26, 27, 28, 30, 31, 32, 33, 35, 37, 40, and 42";

		}

	}

	setErrorLabels(error, formobj, "Coverage:");	
	setErrorLabels(error, formobj, "Coverage");	
	return error;

}

// *****************************************************************************************



// *****************************************************************************************
// Validating Limited Documentation Program
// *****************************************************************************************
function val_limited_doc_program(formobj)
{
	var error = "";
	var browserName = navigator.appName; 
	var browserVer = parseInt(navigator.appVersion);
	setErrorLabels(error, formobj, "Documentation Type");
	setErrorLabels(error, formobj, "Documentation Type:");
	var error_message = "";
    if(form_obj.Limiteddocpgm!=null && form_obj.Limiteddocpgm.options[formobj.Limiteddocpgm.selectedIndex].value=="Select")
	{
		error_message = "Please select a valid entry for Documentation Type.";
		if (error_message != "")
		{
			setErrorLabels(error_message, form_obj, "Documentation Type:")
			setErrorLabels(error_message, form_obj, "Documentation Type")
		}
	}
	return error_message;
}

// *****************************************************************************************



// *****************************************************************************************



// *****************************************************************************************
// Validating FICO Score
// *****************************************************************************************
function val_fico_score_only(formobj)
{
	var error = "";
	var isError = false;
	var allowAnyFicoScoreForThisDU_LP_Value = false;
	var fieldvalue = "";
	var nonTraditionalCredit = "";
	var fieldvalue_ldp_val = formobj.Limiteddocpgm.options[formobj.Limiteddocpgm.selectedIndex].value;
	nonTraditionalCredit = get_single_check_box_value(formobj,'NonTraditionalCredit',0);
	fieldvalue = stripWhitespace(formobj.FICOscore.value);
	
	var duPerformGrade = "";
	if (formobj != null && form_obj.UnderwritingRecommendation != null)
	{
		duPerformGrade = formobj. UnderwritingRecommendation.selectedIndex;			
	}
	
	if(nonTraditionalCredit != "Y")
	{
		if(formobj.Loanpurpose != null)
		{
			var lp_Purpose = trimString(formobj.Loanpurpose.selectedIndex);
			if(isEmpty(fieldvalue) && lp_Purpose == "9")
				return error;
		}
		//alert("lp_Purpose="+lp_Purpose);
		//alert("form_obj.Limiteddocpgm="+form_obj.Limiteddocpgm);	
		if (form_obj.Limiteddocpgm != null && duPerformGrade!=null)	
		{
			//alert("inside-->");
			allowAnyFicoScoreForThisDU_LP_Value = true;
		}
		//alert("allowAnyFicoScoreForThisDU_LP_Value ="+allowAnyFicoScoreForThisDU_LP_Value);
		
		if(isEmpty(fieldvalue))
		{
			/*if (fieldvalue_ldp_val=="NINA")
			{
				error = "The FICO Score must be greater than or equal to 660 for the NINA program.";
			}
			else*/ if (allowAnyFicoScoreForThisDU_LP_Value)
			{
				error = "The FICO Score must be entered.";
			}
			else
			{
				//alert("this block---->")
				error = "FICO Score should be greater than or equal to 520.";
			}
			isError = true;
		}
		else
		{
			if (isInteger(fieldvalue))
			{
				/*if ((fieldvalue_ldp_val=="NINA") && (fieldvalue < 660 || fieldvalue > 900))
				{
					error = "The FICO Score must be greater than or equal to 660 for the NINA program.";
					isError = true;
				}
				else*/ if (allowAnyFicoScoreForThisDU_LP_Value && (fieldvalue <= 0 || fieldvalue > 900))
				{
					error = "The FICO Score must be greater than 0.";
					isError = true;				
				}
				
				//else if((fieldvalue < 520 || fieldvalue > 900))
				
				else if((fieldvalue < 520 || fieldvalue > 900) && (!allowAnyFicoScoreForThisDU_LP_Value))
				{
					//alert(" now this block ---->")
					error = "FICO Score should be greater than or equal to 520.";
					isError = true;
				}
			}
			else
			{	
				error = "FICO Score should be numeric value.";
				isError = true;
			}
		}
		if(isError)
		{
			setErrorLabels(error, formobj, "Loan FICO Score:");
			setErrorLabels(error, formobj, "FICO");
		}
	}// if(nonTraditionalCredit != "Y")
	return error;
}















//**********************************************************************************************************

function get_single_check_box_value(formobj,fieldname,index)

{

	var retValue = "N";

	

			if(fieldname == "NonTraditionalCredit")

			{

			 if (formobj.NonTraditionalCredit != null) 

			 {

			 	if( formobj.NonTraditionalCredit.type != "hidden")

			 	{

			 		if (formobj.NonTraditionalCredit.checked) retValue = "Y";

			 	}

			 	else

			 	{

			 	    retValue = formobj.NonTraditionalCredit.value;

			 	    if(retValue == "") retValue = "N";

			 	}

			 }

			}

	

		

	

  return retValue;

}





//**********************************************************************************************************



// WHITESPACE CHARACTERS

var whitespace = " \t\n\r";

var defaultEmptyOK = false;

// DECIMAL POINT CHARACTER DIFFERS BY LANGUAGE AND CULTURE

var decimalPointDelimiter = ".";



//**********************************************************************************************************



//**********************************************************************************************************



// CHECK WHETHER STRING S IS EMPTY.



function isEmpty(s)

{   

	return ((s == null) || (s.length == 0) || (s == " "))

}



//*********************************************************************************************************





function setErrorLabels(error, formobj, label)

{

	var fieldvalue = "";

	var newFieldValue = "";

	

	if(error != null && error != "")

	{

		fieldvalue = formobj.LabelError.value;

		if(fieldvalue == "")

			newFieldValue = label;

		else

			newFieldValue = fieldvalue +","+label;



		formobj.LabelError.value = newFieldValue;

		

	}

}





//**********************************************************************************************************



function display_error_message(error){

	if (error != null && error != ""){

		alert(error);

	}

}



//**********************************************************************************************************





//**********************************************************************************************************





// Creating form Object



function get_form_obj(formname){

	

	if (formname == "getRateQuoteForm")

		form_obj = document.getRateQuoteForm;

	else 

		form_obj = "NoForm";



	return form_obj;

}



//**********************************************************************************************************



//**********************************************************************************************************



// REMOVES ALL WHITESPACE CHARACTERS FROM S.

function stripWhitespace (s)

{   

	if(s != null)

		return stripCharsInBag (s, whitespace);

	else

		return stripCharsInBag (s, whitespace);

}





function isLetter (c)

{   

	return ( ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) )

}



//**********************************************************************************************************



// RETURNS TRUE IF CHARACTER C IS A DIGIT 

// (0 .. 9).



function isDigit (c)

{   

	return ((c >= "0") && (c <= "9"))

}



//**********************************************************************************************************





//***********************************************************************************************************

function form_error_blank_with_a(field_name, field_type){

	var error_blank = "";

	

	if (field_type == "text")

	{

		//error_blank = "Please enter valid " + field_name + " information.";

		error_blank = "Please enter a valid " + field_name + ".";

	}

	else if (field_type == "select"){

		error_blank = "Please select " + field_name + ".";

	}

	return error_blank;

}

//**********************************************************************************************************

//*********************************************************************************************************



// REMOVES ALL CHARACTERS WHICH APPEAR IN STRING BAG FROM STRING S.

function stripCharsInBag (s, bag)

{   

	var i;

    var returnString = "";



    // SEARCH THROUGH STRING'S CHARACTERS ONE BY ONE.

    // IF CHARACTER IS NOT IN BAG, APPEND TO RETURNSTRING.



    for (i = 0; i < s.length; i++)

    {   

        // CHECK THAT CURRENT CHARACTER ISN'T WHITESPACE.

        var c = s.charAt(i);

        if (bag.indexOf(c) == -1) returnString += c;

    }



    return returnString;

}



//**********************************************************************************************************



//**********************************************************************************************************



// RETURNS TRUE IF CHARACTER S IS ALPHABETIC

function isAlphabetic (s)

{   

	var i;

    if (isEmpty(s)) 

       if (isAlphabetic.arguments.length == 1) return defaultEmptyOK;

       else return (isAlphabetic.arguments[1] == true);

    // SEARCH THROUGH STRING'S CHARACTERS ONE BY ONE

    // UNTIL WE FIND A NON-ALPHABETIC CHARACTER.

    // WHEN WE DO, RETURN FALSE; IF WE DON'T, RETURN TRUE.

    for (i = 0; i < s.length; i++)

    {   

        // CHECK THAT CURRENT CHARACTER IS LETTER.

        var c = s.charAt(i);



        if (!isLetter(c))

        return false;

    }

    // ALL CHARACTERS ARE LETTERS.

    return true;

}



//**********************************************************************************************************

// RETURNS TRUE IF CHARACTER S IS AN INTERGER

function isInteger (s)

{   

	var i;

    if (isEmpty(s)) 

       if (isInteger.arguments.length == 1) return defaultEmptyOK;

       else return (isInteger.arguments[1] == true);

    // SEARCH THROUGH STRING'S CHARACTERS ONE BY ONE

    // UNTIL WE FIND A NON-NUMERIC CHARACTER.

    // WHEN WE DO, RETURN FALSE; IF WE DON'T, RETURN TRUE.

    for (i = 0; i < s.length; i++)

    {   

        // CHECK THAT CURRENT CHARACTER IS NUMBER.

        var c = s.charAt(i);

        if (!isDigit(c)) return false;

    }

    // ALL CHARACTERS ARE NUMBERS.

    return true;

}



//**********************************************************************************************************



// isFloat (STRING s)

// 

// TRUE IF STRING S IS AN UNSIGNED FLOATING POINT (REAL) NUMBER. 

//

// ALSO RETURNS TRUE FOR UNSIGNED INTEGERS. IF ONE HAS

// TO DISTINGUISH BETWEEN INTEGERS AND FLOATING POINT NUMBERS,

// FIRST CALL ISINTEGER, THEN CALL ISFLOAT.

//

// DOES NOT ACCEPT EXPONENTIAL NOTATION.



function isFloat (s)

{   

	var i;

    var seenDecimalPoint = false;

    if (s == decimalPointDelimiter) return false;

    // SEARCH THROUGH STRING'S CHARACTERS ONE BY ONE

    // UNTIL WE FIND A NON-NUMERIC CHARACTER.

    // WHEN WE DO, RETURN FALSE; IF WE DON'T, RETURN TRUE.

    for (i = 0; i < s.length; i++)

    {   

        // CHECK THAT CURRENT CHARACTER IS NUMBER.

        var c = s.charAt(i);

        if ((c == decimalPointDelimiter) && !seenDecimalPoint) seenDecimalPoint = true;

        else if (!isDigit(c)) return false;

    }

    // ALL CHARACTERS ARE NUMBERS.

    return true;

}



//**********************************************************************************************************



// isAlphanumeric (STRING s)

// 

// RETURNS TRUE IF STRING S IS ENGLISH LETTERS 

// (A.Z,a.z) AND NUMBERS ONLY.

//



function isAlphanumeric (s)



{   

	var i;

    if (isEmpty(s)) 

       if (isAlphanumeric.arguments.length == 1) return defaultEmptyOK;

       else return (isAlphanumeric.arguments[1] == true);

    // SEARCH THROUGH STRING'S CHARACTERS ONE BY ONE

    // UNTIL WE FIND A NON-ALPHANUMERIC CHARACTER.

    // WHEN WE DO, RETURN FALSE; IF WE DON'T, RETURN TRUE.

    for (i = 0; i < s.length; i++)

    {   

        // CHECK THAT CURRENT CHARACTER IS NUMBER OR LETTER.

        var c = s.charAt(i);



        if (! (isLetter(c) || isDigit(c) || isWhiteSpace1(c)) )

        return false;

    }

    // ALL CHARACTERS ARE NUMBERS OR LETTERS.

    return true;

}

//**********************************************************************************************************



function allowIntegersOnly(event)

    {

       if (event.keyCode < 48 || event.keyCode > 57 )

       {

			event.returnValue = false;

       }

   }



 //**********************************************************************************************************



function form_error(field_name, field_type){

	var error = "";	

	error = field_name + " should be " + field_type + ".";

	return error;

}	



//**********************************************************************************************************
// 06/10/2008: eOrig 9.0 Feat119:STRQ387: Total Debt Ratio changes

//This function will format total debt ratio value to 99.99 format
function formatDecimal(form_name, field_name){
	var form_obj = null; 
	var field_obj = null;
	var field_value = null;
	form_obj = get_form_obj(form_name);
	if (form_obj!= null && form_obj != "NoForm"){	
		field_value=form_obj.CustDebtToIncomeRatio.value; 
		if(field_value!='null' && field_value!="" && field_value!="." ){
			field_value= round_decimals(field_value,2);
			form_obj.CustDebtToIncomeRatio.value = field_value; 
		}
		else{
			form_obj.CustDebtToIncomeRatio.value="";
		}
	}
}
//This will round the total debt ratio value
function round_decimals(original_number, decimals) {
    var result1 = original_number * Math.pow(10, decimals)
    var result2 = Math.round(result1)
    var result3 = result2 / Math.pow(10, decimals)
    return pad_with_zeros(result3, decimals)
}

function pad_with_zeros(rounded_value, decimal_places) {

    // Convert the number to a string
    var value_string = rounded_value.toString()
    
    // Locate the decimal point
    var decimal_location = value_string.indexOf(".")

    // Is there a decimal point?
    if (decimal_location == -1) {
        
        // If no, then all decimal places will be padded with 0s
        decimal_part_length = 0
        
        // If decimal_places is greater than zero, tack on a decimal point
        value_string += decimal_places > 0 ? "." : ""
    }
    else {

        // If yes, then only the extra decimal places will be padded with 0s
        decimal_part_length = value_string.length - decimal_location - 1
    }
    
    // Calculate the number of decimal places that need to be padded with 0s
    var pad_total = decimal_places - decimal_part_length
    
    if (pad_total > 0) {
        
        // Pad the string with 0s
        for (var counter = 1; counter <= pad_total; counter++) 
            value_string += "0"
        }
    return value_string
}

//This will allow only integers and a single decimal point "." in this field
function allowOnlyIntegers(form_name,event)
{
	var form_obj = null; 
	var field_obj = null;
	var field_value = null;

	if((event.keyCode < 48 || event.keyCode > 57 )&&(event.keyCode !=46 ))
    {
		event.returnValue = false;
    }
    else if(event.keyCode ==46 ){
		form_obj = get_form_obj(form_name);
		if (form_obj!= null && form_obj != "NoForm"){	
			field_value=form_obj.CustDebtToIncomeRatio.value; 
			  if(field_value!='null'&& field_value!=""){
		    	pos=field_value.indexOf(".");
				if(pos != -1){
					event.returnValue = false;
				}
			}	
		}
   }
}
//End of Feat119 changes
//**********************************************************************************************************

function make_round(form_name, field_name){

	var form_obj = null; 

	var field_obj = null;

	var field_value = null;

	

	form_obj = get_form_obj(form_name);

	if (form_obj != null && form_obj != "NoForm"){	

		// Getting field name

		if (field_name == "Salesprice"){

			field_obj = form_obj.Salesprice;

		}

		else if (field_name == "Appraisedvalue"){

			field_obj = form_obj.Appraisedvalue;

		}

		else if (field_name == "Loanamount"){

			field_obj = form_obj.Loanamount;

		}

		else {

			field_obj = "NoField";

		}

		

		if (field_obj != null && field_obj != "NoField"){

			field_value = field_obj.value;

			if (field_value != null && field_value != "" && isFloat(field_value)){

				field_obj.value = Math.round(field_obj.value);

			}

		}

	}

}



//**********************************************************************************************************

function check_decimal(fieldValue,num){

	var afterDec=fieldValue.split(".");

	var dec=afterDec[1];

	if(dec.length > num){

		return false;

	}

	return true;

}

//**********************************************************************************************************


// trim String in Javascript

function trimString(inputString) 

{

   // Removes leading and trailing spaces from the passed string. Also removes

   // consecutive spaces and replaces it with one space. If something besides

   // a string is passed in (null, custom object, etc.) then return the input.

   if (typeof inputString != "string") 

   { 

   	return inputString; 

   }

   

   var retValue = inputString;

   var ch = retValue.substring(0, 1);

   while (ch == " ") 

   { // Check for spaces at the beginning of the string

      retValue = retValue.substring(1, retValue.length);

      ch = retValue.substring(0, 1);

   }

   ch = retValue.substring(retValue.length-1, retValue.length);

   while (ch == " ") 

   { // Check for spaces at the end of the string

      retValue = retValue.substring(0, retValue.length-1);

      ch = retValue.substring(retValue.length-1, retValue.length);

   }

   while (retValue.indexOf("  ") != -1) 

   { // Note that there are two spaces in the string - look for multiple spaces within the string

      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings

   }

   return retValue; // Return the trimmed string back to the user

} // Ends the "trim" function



// *****************************************************************************************
// Enable Disable DU Performance Grade fields
// *****************************************************************************************
function enbDisableDUPgrade(form_name)
{
	var formobj = "";
	var browserName = navigator.appName; 
	var browserVer = parseInt(navigator.appVersion);
	//window.alert("I am here");

	formobj = get_form_obj(form_name);
	
	if (formobj != null && form_obj.duPerformanceGrade != null)
	{
		if(form_obj.UnderwritingRecommendation[form_obj.UnderwritingRecommendation.selectedIndex].value!= null && form_obj.UnderwritingRecommendation[form_obj.UnderwritingRecommendation.selectedIndex].value == "-1")
		{
			form_obj.UnderwritingRecommendation.selectedIndex = 0;
		}

		if(form_obj.UnderwritingRecommendation[form_obj.UnderwritingRecommendation.selectedIndex].value!= null && (form_obj.UnderwritingRecommendation[form_obj.UnderwritingRecommendation.selectedIndex].value == "15303" || form_obj.UnderwritingRecommendation[form_obj.UnderwritingRecommendation.selectedIndex].value == "15304" || form_obj.UnderwritingRecommendation[form_obj.UnderwritingRecommendation.selectedIndex].value == "15305" || form_obj.UnderwritingRecommendation[form_obj.UnderwritingRecommendation.selectedIndex].value == "15306" || form_obj.UnderwritingRecommendation[form_obj.UnderwritingRecommendation.selectedIndex].value == "15282" || form_obj.UnderwritingRecommendation[form_obj.UnderwritingRecommendation.selectedIndex].value == "15283" || form_obj.UnderwritingRecommendation[form_obj.UnderwritingRecommendation.selectedIndex].value == "15284" || form_obj.UnderwritingRecommendation[form_obj.UnderwritingRecommendation.selectedIndex].value == "15285" || form_obj.UnderwritingRecommendation[form_obj.UnderwritingRecommendation.selectedIndex].value == "15286" || form_obj.UnderwritingRecommendation[form_obj.UnderwritingRecommendation.selectedIndex].value == "15287" || form_obj.UnderwritingRecommendation[form_obj.UnderwritingRecommendation.selectedIndex].value == "15288" || form_obj.UnderwritingRecommendation[form_obj.UnderwritingRecommendation.selectedIndex].value == "15289" || form_obj.UnderwritingRecommendation[form_obj.UnderwritingRecommendation.selectedIndex].value == "15307" || form_obj.UnderwritingRecommendation[form_obj.UnderwritingRecommendation.selectedIndex].value == "15308"))
		{	
			if (browserName == "Netscape" && browserVer == 4)
			{
				form_obj.duPerformanceGrade.onfocus=null;
			}
			else
			{
				form_obj.duPerformanceGrade.disabled = false;			
			}
		
		}
		else
		{
			if (browserName == "Netscape" && browserVer == 4)
			{
				form_obj.duPerformanceGrade.selectedIndex = 0;
				form_obj.duPerformanceGrade.onfocus = form_obj.duPerformanceGrade.blur;
			}
			else
			{
				form_obj.duPerformanceGrade.selectedIndex = 0;
				form_obj.duPerformanceGrade.disabled = true;	
			}
		}
	}
}
// *****************************************************************************************
// Disable No Of Units 
// *****************************************************************************************
// Copied from Form_Validate.js
function disable_no_of_units(form_name)
{
	var formobj = "";
	var fieldvalue_proty = "";
	var browserName = navigator.appName; 
	var browserVer = parseInt(navigator.appVersion);

	formobj = get_form_obj(form_name);
	
	if (formobj != null)
	{
	    if (formobj.Propertytype != null && formobj.noofUnits != null)
		{
			fieldvalue_proty = formobj.Propertytype.selectedIndex;

			if (fieldvalue_proty != null && fieldvalue_proty == 8 )
			{		
		        if (browserName == "Netscape" && browserVer == 4)
					formobj.noofUnits.onfocus = null;
				else 
					formobj.noofUnits.disabled = false;
		    } 
	    	// Disable
			else 
			{
				if (browserName == "Netscape" && browserVer == 4)					
					formobj.noofUnits.onfocus=formobj.noofUnits.blur;
				else
					formobj.noofUnits.disabled = true;
			    formobj.noofUnits.selectedIndex = 0;
		   }
	  	}// obje is null
 	}// form null	
}	
// *****************************************************************************************
// Enable Disable Interest Only Term based on Amortization Type 
// *****************************************************************************************
// Copied from Form_Validate.js
function enableDisableInterestOnlyTerm()
	{
		if (document.getRateQuoteForm!=null && 
	        document.getRateQuoteForm.Amortizationtype!=null && document.getRateQuoteForm.Amortizationtype.type!="hidden" && 
			document.getRateQuoteForm.interestOnlyTerm!=null && document.getRateQuoteForm.interestOnlyTerm.type!="hidden"
	       )
		{
			if(document.getRateQuoteForm.Amortizationtype.options[document.getRateQuoteForm.Amortizationtype.selectedIndex].value=="InterestOnly")
			{
				if(navigator.appName == "Netscape")
					document.getRateQuoteForm.interestOnlyTerm.onfocus = null;
				else
					document.getRateQuoteForm.interestOnlyTerm.disabled = false;
			}
			else
			{
				document.getRateQuoteForm.interestOnlyTerm.value = "";
				if(navigator.appName == "Netscape")
					document.getRateQuoteForm.interestOnlyTerm.onfocus = document.getRateQuoteForm.interestOnlyTerm.blur;
				else
					document.getRateQuoteForm.interestOnlyTerm.disabled = true;
			}
		}
	}	




// for testing

function valid_form_for_Zip(form_obj,page_name,first_error,tab_num)

{
	var form_element = null;          // Field name
	var error_message = "";
	var error_message_to_display = "";
	var is_error = 0;	
	var field_value = "";
	var error_ind = 0;	
	var ldl = -1;			// Limited Documentation Loan	
	var fico_score = "";	// FICO Score
	var hidden_field = false;
	if (form_obj != null && form_obj != "NoForm")

	{	
		if (form_obj.page_from!=null && (form_obj.page_from.value=='getRateMI' || form_obj.page_from.value=='rateQuote' || form_obj.page_from.value=='rateQuoteCMG'))
		{
			if (form_obj.Lenderloanno != null && !hidden_field)

			{     // If Lenderloanno is present on the page	
				error_message = val_lender_loan_no(form_obj);
				if (error_message != ""){	
					error_message_to_display += "\n" + error_message;
					is_error = 1;
					if (error_ind == 0){
						error_ind = 1;

					}

				}

			}	

		}
		if (form_obj.Zip != null && !hidden_field){     // If Zip Code field is present on the page
			error_message = val_zip_code(form_obj);	
			if (error_message != ""){			
				error_message_to_display += "\n" + error_message;	
				is_error = 1;

				if (error_ind == 0){

					error_ind = 2;

				}

			}

		}
		//*************** Changes for Eorg 4.2 Validation of Following field values in Rate Quote*************/	
		/////////START/////////////////
		// Validating Property Type
		
		if (page_name == "next_or_previous"){

			if (form_obj.Propertytype.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		

		if (form_obj.Propertytype != null && !hidden_field){     // If Property Type field is present on the page

			

			error_message = val_property_type(form_obj);	

			if (error_message != ""){			

				error_message_to_display += "\n" + error_message;	

				is_error = 1;

				if (error_ind == 0){

					error_ind = 3;

				}

			}

		}
		////////////////////
		//validation for du/lp reco
		if (page_name == "next_or_previous"){
			if (form_obj.UnderwritingRecommendation.type == "hidden"){	// If field is hidden - no validation
				hidden_field = true;
			}
			else {
				hidden_field = false;
			}
		}
		if(form_obj.UnderwritingRecommendation !=null)
		{
			var fieldvalue = ""
			var error_message  = ""
			fieldvalue = formobj.UnderwritingRecommendation.value;
			if(fieldvalue == "Select")
			{
				error_message = "Please select a valid entry for DU/LP Recommendation."
			}
			if (error_message != "")
			{	
				setErrorLabels(error_message, form_obj, "DU/LP Recommendation")
				setErrorLabels(error_message, form_obj, "DU/LP Recommendation:")
				error_message_to_display += "\n" + error_message;
				is_error = 1;
				if (error_ind == 0)
				{
					error_ind = 94;
				}
			}	
		}
		
		////////////////////
		//////////////
		//Added for eOrig 10.0 
		// If doc type is DU then DU/LP also should be DU type.
		var duLp = formobj.UnderwritingRecommendation.value;
		var docType = formobj.Limiteddocpgm.value;
		if(docType == 'DU'){
			if(!(duLp == '2215' || duLp =='2216' || duLp =='2219' || 
				duLp == '15209' || duLp == '2220' || duLp == '2248' ||
				duLp == '2221' || duLp == '2249' || duLp == '2223' || 
				duLp == '2332' || duLp == '2222' || duLp == '2217' || 
				duLp == '2218' || duLp =='15303' || duLp =='15304' || 
				duLp =='15305' || duLp =='15306' || duLp =='15282' || 
				duLp =='15283' || duLp =='15284' || duLp =='15285' || 
				duLp =='15286' || duLp =='15287' || duLp =='15288' || 
				duLp =='15289' || duLp =='15307' || duLp =='15308')){
				 error_message = "If DU has been selected as the Documentation Type, a DU-related value must also be selected in the DU/LP Recommendation field.";
				 setErrorLabels(error_message, form_obj, "DU/LP Recommendation:")
 				 setErrorLabels(error_message, form_obj, "DU/LP Recommendation")
 				setErrorLabels(error_message, form_obj, "Documentation Type");
				setErrorLabels(error_message, form_obj, "Documentation Type:");
 				 
				error_message_to_display += "\n" + error_message;
				is_error = 1;
				if (error_ind == 0)
				{
					error_ind = 94;
				}
			}
		 }
		if(docType == 'LP'){
			if(!(duLp == '2225' || duLp == '2226'|| duLp == '2227'|| duLp == '2228')){
				error_message = "If \"LP\" has been selected as the Documentation Type, a LP-related value must also be selected in the DU/LP Recommendation field";
				 setErrorLabels(error_message, form_obj, "DU/LP Recommendation:")
 				 setErrorLabels(error_message, form_obj, "DU/LP Recommendation")
 				 setErrorLabels(error_message, form_obj, "Documentation Type");
				setErrorLabels(error_message, form_obj, "Documentation Type:");
				error_message_to_display += "\n" + error_message;
				is_error = 1;
				if (error_ind == 0)
				{
					error_ind = 94;
				}
			}
		 }
		if(docType == 'LPAcceptPlus'){
			if(!(duLp == '2224')){
			 error_message = "If \"LP Accept Plus\" has been selected as the Documentation Type, 'LP Accept Plus' must be selected in the DU/LP Recommendation field.";
				 setErrorLabels(error_message, form_obj, "DU/LP Recommendation:")
  				 setErrorLabels(error_message, form_obj, "DU/LP Recommendation")
  			 	setErrorLabels(error_message, form_obj, "Documentation Type");
				setErrorLabels(error_message, form_obj, "Documentation Type:");
  				 
				error_message_to_display += "\n" + error_message;
				is_error = 1;
				if (error_ind == 0)
				{
					error_ind = 94;
				}
			}
		 }
		// if(docType == 'Full'){
			//if(!(duLp == '0')){
			 //error_message = "If \"Full\" has been selected as the Documentation Type, 'None' must be selected in the DU/LP Recommendation field.";
				// setErrorLabels(error_message, form_obj, "DU/LP Recommendation:")
  				// setErrorLabels(error_message, form_obj, "DU/LP Recommendation")
  			 //	setErrorLabels(error_message, form_obj, "Documentation Type");
			//	setErrorLabels(error_message, form_obj, "Documentation Type:");
  				 
			//	error_message_to_display += "\n" + error_message;
			//	is_error = 1;
			//	if (error_ind == 0)
			//	{
				//	error_ind = 94;
			//	}
		//	}
		// }
		////////////////////
		// Validating Occupancy Status
	//	alert(error_message);

		if(docType == 'DU/LP/Approved AUS' || docType == 'StatedSISA' || docType == 'StatedSIVA' || docType == 'StatedVISA' || docType == 'NIVA' || docType == 'No Ratio FICO' || docType == 'NoDoc' ){
			//if(!(duLp == '2224')){
				 error_message = "Documentation Type that has been expired is selected";
				 setErrorLabels(error_message, form_obj, "Documentation Type");
				 setErrorLabels(error_message, form_obj, "Documentation Type:");
				error_message_to_display += "\n" + error_message;
				is_error = 1;
				if (error_ind == 0)
				{
					error_ind = 94;
				}
			//}
		 }
		if (page_name == "next_or_previous"){

			if (form_obj.Occupancystatus.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		

		if (form_obj.Occupancystatus != null && !hidden_field){     // If Occupancy Status field is present on the page

			

			error_message = val_Occupancy_status(form_obj);	

			if (error_message != ""){			

				error_message_to_display += "\n" + error_message;	

				is_error = 1;

				if (error_ind == 0){

					error_ind = 4;

				}

			}

		}

		// Validating Number of Units
		
		if (page_name == "next_or_previous"){
			if (form_obj.noofUnits.type == "hidden"){	// If field is hidden - no validation
				hidden_field = true;
			}
			else {
				hidden_field = false;
			}
		}
		
		if (form_obj.noofUnits != null && !hidden_field){     // If Number of Units field is present on the page
			
			error_message = val_no_of_units(form_obj);	
			if (error_message != ""){		
				error_message_to_display += "\n" + error_message;		
				is_error = 1;
				if (error_ind == 0){
					error_ind = 5;
				}
			}
		}


		/////////END/////////////////

		// Validating Sales Price

			

		if (page_name == "next_or_previous")

		{

			if (form_obj.Salesprice.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		

	//	if(!hiddenfield)

		  

  

		//if (form_obj.Salesprice != null && !hidden_field)

		{     // If Sales Price field is present on the page

			error_message = val_sales_price_loan_purpose(form_obj,tab_num);//val_sales_price(form_obj);	

			if (error_message != "")

			{		

				setErrorLabels(error_message, form_obj, "Sales Price:")
				setErrorLabels(error_message, form_obj, "Sales Price")

				error_message_to_display += "\n" + error_message;

				is_error = 1;

				if (error_ind == 0){

					error_ind = 6;

				}

			}

		}

		

		// Validating Appraised

		

		if (page_name == "next_or_previous"){

			if (form_obj.Appraisedvalue.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		

		if (form_obj.Appraisedvalue != null && !hidden_field){     // If Appraised Value field is present on the page

			//alert("Before Validating Appraisal Value");

			error_message = val_appraised_value(form_obj);	

			//alert("After Validating Appraisal Value");

			if (error_message != ""){

				error_message_to_display += "\n" + error_message;

				is_error = 1;

				if (error_ind == 0){

					error_ind = 7;

				}

			}

		}

		

		

		// Validating Loan Information

		//*************** Changes for Eorg 4.2 Validation of Following field values in Rate Quote*************/	
		/////////START/////////////////
		// Validating Amortization Type
		
		if (page_name == "next_or_previous"){

			if (form_obj.Amortizationtype.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		

		if (form_obj.Amortizationtype != null && !hidden_field){     // If Amortization Type field is present on the page

			

			error_message = val_Amortization_type(form_obj);	

			if (error_message != ""){			

				error_message_to_display += "\n" + error_message;	

				is_error = 1;

				if (error_ind == 0){

					error_ind = 8;

				}

			}

		}

		// Validating Loan Type
		
		if (page_name == "next_or_previous"){
			if (form_obj.Loantype.type == "hidden"){	// If field is hidden - no validation
				hidden_field = true;
			}
			else {
				hidden_field = false;
			}
		}

		if (form_obj.Loantype != null && !hidden_field){     // If Loan Type field is present on the page
			error_message = val_Loan_type(form_obj);	
			if (error_message != ""){			
				error_message_to_display += "\n" + error_message;	
				is_error = 1;
				if (error_ind == 0){
					error_ind = 21;
				}
			}
		}
		
		// Validating Amortization Type and Loan Type
		if (form_obj.Amortizationtype != null && form_obj.Loantype != null && !hidden_field)
		{
			var fieldvalueAmortizationType = form_obj.Amortizationtype.options[form_obj.Amortizationtype.selectedIndex].value;
			var fieldvalueLoanType = form_obj.Loantype.options[form_obj.Loantype.selectedIndex].value;
			var error_message  = "";
			
			if ( (fieldvalueAmortizationType=="PotlNegAm" ) &&
			     (fieldvalueLoanType=="FixedRate" || fieldvalueLoanType=="2-StepMtg" || fieldvalueLoanType=="GrowingEquityMtg" || fieldvalueLoanType=="GPM-Start-UpMtg")
			   ) 
			{
			   error_message  = "Please select a valid Amortization Type for this Loan Type.";
			}
			
			if (error_message != "")
			{	
				setErrorLabels(error_message, form_obj, "Amortization Type:")
				setErrorLabels(error_message, form_obj, "Loan Type:")
				setErrorLabels(error_message, form_obj, "Amortization Type")
				setErrorLabels(error_message, form_obj, "Loan Type")

				error_message_to_display += "\n" + error_message;
				is_error = 1;
				if (error_ind == 0)
				{
					error_ind = 8;
				}
			}
		}		
		// Validating Loan Purpose
		
		
		if (page_name == "next_or_previous"){

			if (form_obj.Loanpurpose.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		if (form_obj.Loanpurpose != null && !hidden_field){     // If Occupancy Status field is present on the page

			

			error_message = val_Loan_purpose(form_obj);	

			if (error_message != ""){			

				error_message_to_display += "\n" + error_message;	

				is_error = 1;

				if (error_ind == 0){

					error_ind = 9;

				}

			}

		}
		
		/////////END/////////////////
		
		

		// Validating Loan Amount 

			

		if (page_name == "next_or_previous"){

			if (form_obj.Loanamount.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}					

		

		if (form_obj.Loanamount != null && !hidden_field){     // If Loanamount field is present on the page

			error_message = val_loan_amount(form_obj);

			if (error_message != "")

			{	

				error_message_to_display += "\n" + error_message;

				is_error = 1;

				if (error_ind == 0){

					error_ind = 10;

				}

			}

		}



		// Validating Loan Term

		

		if (page_name == "next_or_previous"){

			if (form_obj.Loanterm.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		

		if (form_obj.Loanterm != null && !hidden_field){     // If Loan Term field is present on the page

			error_message = val_loan_term(form_obj);

			if (error_message != ""){	

				error_message_to_display += "\n" + error_message;

				is_error = 1;

				if (error_ind == 0){

					error_ind = 11;

				}

			}

		}



		// Validating Amortization Term

		

		if (page_name == "next_or_previous"){

			if (form_obj.Amortizationterm.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		

		if (form_obj.Amortizationterm != null && !hidden_field){     // If Amortization Term field is present on the page

			error_message = val_amortization_term(form_obj);

			if (error_message != ""){	

				error_message_to_display += "\n" + error_message;

				is_error = 1;

				if (error_ind == 0){

					error_ind = 12;

				}

			}

		}

		

		// Validating Interest Only Term

		

		if (page_name == "next_or_previous"){

			if (form_obj.interestOnlyTerm.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		

		if (form_obj.interestOnlyTerm != null && !hidden_field){     // If Interest Only Term field is present on the page

			error_message = val_interestonly_term(form_obj);

			if (error_message != ""){	

				error_message_to_display += "\n" + error_message;

				is_error = 1;

				if (error_ind == 0){

					error_ind = 13;

				}

			}

		}

		// Validating PITI
		
		if (page_name == "next_or_previous"){
			if (form_obj.PITI.type == "hidden"){	// If field is hidden - no validation
				hidden_field = true;
			}
			else {
				hidden_field = false;
			}
		}
		
		if (form_obj.PITI != null && !hidden_field){     // If PITI field is present on the page
			error_message = val_piti(form_obj);
			if (error_message != ""){	
				error_message_to_display += "\n" + error_message;
				is_error = 1;
				if (error_ind == 0){
					error_ind = 14;
				}
			}
		}
		
		// Validating Long Term Debt
		
		if (page_name == "next_or_previous"){
			if (form_obj.Longtermdebt.type == "hidden"){	// If field is hidden - no validation
				hidden_field = true;
			}
			else {
				hidden_field = false;
			}
		}
		
		if (form_obj.Longtermdebt != null && !hidden_field){     // If Long Term Debt field is present on the page
			error_message = val_long_term_debt(form_obj);
			if (error_message != ""){	
				error_message_to_display += "\n" + error_message;
				is_error = 1;
				if (error_ind == 0){
					error_ind = 15;
				}
			}
		}

		// Validating Monthly Income
		
		if (page_name == "next_or_previous" && form_obj.Monthlyincome != null){		
			if (form_obj.Monthlyincome.type == "hidden"){	// If field is hidden - no validation
				hidden_field = true;
			}
			else {
				hidden_field = false;
			}
		}
		
		if (form_obj.Monthlyincome != null && !hidden_field){     // If Long Term Debt field is present on the page		
			error_message = val_monthly_income(form_obj.Monthlyincome.value);
			if (error_message != ""){	
				error_message_to_display += "\n" + error_message;
				is_error = 1;
				if (error_ind == 0){
					error_ind = 16;
				}
			}
		}

		// Validating DU Performance Grade
		
		if (page_name == "next_or_previous"){
			if (form_obj.duPerformanceGrade.type == "hidden"){	// If field is hidden - no validation
				hidden_field = true;
			}
			else {
				hidden_field = false;
			}
		}
		
		if (form_obj.duPerformanceGrade != null && !form_obj.duPerformanceGrade.disabled && form_obj.duPerformanceGrade.selectedIndex == 0 && !hidden_field){     // If Affordable Program field is present on the page
			error_message = "A DU Indicator value must be selected in association with this DU recommendation.";
			setErrorLabels(error_message, formobj, "DU Indicator:");
			if (error_message != ""){	
				error_message_to_display += "\n" + error_message;
				is_error = 1;
				if (error_ind == 0){
					error_ind = 17;
				}
			}
		}

		// Validating Mortgage Insurance Type

		/*

		if (page_name == "next_or_previous"){

			if (form_obj.MItype.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		

		if (form_obj.MItype != null && !hidden_field){     // If Mortgage Insurance Type field is present on the page

			error_message = val_mi_type(form_obj);

			if (error_message != ""){	

				error_message_to_display += "\n" + error_message;

				is_error = 1;

				if (error_ind == 0){

					error_ind = 39;

				}

			}

		}

		*/



		//validating Customer Product and Affordable loan program

		/*

		if (page_name == "next_or_previous"){

			if (form_obj.CustomerProduct.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

			if (form_obj.AffordableLoanProgram.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		if(!hidden_field)

		{		

			var affordableLoanPGM = form_obj.AffordableLoanProgram.selectedIndex;

				if ((form_obj.CustomerProduct != null && !form_obj.CustomerProduct.value =="") && (affordableLoanPGM != null && !affordableLoanPGM == "0")){ // If Coverage field is present on the page

					var error = "Only one value for the Loan Program should be provided - either from the Affordable/Loan Program or the Customer Product field.";

					setErrorLabels(error, formobj, "Customer Product:");

					setErrorLabels(error, formobj, "Affordable/Loan Program:");

					error_message = error;

					if (error_message != ""){	

						error_message_to_display += "\n" + error_message;

						is_error = 1;

						if (error_ind == 0){

							error_ind = 39;

						}

					}

				}

		}

		*/

		// Validating Coverage

		

		if (page_name == "next_or_previous"){

			if (form_obj.Coverage.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		

		if (form_obj.Coverage != null && !hidden_field){     // If Coverage field is present on the page

			error_message = val_coverage(form_obj);

			if (error_message != ""){	

				error_message_to_display += "\n" + error_message;

				is_error = 1;

				if (error_ind == 0){

					error_ind = 18;

				}

			}

		}



		

		// Validating FICO Score  for getRate

		if (page_name == "next_or_previous")

		{

			if (form_obj.FICOscore.type == "hidden")

			{	// If field is hidden - no validation

				hidden_field = true;

			}

			else 

			{

				hidden_field = false;

			}

		}



		if (form_obj.FICOscore != null && !hidden_field)

		{     // If FICO Score field is present on the page

			error_message = val_fico_score_only(form_obj);

			if (error_message != "")

			{	

				error_message_to_display += "\n" + error_message;

				is_error = 1;

				if (error_ind == 0)

				{

					error_ind = 19;

				}

			}

		}

		// Validating Limited Documentation Program

				

		if (page_name == "next_or_previous"){

			if (form_obj.Limiteddocpgm.type == "hidden"){	// If field is hidden - no validation

				hidden_field = true;

			}

			else {

				hidden_field = false;

			}

		}

		

		if (form_obj.Limiteddocpgm != null && !hidden_field){     // If Limited Documentation Program field is present on the page

			error_message = val_limited_doc_program(form_obj);

			if (error_message != ""){	

				error_message_to_display += "\n" + error_message;

				is_error = 1;

				if (error_ind == 0){

					error_ind = 20;

				}

			}

		}
		
		//eorig9:Feat119:Total Debt Ratio changes
		// Validating Total Debt Ratio
		
		if (page_name == "next_or_previous"){
			if (form_obj.CustDebtToIncomeRatio.type == "hidden"){	// If field is hidden - no validation
				hidden_field = true;
			}
			else {
				hidden_field = false;
			}
		}
		
		if (form_obj.CustDebtToIncomeRatio != null && !hidden_field){     // If Total Debt Ratio is present on the page
			error_message = val_total_debt_ratio(form_obj);
			if (error_message != ""){	
				error_message_to_display += "\n" + error_message;
				is_error = 1;
				if (error_ind == 0){
					error_ind = 21;
				}
			}
		}
		//End total debt ratio changes
				

		if (is_error == 1)

		{

			if (first_error == "")

			{

				error_message_to_display_in_alert = error_message_to_display;

			}

			else 

			{

				error_message_to_display_in_alert = first_error;

			}



			//alert(" AM Error Alert 1");

			//display_error_message(error_message_to_display_in_alert);

			

			// make a local post to JSP  to Display the Red Label's

			//formobj.target = "content";

			//formobj.action = formobj.LabelErrorPage.value;

			form_obj.method="post";

			//form_obj.submit();
			
			return false;

		}		
		
		return true;			// Form is valid
	}
}

//********************************************************************************************
//eorig 9.0: FEAT 117: Multiple rate quote changes

//To reset the dropdown values on change of MI Type from "Select value" 
function resetDropDownValues(tabVal){
	var aPaymentPlan = 'paymentPlan';
	var aMItype = 'MItype';
	var aRefundType = 'RefundType';
	var aRefundTypeSelect = 'RefundTypeSelect';
	var aRenewaltype = 'Renewaltype';
	var aLoanPrg = 'LoanPrg'
	document.getElementById(aRefundTypeSelect+tabVal).disabled=false;
	document.getElementById(aPaymentPlan+tabVal).disabled=false;
	document.getElementById(aRenewaltype+tabVal).disabled=false;
	document.getElementById(aLoanPrg+tabVal).disabled=false;
	
	//remove the "Select" from dropdown
	removeOptions(document.getElementById(aPaymentPlan+tabVal));
	removeOptions(document.getElementById(aMItype+tabVal));		
	removeOptions(document.getElementById(aRenewaltype+tabVal));
	removeOptions(document.getElementById(aRefundTypeSelect+tabVal));	
	removeOptions(document.getElementById(aLoanPrg+tabVal));	
}

//Add the "Select" to the MI Type,payment plan,renewal type and refund type dropdowns
function addOption(selectbox,text,value )
{
	var i;
	var dropDownFlag =false;
	 for(i=selectbox.options.length-1;i>=0;i--)
	{
		if(selectbox.options[i].text=="Select"){
			dropDownFlag=true;
		}
	}
	if(!dropDownFlag){
			var optn = document.createElement("OPTION");
			optn.text = text;
			optn.value = value;
			selectbox.options.add(optn);
	}
}

//To remove the "Select" from the drop down
function removeOptions(selectbox)
{
	var i;
	for(i=selectbox.options.length-1;i>=0;i--)
	{
		if(selectbox.options[i].text=="Select")
		selectbox.remove(i);
	}
}

//Set the MI Type,payment plan,renewal type and refund type dropdowns on load of page
function setDropDown(tabVal){
	
	var aPaymentPlan = 'paymentPlan';
	var aMItype = 'MItype';
	var aRefundType = 'RefundType';
	var aRefundTypeSelect = 'RefundTypeSelect';
	var aRenewaltype = 'Renewaltype';
	var aLoanPrg = 'LoanPrg'
	addOption(document.getElementById(aPaymentPlan+tabVal),"Select","Select");
	addOption(document.getElementById(aRefundTypeSelect+tabVal),"Select","Select");
	addOption(document.getElementById(aRenewaltype+tabVal),"Select","Select");
	addOption(document.getElementById(aMItype+tabVal),"Select","Select");
	addOption(document.getElementById(aLoanPrg+tabVal),"Select","Select");
	
	document.getElementById(aLoanPrg+tabVal).options[0].selected=true;
	document.getElementById(aLoanPrg+tabVal).options[document.getElementById(aLoanPrg+tabVal).options.length-1].selected=true;
	document.getElementById(aLoanPrg+tabVal).disabled=true;
	
	
	document.getElementById(aMItype+tabVal).options[document.getElementById(aMItype+tabVal).options.length-1].selected=true;

	document.getElementById(aRefundTypeSelect+tabVal).options[document.getElementById(aRefundTypeSelect+tabVal).options.length-1].selected=true;
	document.getElementById(aRefundTypeSelect+tabVal).disabled=true;

	document.getElementById(aPaymentPlan+tabVal).options[document.getElementById(aPaymentPlan+tabVal).options.length-1].selected=true;
	document.getElementById(aPaymentPlan+tabVal).disabled=true;

	document.getElementById(aRenewaltype+tabVal).options[document.getElementById(aRenewaltype+tabVal).options.length-1].selected=true;
	document.getElementById(aRenewaltype+tabVal).disabled=true;
	
}

//Enable/disable refund type on change of payment plan and MI Type
function enableDisableRefundType(aPaymentPlan,aMItype,aRefundTypeSelect,aRefundType){

	var MItype = document.getElementById(aMItype).value;
	var paymentPlan = document.getElementById(aPaymentPlan).value;

	MItype = stripWhitespace(MItype); 
	paymentPlan =stripWhitespace(paymentPlan); 
	flag = getPropertiesInfo(paymentPlan,MItype);
	flag=stripWhitespace(flag);	
	
	var defaultValue=getDefaultValue(paymentPlan,MItype);
	if(defaultValue=='Refund')
	{
		document.getElementById(aRefundTypeSelect).options[1].selected=true;
		document.getElementById(aRefundType).value=document.getElementById(aRefundTypeSelect).options[1].value;
	}
	else if(defaultValue=='No Refund')
	{
		document.getElementById(aRefundTypeSelect).options[0].selected=true;
		document.getElementById(aRefundType).value=document.getElementById(aRefundTypeSelect).options[0].value;
	}
	
	if(flag == 'true' || flag == 'True')
	{
		document.getElementById(aRefundTypeSelect).disabled=false;
	}
	else
	{ 
		document.getElementById(aRefundTypeSelect).disabled=true;
	}
}

//Make the contensts of table available onclick of tab.
function onClickTab(visible) {
	document.getElementById("showTabOne").style.display="none";
	document.getElementById("showTabTwo").style.display="none";
	document.getElementById("showTabThree").style.display="none";
	document.getElementById("showTabFour").style.display="none";
	document.getElementById("showTabFive").style.display="none";
	document.getElementById("tabOne").style.backgroundColor="#EEEEEE";
	document.getElementById("tabTwo").style.backgroundColor="#EEEEEE";
	document.getElementById("tabThree").style.backgroundColor="#EEEEEE";
	document.getElementById("tabFour").style.backgroundColor="#EEEEEE";
	document.getElementById("tabFive").style.backgroundColor="#EEEEEE";

	if(visible=='One'){
		document.getElementById("showTabOne").style.display="block";
		document.getElementById("tabOne").style.backgroundColor="#AAAAAA";
		document.getRateQuoteForm.selectedTab.value="1";
	}
	else if(visible=='Two'){
		document.getElementById("showTabTwo").style.display="block";
		document.getElementById("tabTwo").style.backgroundColor="#AAAAAA";
		document.getRateQuoteForm.selectedTab.value="2";
	}
	else if(visible=='Three'){
		document.getElementById("showTabThree").style.display="block";
		document.getElementById("tabThree").style.backgroundColor="#AAAAAA";
		document.getRateQuoteForm.selectedTab.value="3";
	}
	else if(visible=='Four'){
		document.getElementById("showTabFour").style.display="block";
		document.getElementById("tabFour").style.backgroundColor="#AAAAAA";
		document.getRateQuoteForm.selectedTab.value="4";
	}
	else if(visible=='Five'){
		document.getElementById("showTabFive").style.display="block";
		document.getElementById("tabFive").style.backgroundColor="#AAAAAA";
		document.getRateQuoteForm.selectedTab.value="5";
	}

  }

//To set the focus to the MI Type of selected payment option tab after entering the coverage .
function CheckCoverage(input,length,evt){
	nextField =	document.getRateQuoteForm.selectedTab.value;
	txtLength = input.value.length;
	if(txtLength >= length){
		if(nextField!= 'null'){
			if(nextField=='1' || nextField=="1"){
				document.getRateQuoteForm.MItype1.focus();
			}
			else if(nextField=='2' || nextField=="2"){
				document.getRateQuoteForm.MItype2.focus();
			}
			else if(nextField=='3' || nextField=="3"){
				document.getRateQuoteForm.MItype3.focus();
			}
			else if(nextField=='4' || nextField=="4"){
				document.getRateQuoteForm.MItype4.focus();			
			}
			else if(nextField=='5' || nextField=="5"){
				document.getRateQuoteForm.MItype5.focus();		
			}
		}
	}
}

//eorig9.0:Feat119: Strq387: Total Debt Ratio Changes
// *****************************************************************************************
// Validating Total Debt Ratio
// *****************************************************************************************
function val_total_debt_ratio(formobj){
	var error = "";
	var fieldvalue = "";
	fieldvalue = stripWhitespace(formobj.CustDebtToIncomeRatio.value);

	if (!isEmpty(fieldvalue)){
		 if (!isFloat(fieldvalue))
		{
			error = form_error("Total Debt Ratio", "numeric values");
		}	
		else if (fieldvalue >=100)
		{
			error = "Total Debt Ratio should be in the range of 0.00-99.99%.";
		}

	}
	setErrorLabels(error, formobj, "Total Debt Ratio");
	setErrorLabels(error, formobj, "Total Debt Ratio:");
	return error;
}

// *****************************************************************************************
//End of feat 117 changes 