function findclick(ff){
	//alert (ff.value + "|")
	if (ff.value=="поиск по сайту"){
		ff.value = "";
		ff.style.color = "#000000";
	}
}
function findcatclick(ff, strrep){
	if (ff.value==strrep){
		ff.value = "";
		ff.style.color = "#000000";
	}
}
function findcatblur(ff, strrep){
	if (ff.value==""){
		ff.value = strrep;
		ff.style.color = "#c0c0c0";
	}
}


function Chfemail(subf)
	{
	if (checkmail(subf.sEmail.value)!=2)
		{
		alert("Неправильно введен Email");
		subf.sEmail.focus();
		return false;
		}
	}

function FlashResize(nsize){
	el = document.getElementById("flashmenu");
	//alert(el.height);
	el.height = nsize;
}

//проверка значения формы
function FormValidatorQuest(fName)
	{	
	var MF = document.getElementById(fName);
	t = MF.what.value;
	FIO1 = Trim(MF.FIO1.value);
	FIO2 = "";
	if (t=='1') FIO2 = Trim(MF.FIO2.value);
	Email = Trim(MF.Email.value);
	Question = Trim(MF.Question.value);
	
	if (FIO1 == "")
		{
		alert("Поле \"" + ((t=='1')? "Фамилия" : "Ваше имя") + "\" не должно быть пустым.");
		MF.FIO1.focus();
		return;
		}
	if (FIO2 == "" && t=='1')
		{
		alert("Поле \"Имя\" не должно быть пустым.");
		MF.FIO2.focus();
		return;
		}
	if (checkmail(Email)!=2)
		{
		alert("Неправильно заполнено поле \"Эл. почта\".");
		MF.Email.focus();
		return;
		}
	if (Question == ""){
		alert("Поле \"Текст вопроса\" не должно быть пустым.");
		MF.Question.focus();
		return;
	}
	MF.submit()
}

//Проверка формы аторизации
function FormValidatorLogin(MF){
	login = Trim(MF.login.value);
	pass = Trim(MF.pass.value);
	if (login == "")
		{
		alert("Поле \"логин\" не должно быть пустым.");
		MF.login.focus();
		return false;
		}
	if (pass == "")
		{
		alert("Поле \"пароль\" не должно быть пустым.");
		MF.pass.focus();
		return false;
		}
	return true;
}

//проверка значения формы
function FormValidatorSendMess(MF, Len100)
	{	
	FIO = Trim(MF.FIO.value);
	phone = Trim(MF.phone.value);
	Email = Trim(MF.Email.value);
	zapr = Trim(MF.zapr.value);
	
	if (FIO == "")
		{
		alert("Поле \"Ваше имя\" не должно быть пустым.");
		MF.FIO.focus();
		return false;
		}
	if (phone == "")
		{
		alert("Поле \"Контактный телефон\" не должно быть пустым.");
		MF.phone.focus();
		return false;
		}
	if (checkmail(Email)!=2 || Trim(Email).length > Len100)
		{
		alert("Неправильно заполнено поле \"E-mail\".");
		MF.Email.focus();
		return false;
		}
	if (zapr == "")
		{
		alert("Поле \"Ваш вопрос\" не должно быть пустым.");
		MF.zapr.focus();
		return false;
		}
	return true;
}

//проверка формы поиска
function FormValidatorSearch(MF)
	{
	if (Trim(MF.srch.value)=="" || Trim(MF.srch.value)=="Поиск продукции")
		{
		alert("Введите строку для поиска.");
		MF.srch.focus();
		return false;
		}
	return true;
	}

function selch(selind)
	{	
	document.forms['Srch'].istodb.value = "no";
	document.forms['Srch'].action = "/catalog.asp";
	document.forms['Srch'].submit();
	}

function selchS(selind)
	{	
	document.forms['Srch'].istodb.value = "no";
	document.forms['Srch'].submit();
	}
	
//Картинка в отдельном окне
function ShPhoto(razd, pict, imgw, imgh)
	{
	wwidth = imgw;
	wheight = imgh;
	//if (parseInt(wwidth) < 200)
	//	wwidth = 200
	//if (parseInt(wheight) < 200)
	//	wheight = 200
	wtop = (window.screen.height-wheight)/2;
	wleft =(window.screen.width-wwidth)/2;
	if (wwidth < 100){
		leftM = parseInt((100 - wwidth)/2);
		rightM = parseInt((100 - wwidth)/2);
	}else{
		leftM = 0;
		rightM = 0;
	}
	if (wheight < 100){
		topM = parseInt((100 - wheight)/2);
		bottomM = parseInt((100 - wheight)/2);
	}else{
		topM = 0;
		bottomM = 0;
	}
	wname = "Pict";
	oppageurl = "/shPhoto.asp?razd="+razd+"&pict="+pict + "&leftM=" + leftM + "&rightM=" + rightM  + "&topM=" + topM + "&bottomM=" + bottomM;
	//oppageurl = "/popup_info.html";
	wind=window.open(oppageurl, wname, "location=no, menubar=no, scrollbars=no, toolbar=no, status = no, resizable=no, directories=no, width="+wwidth+",left="+wleft+", height="+wheight+", top="+wtop);
	wind.focus();
}

//Картинка в отдельном окне
function ChPhoto(pict, imgw, imgh){
	try{
		el = document.getElementById("galocolor");
		//alert(el.src);
		el.src = escape(pict);
		if (imgw!=0 && imgh!=0){
			el.width = imgw;
			el.height = imgh;
		}
		/*else{
			el.width = "";
			el.height = "";
		}*/
		
	}
	catch(e){}
}

//Картинка в отдельном окне
function ShPhotoS(razd, pict, imgw, imgh)
	{
	wwidth = imgw;
	wheight = imgh;
	//if (parseInt(wwidth) < 200)
	//	wwidth = 200
	//if (parseInt(wheight) < 200)
	//	wheight = 200
	wtop = (window.screen.height-wheight)/2;
	wleft =(window.screen.width-wwidth)/2;
	if (wwidth < 100){
		leftM = parseInt((100 - wwidth)/2);
		rightM = parseInt((100 - wwidth)/2);
	}else{
		leftM = 0;
		rightM = 0;
	}
	if (wheight < 100){
		topM = parseInt((100 - wheight)/2);
		bottomM = parseInt((100 - wheight)/2);
	}else{
		topM = 0;
		bottomM = 0;
	}
	wname = "Pict";
	oppageurl = "/shPhotoS.asp?razd="+razd+"&pict="+pict + "&leftM=" + leftM + "&rightM=" + rightM  + "&topM=" + topM + "&bottomM=" + bottomM;
	//oppageurl = "/popup_info.html";
	wind=window.open(oppageurl, wname, "location=no, menubar=no, scrollbars=no, toolbar=no, status = no, resizable=no, directories=no, width="+wwidth+",left="+wleft+", height="+wheight+", top="+wtop);
	wind.focus();
}

//Картинка в отдельном окне
function ShPhotoG(razd, pict, imgw, imgh)
	{
	wwidth = imgw;
	wheight = imgh;
	//if (parseInt(wwidth) < 200)
	//	wwidth = 200
	//if (parseInt(wheight) < 200)
	//	wheight = 200
	wtop = (window.screen.height-wheight)/2;
	wleft =(window.screen.width-wwidth)/2;
	if (wwidth < 100){
		leftM = parseInt((100 - wwidth)/2);
		rightM = parseInt((100 - wwidth)/2);
	}else{
		leftM = 0;
		rightM = 0;
	}
	if (wheight < 100){
		topM = parseInt((100 - wheight)/2);
		bottomM = parseInt((100 - wheight)/2);
	}else{
		topM = 0;
		bottomM = 0;
	}
	wname = "Pict";
	oppageurl = "/shPhotog.asp?razd="+razd+"&pict="+pict + "&leftM=" + leftM + "&rightM=" + rightM  + "&topM=" + topM + "&bottomM=" + bottomM;
	//oppageurl = "/popup_info.html";
	wind=window.open(oppageurl, wname, "location=no, menubar=no, scrollbars=no, toolbar=no, status = no, resizable=no, directories=no, width="+wwidth+",left="+wleft+", height="+wheight+", top="+wtop);
	wind.focus();
}
