function fieldValidation(formName) {
  if(formName=="experienceForm"){
	if (document.experienceForm.start_month.value == -1) {
		alert("Lütfen işe başlama tarihini giriniz.");
		experienceForm.elements["start_month"].focus();
		return false;
	}
	if (document.experienceForm.start_year.value == -1) {
		alert("Lütfen işe başlama tarihini giriniz.");
		experienceForm.elements["start_year"].focus();
		return false;
	}
	if (document.experienceForm.company_name.value.length == 0) {
		alert("Lütfen firma adini giriniz.");
		experienceForm.elements["company_name"].focus();
		return false;
	}
	if (document.experienceForm.company_sector_id.value.length == 0) {
		alert("Lütfen bir sektör seçiniz.");
		experienceForm.elements["company_sector_id"].focus();
		return false;
	}
	if (document.experienceForm.department_id.value.length == 0) {
		alert("Lütfen bir departman seçiniz.");
		experienceForm.elements["department_id"].focus();
		return false;
	}
	if (document.experienceForm.job_title.value.length == 0) {
		alert("Lütfen pozisyon giriniz.");
		experienceForm.elements["job_title"].focus();
		return false;
	}
	if (document.experienceForm.company_country_id.value.length == 0) {
		alert("Lütfen bir ülke seçiniz.");
		experienceForm.elements["company_country_id"].focus();
		return false;
	}
	if (!document.experienceForm.company_city && !document.experienceForm.city_other) {
		alert("Lütfen şehir giriniz.");
		return false;
	}
	if (document.experienceForm.company_city && document.experienceForm.company_city.value.length == 0) {
		alert("Lütfen şehir giriniz.");
		return false;
	}
	if (document.experienceForm.city_other && document.experienceForm.city_other.value.length == 0) {
		alert("Lütfen şehir giriniz.");
		return false;
	}
	if (document.experienceForm.work_type_id.value.length == 0) {
		alert("Lütfen çalısma şeklinizi seçiniz.");
		experienceForm.elements["work_type_id"].focus();
		return false;
	}	
  return true;
  
}else if(formName=="referenceForm"){
	if (document.referenceForm.name.value.length == 0) {
		alert("Lütfen referans adını giriniz.");
		referenceForm.elements["name"].focus();
		return false;
	}
	if (document.referenceForm.surname.value.length == 0) {
		alert("Lütfen referans soyadını  giriniz.");
		referenceForm.elements["surname"].focus();
		return false;
	}
	if (document.referenceForm.company.value.length == 0) {
		alert("Lütfen firma adını giriniz.");
		referenceForm.elements["company"].focus();
		return false;
	}
	if (document.referenceForm.title.value.length == 0) {
		alert("Lütfen referans kişinin görev tanımını giriniz.");
		referenceForm.elements["title"].focus();
		return false;
	}
	if (document.referenceForm.phone.value.length == 0) {
		alert("Lütfen telefon numarasını giriniz.");
		referenceForm.elements["phone"].focus();
		return false;
	}
return true;


}else if(formName=="trainingForm"){
	if (document.trainingForm.name.value.length == 0) {
		alert("Lütfen kurs adını giriniz.");
		trainingForm.elements["name"].focus();
		return false;
	}
	if (document.trainingForm.company.value.length == 0) {
		alert("Lütfen alinan kurumun adını giriniz.");
		trainingForm.elements["company"].focus();
		return false;
	}
	if (document.trainingForm.duration.value.length == 0) {
		alert("Lütfen kursun süresini giriniz.");
		trainingForm.elements["duration"].focus();
		return false;
	}
	if (document.trainingForm.year.value.length == 0) {
		alert("Lütfen kurs/sertifikanın alındığı yılı giriniz.");
		trainingForm.elements["year"].focus();
		return false;
	}
	
	if (document.trainingForm.year.value.length < 4 || (!IsNumeric(document.trainingForm.year.value))) {
		alert("Kurs/sertifikanın alındığı yıl formatı hatalı!");
		trainingForm.elements["year"].focus();
		return false;
	}	
return true;


}else if(formName=="educationForm"){
	if (document.educationForm.education_type.value.length == 0) {
		alert("Lütfen eğitim tipini seçiniz.");
		educationForm.elements["education_type"].focus();
		return false;
	}
	if ((document.educationForm.school_name.value.length == 0 && document.educationForm.school_name_text.value.length == 0)
		|| document.educationForm.school_name.value == "other" && document.educationForm.school_name_text.value.length == 0) {
		alert("Lütfen okul adını giriniz.");
		educationForm.elements["school_name"].focus();
		return false;
	}
	if ((document.educationForm.department.value.length == 0 && document.educationForm.department_text.value.length == 0)
		|| document.educationForm.department.value == "other" && document.educationForm.department_text.value.length == 0) {
		alert("Lütfen bölüm adını giriniz.");
		educationForm.elements["department"].focus();
		return false;
	}
	if (document.educationForm.end_date.value.length == 0) {
		alert("Lütfen mezuniyet/terk yılını giriniz.");
		educationForm.elements["end_date"].focus();
		return false;
	}
	if (document.educationForm.end_date.value.length < 4 || (!IsNumeric(document.educationForm.end_date.value))) {
		alert("Mezuniyet yılı formatı hatalı!");
		educationForm.elements["end_date"].focus();
		return false;
	}
		
	if(!IsNumeric(document.educationForm.end_date.value)){
		alert("Lütfen mezuniyet yılını giriniz.");	
		educationForm.elements["end_date"].focus();
		return false;	
	}

	if(document.educationForm.degree.value.length > 0 && (!IsNumeric(document.educationForm.degree.value))){
		alert("Mezuniyet derecesi formatı hatalı!");	
		educationForm.elements["degree"].focus();
		return false;	
	}
return true;
}
else if(formName=="educationFormUpdateUpdate"){
	if (document.educationFormUpdate.education_type.value.length == 0) {
		alert("Lütfen eğitim tipini seçiniz.");
		educationFormUpdate.elements["education_type"].focus();
		return false;
	}
	if ((document.educationFormUpdate.school_name.value.length == 0 && document.educationFormUpdate.other_school_name_text.value.length == 0)
		|| document.educationFormUpdate.school_name.value == "other" && document.educationFormUpdate.other_school_name_text.value.length == 0) {
		alert("Lütfen okul adını giriniz.");
		educationFormUpdate.elements["school_name"].focus();
		return false;
	}
	if ((document.educationFormUpdate.department.value.length == 0 && document.educationFormUpdate.other_department_text.value.length == 0)
		|| document.educationFormUpdate.department.value == "other" && document.educationFormUpdate.other_department_text.value.length == 0) {
		alert("Lütfen okul adını giriniz.");
		educationFormUpdate.elements["school_name"].focus();
		return false;
	}
	if (document.educationFormUpdate.end_date.value.length == 0) {
		alert("Lütfen mezuniyet yılını giriniz.");
		educationFormUpdate.elements["end_date"].focus();
		return false;
	}
	if (document.educationFormUpdate.end_date.value.length < 4 || (!IsNumeric(document.educationFormUpdate.end_date.value))) {
		alert("Mezuniyet yılı formatı hatalı!");
		educationFormUpdate.elements["end_date"].focus();
		return false;
	}
		
	if(!IsNumeric(document.educationFormUpdate.end_date.value)){
		alert("Lütfen mezuniyet yılını giriniz.");	
		educationFormUpdate.elements["end_date"].focus();
		return false;	
	}

	if(document.educationFormUpdate.degree.value.length > 0 && (!IsNumeric(document.educationFormUpdate.degree.value))){
		alert("Mezuniyet derecesi formatı hatalı!");	
		educationFormUpdate.elements["degree"].focus();
		return false;	
	}
return true;
}

else{
return true;	
}
}

function IsNumeric(sText)

{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;
 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
}


function paymentValidation() {
	
  	if (document.memberForm.subs_type.value == "") {
		alert("Lütfen Üyelik Periyodunu seçiniz.");
		memberForm.elements["subs_type"].focus();
		return false;
	}
	if (document.memberForm.company_name.value == "") {
		alert("Lütfen şirket adını giriniz.");
		memberForm.elements["company_name"].focus();
		return false;
	}
	if (document.memberForm.name_surname.value.length == 0) {
		alert("Lütfen ad ve soyadınızı giriniz");
		memberForm.elements["name_surname"].focus();
		return false;
	}
	if (document.memberForm.email.value.length == 0) {
		alert("Lütfen email adresinizi giriniz.");
		memberForm.elements["email"].focus();
		return false;
	}
	if (document.memberForm.phone.value.length == 0) {
		alert("Lütfen telefon numarasını giriniz.");
		memberForm.elements["phone"].focus();
		return false;
	}
	if (document.memberForm.address.value.length == 0) {
		alert("Lütfen adres bilgisini giriniz.");
		memberForm.elements["address"].focus();
		return false;
	}
	if (document.memberForm.state.value.length == 0) {
		alert("Lütfen ilçe bilgisini giriniz.");
		memberForm.elements["state"].focus();
		return false;
	}
	if (document.memberForm.city.value.length == 0) {
		alert("Lütfen şehir giriniz.");
		memberForm.elements["city"].focus();
		return false;
	}
	if (document.memberForm.tax_office.value.length == 0) {
		alert("Lütfen vergi dairesi bilgisini giriniz.");
		memberForm.elements["tax_office"].focus();
		return false;
	}
	if (document.memberForm.tax_no.value.length == 0) {
		alert("Lütfen vergi numaranızı giriniz.");
		memberForm.elements["tax_no"].focus();
		return false;
	}
	if (document.memberForm.payment_type.value == 'credit') {

		if (document.memberForm.card_number.value.length == 0) {
			alert("Lütfen kredi kartı numarasını giriniz.");
			memberForm.elements["card_number"].focus();
			return false;
		}
		if (document.memberForm.security_code.value.length == 0) {
			alert("Lütfen kredi kartı güvenlik numarasını giriniz.");
			memberForm.elements["security_code"].focus();
			return false;
		}
		if (document.memberForm.exp_month.value.length == 0) {
			alert("Lütfen kredi kartı son kullanma tarihini seçiniz.");
			memberForm.elements["exp_month"].focus();
			return false;
		}
		if (document.memberForm.exp_year.value.length == 0) {
			alert("Lütfen kredi kartı son kullanma tarihini seçiniz.");
			memberForm.elements["exp_year"].focus();			
			return false;
		}
	}	
  return true;  
}
