function sese(form) {
	ff = document.search.zapros.value;


	if (ff == "") {
		alert("Введите, пожалуйста, запрос");
		return false; 	}
    if  (ff.length < 2 || ff.length >64 ) {
		alert("Запрос не должен быть меньше 2 символов и больше 64!");
		return false; 	}
	else return true;
}

function createPictureWindow(Path,Width,Height,Title)
{
	var p = Math.ceil(Math.random()*10000);
	var q = Math.ceil(Math.random()*p);
	windowName = p+'X'+(Width*p)+(Height*q);
	WinFeatures = "top="+(screen.height-Height)/2+",left="+(screen.width-Width)/2+",width="+Width+",height="+Height+",Status=no,toolbar=no,menubar=no,location=no,directories=no,scrollbars=no";
	w = window.open("",windowName,WinFeatures);
	w.document.open();
	w.document.write('<head><title>Картинка</title><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"></head>');
	w.document.write("<body bgcolor='#FFFFFF' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'><img src='"+Path+"' height='"+Height+"' width='"+Width+"' alt='&quot;"+Title+"&quot;'></body>"); 
	w.document.close();
}

function formValid(form) {
	f1 = document.forms[form].author.value;
	f2 = document.forms[form].message.value;

	if (f1 == "") {
		alert("Введите, пожалуйста, Ваше имя");
		return false;
	}
 	else if (f2 == "") {
		alert("Введите, пожалуйста, Ваше сообщение");
		return false;
	}
	else return true;
}

function guestfun(form) {
	ff1 = document.forms[form].gname.value;
	ff2 = document.forms[form].gmessage.value;

	if (ff1 == "") {
		alert("Введите, пожалуйста, Ваше имя");
		return false;
	}
   	else if (ff2 == "") {
		alert("Введите, пожалуйста, Ваше сообщение");
		return false;
	}
	else return true;
}

function formCallValid(form) {
	f1 = document.forms[form].elements['call[Фамилия]'].value;
	f2 = document.forms[form].elements['call[Имя]'].value;
	f3 = document.forms[form].elements['call[Отчество]'].value;
	f4 = document.forms[form].elements['call[Телефон]'].value;
	f5 = document.forms[form].elements['call[Дата]'].value;

	if (f1 == "") { alert("Введите, пожалуйста, Вашу фамилию"); return false; }
 	else if (f2 == "") { alert("Введите, пожалуйста, Ваше имя"); return false; }
	else if (f3 == "") { alert("Введите, пожалуйста, Ваше отчество"); return false; }
	else if (f4 == "") { alert("Введите, пожалуйста, Ваш телефон"); return false; }
	else if (f5 == "") { alert("Введите, пожалуйста, дату замера"); return false; }
	else return true;
}

function createDynamicWindow(Path,Width,Height,Title)
{
	var p = Math.ceil(Math.random()*10000);
	var q = Math.ceil(Math.random()*p);
	windowName = p+'X'+(Width*p)+(Height*q);
	WinFeatures = "top="+(screen.height-Height)/2+",left="+(screen.width-Width)/2+",width="+Width+",height="+Height+",Status=no,toolbar=no,menubar=no,location=no,directories=no,scrollbars=yes";
	w = window.open("",windowName,WinFeatures);
	w.document.open();
	w.document.write('<head><title>Картинка</title><meta http-equiv="Content-Type" content="text/html; charset=windows-1251"></head>');
	w.document.write("<body bgcolor='#FFFFFF' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'><img src='"+Path+"' height='"+Height+"' width='"+Width+"' alt='&quot;"+Title+"&quot;'></body>");
	w.document.close();
}



function MakeImageArray(n)	{
	this.length=n;
	for (var i=0; i<=n; i++) this[i] = new Image()
	return this	}

// Проверка содержимого полей формы заказа
function orderValid(form)
{
	element = document.forms[form].elements;
	Name = element.contact_name.value;
	Phone = element.phone_mobile.value+element.phone_work.value+element.phone_home.value;

	if (Name == "") {
		alert("Введите, пожалуйста, Ваше имя");
		return false;
	}
 	else if (Phone == "") {
		alert("Введите, пожалуйста, хотя бы один телефон");
		return false;
	}	
	else return true;
}

function createDescriptionWindow(_file,_width,_height)
{
	wTop = (screen.height-_height)/3;
	wLeft = (screen.width-_width)/2;
	WinFeatures = "top="+wTop+",left="+wLeft+",width="+_width+",height="+_height+",maximize=no,minimize=no,Status=no,toolbar=no,menubar=no,location=no,directories=no,scrollbars=yes,resize=no";
	_newDescription = window.open(_file,"frontendDescriptionWindow",WinFeatures);
}
