// JavaScript Document
// --------------------------------------------
// Validates the form
var submitButton = null;

function validateOnSubmit(obj) {
  undoAutoformat(obj);
  if ((submitButton == 'cancel') || (submitButton == 'back')) {
	  return true;
  }
    var errs=0;
    // execute all element validations in reverse order, so focus gets set to the first one in error.
	if (!validateRequired('comments', 'inf_comments', 'Boş bırakamazsınız.',true)) {
		errs ++; 
	}
	
	if (!validateRequired('email', 'inf_email', 'Eposta geçersiz.', true)) {
		errs ++; 
	}
	
	if (!validatePhone('mobilephone', 'inf_mobilephone', 'Telefon numarası "0" ile başlamalı, 11 rakamdan oluşmalıdır.', true)) {
		errs ++; 
	}
	
	if (!validatePhone('homephone', 'inf_homephone', 'Telefon numarası "0" ile başlamalı, 11 rakamdan oluşmalıdır.', true)) {
		errs ++; 
	}
	
	if (!validateRequired ('lastname', 'inf_lastname', 'Boş bırakamazsınız.',true)) {
		errs ++; 
	}
	
	if (!validateRequired('firstname', 'inf_firstname', 'Boş bırakamazsınız.',true)) {
		errs ++; 
	}
	
    if (errs > 0) {
		doAutoformat();
	}
	
    return (errs==0);
}
