/*
#################################################################################################### 
# File Name: registration.js
# File Version: v 1.0
# Created By: Sarvesh Borkar	
# Created On: 6 Feb 2008
# Last Modified By:
# Last modified On:
# This file carries the javascript for registration step 1 and 2
#====================================================================================================
*/

/* Added by Richard Fernandes */
/*#####################################AJAX####################################*/
var objRegMgmtSettings;
var ajaxURL = 'lt_ajax_processing.php';
/*#####################################AJAX END####################################*/
//FOR REGISTRATION STEP 1
var validateZip = true;
var zipLength = 5;
var validateState = true;

//FOR REGISTRATION STEP 2
var validateIncome = true;
var validateEducation = true;
var validateEmployment = true;
var validateIndustry = true;
var validateJob = true;
var validateMarital = true; 
var validateEthnicity = true;
var validateOrigin = true;
var validateSpeakRead = true;
var validateIM = true;
var validateChildren18 = true;
var validRole=true;

var boolDisableFormOnValidation = true;
var boolChkTermsAndConditions = true;
var boolValidateCaptcha = true;
/* END */

/*#####################################START REGISTRATION STEP 1####################################*/

/*
#====================================================================================================
#  Function Name    :    restoreDayMonthYear()
#  Created By: Sarvesh Borkar
#  Created On: 6 Feb 2008
#  Last Modified By: 
#  Last modified On: 
#  Purpose : to maintain day,month and year value for US and non US countries
#  Parameters: countryType - US or NonUS
#----------------------------------------------------------------------------------------------------
*/
function restoreDayMonthYear(countryType)
{
	if(document.frmRegistrationStep1)
	{
		frm = document.frmRegistrationStep1;
	}
	else
	{
		var forms = document.getElementsByTagName('form');
		frm = forms[0];
	}
	with(frm)
	{
		if(countryType=="US")
		{
			optNonUSMonthId.value=optMonthId.value;
			optNonUSDayId.value=optDayId.value;
			optNonUSYearId.value=optYearId.value;			 
		}
		else
		{
			optMonthId.value=optNonUSMonthId.value;
			optDayId.value=optNonUSDayId.value;
			optYearId.value=optNonUSYearId.value;
		}
	}
}

/*
#====================================================================================================
#  Function Name    :    showHideData()
#  Created By: Sarvesh Borkar
#  Created On: 6 Feb 2008
#  Last Modified By:  Richard Fernandes
#  Last modified On: 
#  Purpose : chcek the registration form of step 1
#  Parameters: frm : Form Object
#----------------------------------------------------------------------------------------------------
*/

function showHideData(optCountryId)
{	
	if(optCountryId==(document.getElementById('hdUnitedStatesCountryId').value))
	 {
	   document.getElementById('zip_name').innerHTML= translate('enter_your_zip_code_js');	   
	   document.getElementById('US_birthdate_tr').style.display="";
	   document.getElementById('Non_US_birthdate_tr').style.display="none";
	 }
	 else
	 {
		document.getElementById('zip_name').innerHTML=translate('enter_postal_code_js');			
		document.getElementById('US_birthdate_tr').style.display="none";
	    document.getElementById('Non_US_birthdate_tr').style.display="";
	 }
	 
	 if(optCountryId==(document.getElementById('hdUnitedStatesCountryId').value) || optCountryId==(document.getElementById('hdAustraliaCountryId').value) || optCountryId==(document.getElementById('hdCanadaCountryId').value))
	 {
		  //change the language dropdown to english
		 //document.getElementById('optLanguageId').value=document.getElementById('hdEnglishLanguageId').value; //commented out by Richard Fernandes
	 }
	 else
	 {
		 //document.getElementById('optLanguageId').value="";
	 }
	 
}

/*
#====================================================================================================
#  Function Name    :    checkRegistrationStep1()
#  Created By: Sarvesh Borkar
#  Created On: 6 Feb 2008
#  Last Modified By: 
#  Last modified On: 
#  Purpose : check the registration form of step 1
#  Parameters: frm : Form Object
#----------------------------------------------------------------------------------------------------
*/
function checkRegistrationStep1(frm)
{
//alert(zipLength);
    with(frm)
    {	
		if(!IsEmpty(txtFname, translate('enter_your_first_name')))
        {
            return false;
        }
		
		if(!IsEmpty(txtLname, translate('enter_your_last_name')))
        {
            return false;
        }
				
		if(optCountryId.value=="")
		{
			 alert(translate('select_country_js'));
			 optCountryId.focus();
			 return false;
		}
		
		if(validateState){
			optStateId.value=Trim(optStateId.value);
			if(optStateId.value=="")
			{
				 alert(translate('enter_state'));
				 optStateId.focus();
				 return false;
			}
		}
		
		if(validateZip){
			txtZipPostal.value=Trim(txtZipPostal.value);
			if(txtZipPostal.value=="")
			{
				if(optCountryId.value==hdUnitedStatesCountryId.value)
				 alert(translate('enter_zip_code'));
				else
				 alert(translate('enter_postal_code'));
				 
				txtZipPostal.focus();
				return false;			
			}
		}
		
		
		if(optCountryId.value==hdUnitedStatesCountryId.value)
		{
			 if(validateZip && txtZipPostal.value!="")
			 {
				for(i=0;i<txtZipPostal.value.length;i++)
				{
				   // Check that current character is number.
				  var c = txtZipPostal.value.charAt(i);
			 
				   if ((c < "0") || (c > "9"))
				  {
				   alert(translate('enter_numbers_only_for_zip_code'));
				   txtZipPostal.focus();
				   return false;
				  }	
			
				}	
			}
			if(validateZip && txtZipPostal.value.length !=zipLength && zipLength>0)
			{
				//alert(translate('united_states_zipcodes_5_digits'));
				alert(translate(new Array('zip_code_length',zipLength)));
				txtZipPostal.focus();
				return false;
			}
		}
		else{
			if(validateZip && txtZipPostal.value!="")
			 {
				if(txtZipPostal.value.length !=zipLength && zipLength>0)
				{
					alert(translate(new Array('zip_code_length',zipLength)));
					txtZipPostal.focus();
					return false;
				}		   
			 }
		}
		
		
		if(optLanguageId.value=="")
			{
				 alert(translate('select_your_primary_language'));
				 optLanguageId.focus();
				 return false;
			}
		
		if(optCountryId.value==hdUnitedStatesCountryId.value)
		{			
			if(optMonthId.value=="")
			{
				alert(translate('select_month_of_your_birthdate'));
				optMonthId.focus();
				return false;
			}
			
			if(optDayId.value=="")
			{
				alert(translate('day_of_your_birthdate'));
				optDayId.focus();
				return false;
			}
			
			if(optYearId.value=="")
			{
				alert(translate('year_of_your_birthdate'));
				optYearId.focus();
				return false;
			}
			
			
			var Month = optMonthId.value;
			var Day = optDayId.value;
			var Year = optYearId.value;
			var BirthDate;
			BirthDate = Year+"-"+Month+"-"+Day;
			var CurrentDate = getTodaysDate();
			
			if(Year%100 != "0")
			{
				if(Year%4 == "0")
				{
					if( (Month=="02" && Day=="30") || (Month=="02" && Day=="31") || (Month=="04" && Day=="31") || (Month=="06" && Day=="31") || (Month=="09" && Day=="31") || (Month=="11" && Day=="31") )
					{
						alert(translate('proper_day_of_selected_month'));
						optDayId.focus();
						return false;
					}
				}
				else
				{
					if( (Month=="02" && Day=="29") || (Month=="02" && Day=="30") || (Month=="02" && Day=="31") || (Month=="04" && Day=="31") || (Month=="06" && Day=="31") || (Month=="09" && Day=="31") || (Month=="11" && Day=="31") )
					{
						alert(translate('proper_day_of_selected_month'));
						optDayId.focus();
						return false;
					}
				}
			}
			else if(Year%400 == "0")
			{
					if( (Month=="02" && Day=="30") || (Month=="02" && Day=="31") || (Month=="04" && Day=="31") || (Month=="06" && Day=="31") || (Month=="09" && Day=="31") || (Month=="11" && Day=="31") )
					{
						alert(translate('proper_day_of_selected_month'));
						optDayId.focus();
						return false;
					}
			}
			
			
			if(BirthDate > CurrentDate)
			{
				alert(translate('birth_date_limit'));
				optDayId.focus();
				return false;
			}
			
		// HARD CODED for State Maine, age of user should be 18 or more
			if(parseInt(optStateId.value,10) == 141)
			{
				var today = new Date();
				if(
						(parseInt(today.getFullYear(),10) - Year < 18) // less than 18
						||
						(parseInt(today.getFullYear(),10) - Year == 18 // less than 18 by months
						&&
						parseInt(today.getMonth(),10)+1 < Month) 
						||
						(parseInt(today.getFullYear(),10) - Year == 18 // less than 18 by days
						&&
						parseInt(today.getMonth(),10)+1 == Month
						&&
						parseInt(today.getDate(),10) < Day)
					)
				{
					alert('Unfortunately, we are not accepting new registrants under the age of 18 from Maine based on recent Legislation imposed by the State Government of Maine. For more information regarding this statute, please contact the Maine State Government.');
					return false;
				}
			}
		// END Hard Coded for State Maine 
		}
		else
		{
			
			
			if(optNonUSDayId.value=="")
			{
				alert(translate('day_of_your_birthdate'));
				optNonUSDayId.focus();
				return false;
			}
			
			if(optNonUSMonthId.value=="")
			{
				alert(translate('select_month_of_your_birthdate'));
				optNonUSMonthId.focus();
				return false;
			}			
			
			if(optNonUSYearId.value=="")
			{
				alert(translate('year_of_your_birthdate'));
				optNonUSYearId.focus();
				return false;
			}
			
			
			var Month = optNonUSMonthId.value;
			var Day = optNonUSDayId.value;
			var Year = optNonUSYearId.value;
			var BirthDate;
			BirthDate = Year+"-"+Month+"-"+Day;
			var CurrentDate = getTodaysDate();
			
			if(Year%100 != "0")
			{
				if(Year%4 == "0")
				{
					if( (Month=="02" && Day=="30") || (Month=="02" && Day=="31") || (Month=="04" && Day=="31") || (Month=="06" && Day=="31") || (Month=="09" && Day=="31") || (Month=="11" && Day=="31") )
					{
						alert(translate('proper_day_of_selected_month'));
						optNonUSDayId.focus();
						return false;
					}
				}
				else
				{
					if( (Month=="02" && Day=="29") || (Month=="02" && Day=="30") || (Month=="02" && Day=="31") || (Month=="04" && Day=="31") || (Month=="06" && Day=="31") || (Month=="09" && Day=="31") || (Month=="11" && Day=="31") )
					{
						alert(translate('proper_day_of_selected_month'));
						optNonUSDayId.focus();
						return false;
					}
				}
			}
			else if(Year%400 == "0")
			{
					if( (Month=="02" && Day=="30") || (Month=="02" && Day=="31") || (Month=="04" && Day=="31") || (Month=="06" && Day=="31") || (Month=="09" && Day=="31") || (Month=="11" && Day=="31") )
					{
						alert(translate('proper_day_of_selected_month'));
						optNonUSDayId.focus();
						return false;
					}
			}
			
			
			if(BirthDate > CurrentDate)
			{
				alert(translate('birth_date_limit'));
				optNonUSDayId.focus();
				return false;
			}			
		}
		
		// Dont allow the user to register if age is less than 13 years -- US574
		if(optYearId.value != 0 && optMonthId.value != 0 && optDayId.value !=0) {
			var curDate = new Date();
			var userAge = new Date(optYearId.value, optMonthId.value-1, optDayId.value, curDate.getHours(), curDate.getMinutes(), curDate.getSeconds(), curDate.getMilliseconds());
			if(curDate-userAge < 410227200000) { // timestamp equal to 13 years
				alert(translate('registration_age_limit'));
				return false;
			}
		}
		
		
		var gender_radio_choice = false;
		for (counter = 0; counter < rdGender.length; counter++)
         {
           if (rdGender[counter].checked)
              gender_radio_choice = true; 
          }
		if(gender_radio_choice==false)
		{
			alert(translate('select_your_gender'));
			return false;
		}
		
		if(!IsEmpty(txtEmail, translate('enter_your_email')))
        {
            return false;
        }
		
		 if(!IsEmail(txtEmail, translate('enter_valid_email_address')))
        {
            return false;
        }
		
		if(txtEmail.value!=txtConfirmEmail.value)
		{
			alert(translate('email_id_not_matching'));
			txtConfirmEmail.focus();
			return false;
		}		
		
		if(!IsEmpty(txtPassword, translate('enter_your_password')))
        {
            return false;
        }
		
		if(txtPassword.value!=txtConfirmPassword.value)
		{
			alert(translate('passwords_not_matching'));
			txtConfirmPassword.focus();
			return false;
		}
		
		if(boolChkTermsAndConditions && chbTermsAndConditions.checked==false)
		{
			alert(translate('agree_on_terms_and_conditions'));
			return false;
		}
		
		
		if(boolValidateCaptcha && !IsEmpty(txtCaptcha, translate('enter_six_characters_from_image')))
        {
            return false;
        }	
    }
	
	if(boolDisableFormOnValidation)
	{
		fnDisableButtonOnSubmit(frm); //disable button on submit
	}
	return true;
}

/*##################################### END REGISTRATION STEP 1#####################################*/

/*#####################################START REGISTRATION STEP 2####################################*/

/*
#====================================================================================================
#  Function Name    :    captchaRefresh()
#  Created By: Sarvesh Borkar
#  Created On: 6 Feb 2008
#  Last Modified By: 
#  Last modified On: 
#  Purpose : to refresh captcha image after few seconds
#  Parameters: frm : Form Object
#----------------------------------------------------------------------------------------------------
*/
function captchaRefresh()
{
    document.getElementById('captcha_image').src='secure_image_show.php?sid=' + Math.random();
	setTimeout('captchaRefresh()',60000);   
}

/*
#====================================================================================================
#  Function Name    :    checkRegistrationStep2()
#  Created By: Sarvesh Borkar
#  Created On: 6 Feb 2008
#  Last Modified By:  Gauri Sawaikar
#  Last modified On:  18 July 2009
#  Purpose : check the registration form of step 2
#  Parameters: frm : Form Object
#----------------------------------------------------------------------------------------------------
*/
function checkRegistrationStep2(frm)
{
    with(frm)
    {
		if(validateIncome && optAnnualHouseholdIncomeId.value=="")
		{
		 alert(translate('select_annual_household_income_js'));
		 optAnnualHouseholdIncomeId.focus();
		 return false;
		}
		
		if(validateEducation && optEducationLevelId.value=="")
		{
		 alert(translate('select_education_status'));
		 optEducationLevelId.focus();
		 return false;
		}
		
		if(validateEmployment && optEmploymentStatusId.value=="")
		{
		 alert(translate('select_employment_status_js'));
		 optEmploymentStatusId.focus();
		 return false;
		}
		
		if(validateEmployment && optEmploymentStatusId.value!="")
		{
		
			if((optEmploymentStatusId.value!=hdRetiredEmplStatusId.value) && (optEmploymentStatusId.value!=hdStudentEmplStatusId.value) && (optEmploymentStatusId.value!=hdHomemakerEmplStatusId.value) && (optEmploymentStatusId.value!=hdUnemployedEmplStatusId.value))
			{
				if(validateIndustry && optIndustryId.value=="")
				{
				 alert(translate('select_industry_js'));
				 optIndustryId.focus();
				 return false;
				}		
				
				if(validateRole && optRoleId.value=="")
				{
				 alert(translate('select_role_js'));
				 optRoleId.focus();
				 return false;
				}		
				
				if(validateJob && optJobTitleId.value=="")//if(validateRole && validateJob && optJobTitleId.value=="")
				{
				 alert(translate('select_job_title_js'));
				 optJobTitleId.focus();
				 return false;
				}
			}			
		}
		
		if(validateMarital && optMaritalStatusId.value=="")
		{
		 alert(translate('select_marital_status_js'));
		 optMaritalStatusId.focus();
		 return false;
		}		
		
		//if(hdCountryId.value==hdUnitedStatesCountryId.value)
		//{
			if(validateEthnicity && optEthnicityId.value=="")
			 {
				 alert(translate('select_ethinicity'));
				 optEthnicityId.focus();
				 return false;
			 }
		//}
		if(validateOrigin && optNationalityId.value=="")
		{
		 alert(translate('select_nationality'));
		 optNationalityId.focus();
		 return false;
		}
		 
		if(validateSpeakRead){
			//var arrSpeak = optLanguageSpeakId.options;
			//var arrRead = optLanguageReadId;
			var boolSpeak = false;
			var boolRead = false;
			var optLanguageSpeakId = document.getElementsByName('optLanguageSpeakId[]');
			var optLanguageReadId = document.getElementsByName('optLanguageReadId[]');
			
			for(i=0,j=optLanguageSpeakId.length;i<j;i++){
				if(optLanguageSpeakId[i].checked){
					boolSpeak = true;
					break;
				}
			}
			
			for(i=0,j=optLanguageReadId.length;i<j;i++){
				if(optLanguageReadId[i].checked){
					boolRead = true;
					break;
				}
			}
			
			if(!boolSpeak){alert(translate('select_speak_language')); return false;}
			if(!boolRead){alert(translate('select_read_language')); return false;}
		}
		if(validateIM){
			txtIMID.value=Trim(txtIMID.value);
			if(txtIMID.value!="Your ID" && txtIMID.value!="")
			{			
			
				 if(optIMProviderId.value=="")
				 {
					  alert(translate('select_im_provider_js'));
					  optIMProviderId.focus();
					  return false;
				 }
			}
			
			if(optIMProviderId.value!="")
			{
				 if(txtIMID.value=="Your ID" || txtIMID.value=="")
				 {
					  alert(translate('enter_instant_message_id'));
					  txtIMID.focus();
					  return false;
				 }
			}	
		}
		
		if(validateChildren18)
		{
			var children_under_18_radio_choice = false;
			for (counter = 0; counter < rdChildrenUnder18.length; counter++)
			{
				if (rdChildrenUnder18[counter].checked)
				children_under_18_radio_choice = true; 
			}
			
			/*if(children_under_18_radio_choice==false)
			{
			alert(translate('select_childern_under_18'));
			return false;
			}*/
			if(children_under_18_radio_choice==false)
			{
				alert(translate('select_childern_under_18'))
				rdChildrenUnder18[0].focus();
				return false;
			}
			if(!fnValidateChildInfo())
			{
				return false;	
			}
		}
				
		//return fnValidateChildInfo();
	}
	if(boolDisableFormOnValidation)
	{
		fnDisableButtonOnSubmit(frm); //disable button on submit
	}
	return true;
}
/*##################################### END REGISTRATION STEP 2#####################################*/


/*
#====================================================================================================
#  Function Name    :    getRegMgmtSettingsForStep1)
#  Created By: Richard Fermamdes
#  Created On: 6 May 2009
#  Last Modified By: Gauri Sawaikar
#  Last modified On: 21 Aug 2009
#  Purpose : toggle stste of the language dropdown
#----------------------------------------------------------------------------------------------------
*/
function getRegMgmtSettingsForStep1(countryId,languageId,frm,strFieldsAffected)	
{
	/*if(countryId=="" || countryId=="0"){
		alert(translate('please_select_country'));
		return;
	}*/

	if(countryId==(document.getElementById('hdUnitedStatesCountryId').value))
	 {
	   document.getElementById('zip_name').innerHTML= translate('enter_your_zip_code_js');	   
	 }
	 else{
		document.getElementById('zip_name').innerHTML= translate('enter_postal_code_js');
	 }
	if(countryId!="" && countryId!="0" && languageId!="" && languageId!="0"){
		objRegMgmtSettings = GetXmlHttpObject();
		if(objRegMgmtSettings == null){
			alert(translate('browser_not_support_ajax'));
		}
		else{
			url = ajaxURL;
			url += '?hdMode=getRegMgmtSettingsForStep1';
			url += '&hdCountryId='+countryId;
			url += '&hdLanguageId='+languageId;
			url += '&fields='+strFieldsAffected;	
			objRegMgmtSettings.onreadystatechange = function(){
				if(objRegMgmtSettings.readyState==4 || objRegMgmtSettings.readyState=='complete'){
					//convert the JSON string returned to a JS array
					var JSONObj = eval("(" + objRegMgmtSettings.responseText + ")");
					//alert(JSONObj.toString());
					//check state/province condition
					if(hasValue(JSONObj['state_province'])){
						if(JSONObj['state_province']=='N'){
							hide('trStateProvince');
							iHTML('div_states','');
							validateState = false;
						}
						else{
							showTableRow('trStateProvince');
							iHTML('div_states',JSONObj['state_province_dropdown']);
							validateState = true;
						}
					}
					else{
						showTableRow('trStateProvince');
						iHTML('div_states',JSONObj['state_province_dropdown']);
						validateState = true;
					}
					
					//check condition for zip code
					if(hasValue(JSONObj['zip_code'])){
						if(JSONObj['zip_code']=='N'){
							hide('trZipPostal');
							frm.txtZipPostal.value = '';
							validateZip = false;
							//zipLength = 5;
							zipLength = JSONObj['zip_code_value'];
						}
						else{
							showTableRow('trZipPostal');
							validateZip = true;
							zipLength = JSONObj['zip_code_value'];
						}
					}
					else{
						showTableRow('trZipPostal');
						if(countryId==(docObj('hdUnitedStatesCountryId').value)){
							validateZip = true;
						}
						zipLength = 5;
					}
					
					//check condition for date format
					if(hasValue(JSONObj['date_format_value'])){
						if(JSONObj['date_format_value']=="mm/dd/yyyy"){
							showTableRow('US_birthdate_tr');
							hide('Non_US_birthdate_tr');
						}
						else if(JSONObj['date_format_value']=="dd/mm/yyyy"){
							showTableRow('Non_US_birthdate_tr');
							hide('US_birthdate_tr');
						}
						else{
							if(countryId==(docObj('hdUnitedStatesCountryId').value)){
								showTableRow('US_birthdate_tr');
								hide('Non_US_birthdate_tr');
							}
							else{
								showTableRow('Non_US_birthdate_tr');
								hide('US_birthdate_tr');
							}
						}
					}
					else{
						showHideData(countryId);
					}
					
					//Income check condition 
					if(hasValue(JSONObj['household_income'])){
						if(JSONObj['household_income']=='N'){
							hide('income_tr');
							validateIncome = false;
						}
						else{
							showTableRow('income_tr');
							validateIncome = true;
						}
					}
					else{
						showTableRow('income_tr');
						if(countryId==(docObj('hdUnitedStatesCountryId').value)){
							validateIncome = true;
						}
					}
					// END Income					
					
					//Education check condition
					if(hasValue(JSONObj['education_status'])){
						if(JSONObj['education_status']=='N'){
							hide('education_tr');
							validateEducation = false;
						}
						else{
							showTableRow('education_tr');
							validateEducation = true;
						}
					}
					else{
						showTableRow('education_tr');
						if(countryId==(docObj('hdUnitedStatesCountryId').value)){
							validateEducation = true;
						}
					}
					// END Education
					
					//Employment check condition
					if(hasValue(JSONObj['employment_status'])){
						if(JSONObj['employment_status']=='N'){
							hide('employment_tr');
							validateEmployment = false;
						}
						else{
							showTableRow('employment_tr');
							validateEmployment = true;
						}
					}
					else{
						showTableRow('employment_tr');
						if(countryId==(docObj('hdUnitedStatesCountryId').value)){
							validateEmployment = true;
						}
					}
					// END Employment	
					
					//industry check condition
					if(hasValue(JSONObj['industry'])){
						if(JSONObj['industry']=='N'){
							hide('industry_tr');
							validateIndustry = false;
						}
						else{
							showTableRow('industry_tr');
							validateIndustry = true;
						}
					}
					else{
						showTableRow('industry_tr');
						if(countryId==(docObj('hdUnitedStatesCountryId').value)){
							validateIndustry = true;
						}
					}
					// END Industry	
					
					//Job check condition
					if(hasValue(JSONObj['job_title'])){
						if(JSONObj['job_title']=='N'){
							hide('job_tr');
							validateJob = false;
						}
						else{
							showTableRow('job_tr');
							validateJob = true;
						}
					}
					else{
						showTableRow('job_tr');
						if(countryId==(docObj('hdUnitedStatesCountryId').value)){
							validateJob = true;
						}
					}
					// END Job
					
					//Role check condition
					if(hasValue(JSONObj['role'])){
						if(JSONObj['role']=='N'){
							hide('role_tr');
							validateRole = false;
							hide('job_tr');
							validateJob = false;							
						}
						else{
							showTableRow('role_tr');
							validateRole = true;
						}
					}
					else{
						showTableRow('role_tr');
						if(countryId==(docObj('hdUnitedStatesCountryId').value)){
							validateRole = true;
						}
					}
					// END Role					
					
					//Marital check condition
					if(hasValue(JSONObj['marital_status'])){
						if(JSONObj['marital_status']=='N'){
							hide('marital_tr');
							validateMarital = false;
						}
						else{
							showTableRow('marital_tr');
							validateMarital = true;
						}
					}
					else{
						showTableRow('marital_tr');
						if(countryId==(docObj('hdUnitedStatesCountryId').value)){
							validateMarital = true;
						}
					}
					// END Marital					
					
					//ETHNICITY check condition 
					if(hasValue(JSONObj['ethnicity'])){
						if(JSONObj['ethnicity']=='N'){
							hide('ethinicity_tr');
							validateEthnicity = false;
						}
						else{
							showTableRow('ethinicity_tr');
							validateEthnicity = true;
						}
					}
					else{
						showTableRow('ethinicity_tr');
						if(countryId==(docObj('hdUnitedStatesCountryId').value)){
							validateEthnicity = true;
						}
					}
					// END ETHNICITY
					
					//Origin check condition
					if(hasValue(JSONObj['country_of_origin'])){
						if(JSONObj['country_of_origin']=='N'){
							hide('nationality_tr');
							validateNationality = false;
						}
						else{
							showTableRow('nationality_tr');
							validateNationality = true;
						}
					}
					else{
						showTableRow('nationality_tr');
						if(countryId==(docObj('hdUnitedStatesCountryId').value)){
							validateNationality = true;
						}
					}
					// END Origin
					
					//Children under 18 check condition
					if(hasValue(JSONObj['children_in_household'])){
						if(JSONObj['children_in_household']=='N'){
							hide('children18_tr');
							docObj('trChildInfo').style.display="none";
							docObj('tdChildInfo').style.display="none";		
							validateChildren18 = false;
						}
						else{
							showTableRow('children18_tr');
							if(docObj("hdChildCount").value > 0)
							{						
								showTableRow('trChildInfo');
								showTableRow('tdChildInfo');
							}
							validateChildren18 = true;
						}
					}
					else{
						showTableRow('children18_tr');
						if(docObj("hdChildCount").value > 0)
						{						
							showTableRow('trChildInfo');
							showTableRow('tdChildInfo');
						}
						validateChildren18 = true;
					}
					// END Children18
					
					//IM check condition
					if(hasValue(JSONObj['instant_message_id'])){
						if(JSONObj['instant_message_id']=='N'){
							hide('im_tr');
							validateIM = false;						
						}
						else{
							showTableRow('im_tr');
							validateIM = true;
						}
					}
					else{
						showTableRow('im_tr');
						validateIM = true;
					}
					// END IM
					
					//Read Speak check condition
					if(hasValue(JSONObj['what_languages'])){
						if(JSONObj['what_languages']=='N'){
							hide('speak_read_tr');
							validateIM = false;						
						}
						else{
							showTableRow('speak_read_tr');
							validateIM = true;
						}
					}
					else{
						showTableRow('speak_read_tr');
						validateIM = true;
					}
					// END Read Speak					
				}
			};
			objRegMgmtSettings.open("GET",url,true);
			objRegMgmtSettings.send(null);
		}
	}
}

/*
#====================================================================================================
#  Function Name    :    checkRegistrationCompletion()
#  Created By: Saiyesh Mahambrey
#  Created On: 16th July 2009
#  Last Modified By: 
#  Last modified On: 
#  Purpose : check the form for completion of registration
#  Parameters: frm : Form Object
#----------------------------------------------------------------------------------------------------
*/
function checkRegistrationCompletion(frm)
{
	boolDisableFormOnValidation = false;
	boolChkTermsAndConditions = false;
	boolValidateCaptcha = false;
	
	if(checkRegistrationStep1(frm) && checkRegistrationStep2(frm))
	{
		with(frm)
		{
			if(chbTermsAndConditions.checked==false)
			{
				alert(translate('agree_on_terms_and_conditions'));
				return false;
			}
			/*else if(!IsEmpty(txtCaptcha, translate('enter_six_characters_from_image')))
			{
				return false;
			}*/
			return true;
		}
		fnDisableButtonOnSubmit(frm); //disable button on submit
		return true;
	}
	else
	{
		return false;	
	}
}

