function  ValidFormDetect(){		
	
	if( document.ValidForm.seller != undefined && document.ValidForm.seller.value == "" ){
		
		alert('Please enter name');		
		return false;
	}
	
	if( document.ValidForm.name != undefined && document.ValidForm.name.value == "" ){
		
		alert('Вы не ввели имя');		
		return false;
	}
	if( document.ValidForm.surname != undefined && document.ValidForm.surname.value == "" ){
		
		alert('Please enter surname');		
		return false;
	}
	if( document.ValidForm.patronymic != undefined && document.ValidForm.patronymic.value == "" ){
		
		alert('Please enter patronymic');		
		return false;
	}
		
	if( document.ValidForm.address != undefined && document.ValidForm.address.value == "" ){
		
		alert('Please enter address');		
		return false;
	}
	
	if( document.ValidForm.phone != undefined && document.ValidForm.phone.value == "" ){
		
		alert('Please enter phone number');		
		return false;
	}
	
	if( document.ValidForm.mobile != undefined && document.ValidForm.mobile.value == "" ){
		
		alert('Please enter mobile number');		
		return false;
	}
	
	if( document.ValidForm.fax != undefined && document.ValidForm.fax.value == "" ){
		
		alert('Please enter fax number');		
		return false;
	}
	
	if( document.ValidForm.email != undefined && !IsEmailAddress(document.ValidForm.email.value) ){
		
		alert('Please enter valid email address');		
		return false;
	}
	
	if( document.ValidForm.mail != undefined && !IsEmailAddress(document.ValidForm.mail.value) ){
		
		alert('Пустой или неверный адрес электронной почты.');		
		return false;
	}
	
	if( document.ValidForm.text != undefined && document.ValidForm.text.value == "" ){
		
		alert('Поле для текста пусто.');		
		return false;
	}
	
	if( document.ValidForm.text != undefined && document.ValidForm.text.value.length > 500 ){
		
		alert('Слишком длинный текст (макс. 500 символов).');		
		return false;
	}
	
	if( document.ValidForm.comment != undefined && document.ValidForm.comment.value.length > 500 ){
		
		alert('Слишком длинный текст (макс. 500 символов).');		
		return false;
	}
	
	if( document.ValidForm.ip != undefined && document.ValidForm.ip.value == "" ){
		
		alert('Please enter ip address');		
		return false;
	}
	
	if( document.ValidForm.type != undefined && document.ValidForm.type.value == "" ){
		
		alert('Please select shop type');		
		return false;
	}
	
	if( document.ValidForm.login != undefined && document.ValidForm.login.value == "" ){
		
		alert('Вы не ввели логин.');		
		return false;
	}
		
	if( document.ValidForm.username != undefined && document.ValidForm.username.value == "" ){
		
		alert('Вы не ввели логин.');		
		return false;
	}
	
	if( document.ValidForm.username != undefined && UserExists(document.ValidForm.username.value) == 0 ){
		
		alert('Пользователь с таким логином уже существует.');		
		return false;
	}
	
	
	if( document.ValidForm.manager != undefined && document.ValidForm.manager.value == "" ){
		
		alert('Please enter manager name');		
		return false;
	}
	
	if( document.ValidForm.manager_phone != undefined && document.ValidForm.manager_phone.value == "" ){
		
		alert('Please enter manager phone number');		
		return false;
	}
	
	if( document.ValidForm.manager_phone != undefined && document.ValidForm.manager_phone.value == "" ){
		
		alert('Please enter manager phone number');		
		return false;
	}
	
	
	if( document.ValidForm.password != undefined && (document.ValidForm.password.value.length < 6 || document.ValidForm.password2.value.length < 6 || document.ValidForm.password2.value!=document.ValidForm.password.value) ){
		
		alert('Пароли не совподают или один из них пуст (мин. 6 символов).');		
		return false;
	}
	
	if( document.getElementById("pass_reminder") != undefined && document.getElementById("pass_reminder").value == "" ){
		
		alert('Вы не заполнили поле Запоминание пароля.');		
		return false;
	}
	
	if( document.ValidForm.passport_seria != undefined && document.ValidForm.passport_seria.value == "" ){
		
		alert('Please enter passport seria');		
		return false;
	}
	
	if( document.ValidForm.passport_from != undefined && document.ValidForm.passport_from.value=="" ){
		
		alert('Passport(from) field is empty');		
		return false;
	}
	
	if( document.ValidForm.passport_when != undefined && ( document.ValidForm.passport_when.value == "" || !CheckDate('01.01.70', document.ValidForm.passport_when.value, document.ValidForm.passport_expiration.value, "not future") )  ){		
		
		alert('Passport(when) field is empty or contains wrong value');		
		return false;
	}	
	if( document.ValidForm.passport_expiration != undefined && ( document.ValidForm.passport_expiration.value == "" || !CheckDate(document.ValidForm.today.value, document.ValidForm.passport_expiration.value, document.ValidForm.future20_year.value, "not past") )  ){
		
		alert('Passport expiration date is empty or wrong');		
		return false;
	}	
	
	if( document.ValidForm.date_of_birth != undefined && ( document.ValidForm.passport_expiration.value == "" || !CheckDate(document.ValidForm.min_date_year.value, document.ValidForm.date_of_birth.value, document.ValidForm.passport_when.value, "not future") ) ){
		
		alert('Date of birth is empty or wrong');		
		return false;
	}
	
	
	if( document.ValidForm.social_card != undefined && (document.ValidForm.social_card.value.length!=10 || !CheckSocCard(document.ValidForm.social_card.value, document.ValidForm.date_of_birth.value) ) ){
		
		alert('Wrong or empty social card number');		
		return false;
	}
	
	
	
	if( document.ValidForm.registration_city != undefined && document.ValidForm.registration_city.value == "" ){
		
		alert('Please enter registration city');		
		return false;
	}
	if( document.ValidForm.registration_street != undefined && document.ValidForm.registration_street.value == "" ){
		
		alert('Please enter registration street');		
		return false;
	}
	if( document.ValidForm.registration_house != undefined && document.ValidForm.registration_house.value == "" ){
		
		alert('Please enter registration building');		
		return false;
	}	
	/*if( document.ValidForm.registration_sub_house != undefined && document.ValidForm.registration_sub_house.value == "" ){
		
		alert('Please enter registration sub building');		
		return false;
	}*/	
	if( document.ValidForm.registration_flat != undefined && document.ValidForm.registration_flat.value == "" ){
		
		alert('Please enter registration flat');		
		return false;
	}
	
	
	if( document.ValidForm.fact_registration_city != undefined && document.ValidForm.fact_registration_city.value == "" ){
		
		alert('Please enter factual registration city');		
		return false;
	}
	if( document.ValidForm.fact_registration_street != undefined && document.ValidForm.fact_registration_street.value == "" ){
		
		alert('Please enter factual registration street');		
		return false;
	}
	if( document.ValidForm.fact_registration_house != undefined && document.ValidForm.fact_registration_house.value == "" ){
		
		alert('Please enter factual registration building');		
		return false;
	}
	/*if( document.ValidForm.fact_registration_sub_house != undefined && document.ValidForm.fact_registration_sub_house.value == "" ){
		
		alert('Please enter factual registration sub building');		
		return false;
	}	*/
	if( document.ValidForm.fact_registration_flat != undefined && document.ValidForm.fact_registration_flat.value == "" ){
		
		alert('Please enter factual registration flat');		
		return false;
	}	
	
	
	if( document.ValidForm.family != undefined && document.ValidForm.family.value == "" ){
		
		alert('Please enter family persons number');		
		return false;
	}
	
	
	if( document.ValidForm.telephone_home != undefined && document.ValidForm.telephone_home.value == "" ){
		
		alert('Please enter home telephone number');		
		return false;
	}
	if( document.ValidForm.telephone_work != undefined && document.ValidForm.telephone_work.value == "" ){
		
		alert('Please enter work telephone number');		
		return false;
	}
	if( document.ValidForm.telephone_other != undefined && document.ValidForm.telephone_other.value == "" ){
		
		alert('Please enter other telephone number');		
		return false;
	}
	
	
	
	if( document.ValidForm.work_place != undefined && document.ValidForm.work_place.value == "" ){
		
		alert('Please enter work place');		
		return false;
	}
	if( document.ValidForm.work_post != undefined && document.ValidForm.work_post.value == "" ){
		
		alert('Please enter work post');		
		return false;
	}
	if( document.ValidForm.work_salary != undefined && document.ValidForm.work_salary.value == "" ){
		
		alert('Please enter work salary');		
		return false;
	}
	
	if( (document.ValidForm.work_salary_1 != undefined && document.ValidForm.work_salary_1.value == "") || (document.ValidForm.work_salary_2 != undefined && document.ValidForm.work_salary_2.value == "") ){
		
		alert('Invalid work salary');		
		return false;
	}
	
	
	if( (document.ValidForm.total_sum_1 != undefined && document.ValidForm.total_sum_1.value == "") || (document.ValidForm.total_sum_2 != undefined && document.ValidForm.total_sum_2.value == "") ){
		
		alert('Invalid total sum');		
		return false;
	}
	if( (document.ValidForm.loan_sum_1 != undefined && document.ValidForm.loan_sum_1.value == "") || (document.ValidForm.loan_sum_2 != undefined && document.ValidForm.loan_sum_2.value == "") ){
		
		alert('Invalid loan sum');		
		return false;
	}
	if( (document.ValidForm.advance_payment_1 != undefined && document.ValidForm.advance_payment_1.value == "") || (document.ValidForm.advance_payment_2 != undefined && document.ValidForm.advance_payment_2.value == "") ){
		
		alert('Invalid advance payment');		
		return false;
	}
	if( (document.ValidForm.month_payment_1 != undefined && document.ValidForm.month_payment_1.value == "") || (document.ValidForm.month_payment_2 != undefined && document.ValidForm.month_payment_2.value == "") ){
		
		alert('Invalid month payment');		
		return false;
	}
	
	
	
	if( document.ValidForm.stat_pasport != undefined && document.ValidForm.stat_pasport.checked != true ){
		
		alert('Passport copy not checked');		
		return false;
	}
	if( document.ValidForm.stat_soc_card != undefined && document.ValidForm.stat_soc_card.checked != true ){
		
		alert('Soc. card copy not checked');		
		return false;
	}	
	if( document.ValidForm.stat_work != undefined && document.ValidForm.stat_work.checked != true ){
		
		alert('Inquiry from work place not checked');		
		return false;
	}
	if( document.ValidForm.stat_true != undefined && document.ValidForm.stat_true.checked != true ){
		
		alert('All data are true not checked');		
		return false;
	}
	
	
	
	if( document.ValidForm.title != undefined && document.ValidForm.title.value == "" ){
		
		alert('Please write title');		
		return false;
	}
	
	if( document.ValidForm.message != undefined && document.ValidForm.message.value == "" ){
		
		alert('Please write message');		
		return false;
	}
	
	
	if( 
			document.ValidForm.credit_managers != undefined && 
			document.ValidForm.shop_managers != undefined && 
			document.ValidForm.shop_sellers != undefined  && 
			
			(
				document.ValidForm.credit_managers.value=="" && 
				document.ValidForm.shop_managers.value=="" && 
				document.ValidForm.shop_sellers.value==""
			) 
		){
		
		alert('Please select addressees');		
		return false;
	}	
	
	
	if( document.ValidForm.prod_1 != undefined && document.ValidForm.prod_1.value == "0" ){
		
		alert('Prouct type is invalid');		
		return false;
	}
	if( document.ValidForm.name_1 != undefined && document.ValidForm.name_1.value == "" ){
		
		alert('Prouct name is empty');		
		return false;
	}
	if( document.ValidForm.quantity_1 != undefined && document.ValidForm.quantity_1.value == "" ){
		
		alert('Prouct quantity is empty');		
		return false;
	}
	if( document.ValidForm.price_1 != undefined && document.ValidForm.price_1.value == "" ){
		
		alert('Prouct price is empty');		
		return false;
	}
	
	
	if( 
	
		document.ValidForm.new_password != undefined && 
		(
			document.ValidForm.new_password.value == "" ||
			document.ValidForm.re_new_password.value == "" ||	
			document.ValidForm.re_new_password.value != document.ValidForm.new_password.value ||
			document.ValidForm.new_password.length < 6				
		)
		
	){
		
		alert('Invalid new password values, maybe fields are not same or empty. \n Minimum length of password is 6 simbols');		
		return false;
	}
	
	if( document.ValidForm.old_password != undefined && document.ValidForm.old_password.value == ""){
		
		alert('New password field is empty');		
		return false;
	}
	
	if( document.ValidForm.percent != undefined && document.ValidForm.percent.value == "" ){
		
		alert('Loan prouct is empty');		
		return false;
	}
	
	return true;
}




function IsEmailAddress(mail){
	
	var addressPattern = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
	return addressPattern.test(mail);
}


function ValidChars(e, goods) {
	
	var key, keychar;
	key = (window.event) ? window.event.keyCode : ((e) ? e.which : null);
	if (key == null) return true;
 
	keychar = String.fromCharCode(key);
	keychar = keychar.toLowerCase();
	goods = goods.toLowerCase();
 
	if (goods.indexOf(keychar) != -1)
		return true;
 
	if (key==null || key==0 || key==8 || key==9 || key==13 || key==27)
		return true;
 
	return false;
}