// JavaScript Document

function isNumberKey(evt)
{
 var charCode = (evt.which) ? evt.which : event.keyCode
 if (charCode > 31 && (charCode < 48 || charCode > 57))
	return false;

 return true;
}

function checkForm(form){
	var chekmail = /([0-9a-zA-Z\.-_]+)@([0-9a-zA-Z\.-_]+)/;

	var name, phone, email, comment, string, isOk = true;
	var message = "";
	
	message = "Пожалуйста, заполните следующие поля: ";
	
	name	= form.name.value;	
	phone	= form.phone.value;
	email	= form.email.value;
	comment	= form.comment.value;	
	string	= form.string.value;

	if (name.length == 0){
		message += "\n - Имя;";
		form.name.focus();
		isOk=false;
	}
	if (phone.length == 0){
		message += "\n - Телефон;";
		form.phone.focus();
		isOk=false;
	}
	if (email.length < 5){
		message += "\n - E-mail;";
		form.email.focus();
		isOk=false;
	}	
	else if (email.length >= 5 && email.match(chekmail) == null){
		message ="Неправильный адрес электронной почты";
		form.email.focus();
	   	isOk=false;
	}
	if (comment.length == 0){
		message += "\n - Запрос;";
		form.comment.focus();
		isOk=false;
	}
	if (string.length == 0){
		message += "\n - Анти-спам кода";
		form.string.focus();
		isOk=false;
	}

	if (!isOk){			   
	   	alert(message);
	   	return isOk;
	} else {
		return isOk;
	}
}

function disableFunc(zemValue) {
	document.getElementById("rooms").disabled = false;
	if(zemValue==6) {
  		document.getElementById("rooms").disabled = true;
		document.getElementById("rooms").value = "";
	}
}