function step1Check()
{
	my_form=document.getElementById('step1F');
	
	if(my_form.email.value=='' || !validEmail(my_form.email.value))
	{
		alert(emValid);
		return false;
	}

	if(my_form.email2.value=='' || !validEmail(my_form.email2.value))
	{
		alert(emValid2);
		return false;

	}

	if(my_form.email.value!=my_form.email2.value)
	{
		alert(emMatch);
		return false;

	}

	if(my_form.passwd.value=='')
	{
		alert(passValid);
		return false;
	}

	if(my_form.passwd2.value=='')
	{
		alert(passValid2);
		return false;

	}

	if(my_form.passwd.value!=my_form.passwd2.value)
	{
		alert(passMutch);
		return false;

	}

	if(my_form.title.value==0)
	{
		alert(titleValid);
		return false;

	}

	if(my_form.first_name.value=='')
	{
		alert(fNameValid);
		return false;

	}


	if(my_form.last_name.value=='')
	{
		alert(lNameValid);
		return false;

	}






	if(my_form.po_box.value=='')
	{
		alert(poBValid);
		return false;

	}

	if(my_form.country_of_residence.value==0)
	{
		alert(countrValid);
		return false;

	}

	if(document.getElementById('city').value=='' && !(my_form.country_of_residence.value==22 || my_form.country_of_residence.value==23 || my_form.country_of_residence.value==24 || my_form.country_of_residence.value==25))
	{
		alert(cityValid);
		return false;

	}
	if(my_form.mobile_number.value=='')
	{
		alert(mobValid);
		return false;

	}
	return true;
}

function main_fields_full()
{
	my_form=document.getElementById('main');



	if(my_form.pref_lang.value==0)
	{
		alert(langValid);
		return false;

	}


	if(my_form.day.value==0)
	{
		alert(dayValid);
		return false;

	}

	if(my_form.month.value==0)
	{
		alert(monthValid);
		return false;

	}

	if(my_form.year.value==0)
	{
		alert(yearValid);
		return false;

	}
	if(my_form.nationality.value==0)
	{
		alert(natValid);
		return false;

	}
	if(my_form.occupation.value==0)
	{
		alert(occValid);
		return false;

	}
	if(my_form.occupation.value != 18 && my_form.occupation.value != 19 && my_form.occupation.value != 20 && my_form.occupation.value != 21 && my_form.industry.value==0)
	{
		alert(indValid);
		return false;

	}

	if(my_form.occupation.value != 21 && my_form.education.value==0)
	{
		alert(eduValid);
		return false;

	}
	if(my_form.occupation.value != 18 && my_form.occupation.value != 19 && my_form.occupation.value != 20 && my_form.occupation.value != 21 && my_form.company_size.value==0)
	{
		alert(comSizeValid);
		return false;

	}
	if(my_form.marital_status.value==0)
	{
		alert(martValid);
		return false;

	}
	if(my_form.children.value==0)
	{
		alert(childValid);
		return false;

	}
	if(my_form.children.value != 6 && my_form.children_household.value==0)
	{
		alert(childPartValid);
		return false;

	}
	if(my_form.mobile.value==0)
	{
		alert(mobValid);
		return false;

	}
	if(my_form.laptop.value==0)
	{
		alert(lapValid);
		return false;

	}
	if(my_form.car.value==0)
	{
		alert(carValid);
		return false;

	}
	if(my_form.credit_card.value==0)
	{
		alert(cridValid);
		return false;

	}
	if(my_form.flights.value==0)
	{
		alert(flightValid);
		return false;

	}


	if(my_form.agree.checked!=true)
	{
		alert(termValid);
		return false;
	}

	my_form.submit();

}

function checkOccupation()
{
	var occ=document.getElementById('occupation');
	var ind=document.getElementById('industry');
	var emp=document.getElementById('company_size');
	var edu=document.getElementById('education');
	var inc=document.getElementById('income');
	
	
	if (occ.selectedIndex==18 || occ.selectedIndex==19 || occ.selectedIndex==20 || occ.selectedIndex==21){
		
		if (occ.selectedIndex==18 || occ.selectedIndex==19 || occ.selectedIndex==21){

			if (occ.selectedIndex==21){
				edu.selectedIndex=0;
				edu.disabled=true;
				

			}
			else{
				edu.disabled=false;
			}
			
			inc.selectedIndex=0;
			inc.disabled=true;

		}
		else{
			inc.disabled=false;
		}
		
		
		
		
		ind.selectedIndex=0;
		//changeInd('false');
		ind.disabled=true;
		emp.selectedIndex=6;
		emp.disabled=true;

	}
	else{
		//changeInd('true');
		ind.disabled=false;
		emp.disabled=false;
	}
	
	
}



function moveToStep(fromStepNum,toStepNum,ip)
{
	
		if (step1Check()){
			ICmakePostRequest('step1_log.php',ip);
		}
		else{
			return false;
		}
	
		my_form=document.getElementById('step1F');
	my_form.submit();

}


function checkChildren()
{
	var children=document.getElementById('children');
	var isChPart=document.getElementById('children_household');

	if (children.selectedIndex==6){
		isChPart.selectedIndex=0;
		//changeChi('false');
		isChPart.disabled=true;

	}
	else{
		//changeChi('true');
		isChPart.disabled=false;
	}
}

function regInitS1(cities, codes, countries){

	if (document.getElementById('city').value==""){
		document.getElementById('country').selectedIndex=1;
	}
	TmakePostRequest(cities,document.getElementById('country'),document.getElementById('city_name'));
	CmakePostRequest(codes,document.getElementById('country'),document.getElementById('op_code'));
	CCmakePostRequest(countries,document.getElementById('country'),document.getElementById('country_codes'));
	document.getElementById('opCode').value='0';


}


function regInitS2(cities, codes, countries){

	checkOccupation();
	checkChildren();
	//checkChildren_acc();
	//checkOccupationedu_acc();
	//checkOccupation_acc();
	//if (document.getElementById('error_in_page').value=="2"){
		//moveToStep('1','2','rep')
	//}


}
