function WhereToBuyF(MF){
	//alert(MF.metro.options[MF.metro.selectedIndex].value);
	wwidth = 600;
	wheight = 500;
	wtop = (window.screen.height-wheight)/2;
	wleft =(window.screen.width-wwidth)/2;
	wname = "where";
	oppageurl = "/wheretobye.asp?pns="+MF.metro.options[MF.metro.selectedIndex].value;
	//oppageurl = "/popup_info.html";
	wind=window.open(oppageurl, wname, "location=no, menubar=no, scrollbars=yes, toolbar=no, status = no, resizable=no, directories=no, width="+wwidth+",left="+wleft+", height="+wheight+", top="+wtop);
	wind.focus();

	return false;
}

function WhereToBuy(pns){
	//alert(MF.metro.options[MF.metro.selectedIndex].value);
	wwidth = 300;
	wheight = 300;
	wtop = (window.screen.height-wheight)/2;
	wleft =(window.screen.width-wwidth)/2;
	wname = "where";
	oppageurl = "/wheretobye.asp?pns="+pns;
	//oppageurl = "/popup_info.html";
	wind=window.open(oppageurl, wname, "location=no, menubar=no, scrollbars=yes, toolbar=no, status = no, resizable=no, directories=no, width="+wwidth+",left="+wleft+", height="+wheight+", top="+wtop);
	wind.focus();

	return false;
}

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(MF, Len100, Len1000)
	{	
	FIO = Trim(MF.FIO.value);
	Email = Trim(MF.Email.value);
	zapr = Trim(MF.zapr.value);
	
	if (FIO == "" || FIO.length > Len100)
		{
		alert("Поле \"Ваше имя\" не должно быть пустым. Длина поля не должна превышать " + Len100 + " символов.");
		MF.FIO.focus();
		return false;
		}
	if (checkmail(Email)!=2 || Trim(Email).length > Len100)
		{
		alert("Неправильно заполнено поле \"Ваш e-mail\".");
		MF.Email.focus();
		return false;
		}
	if (zapr == "" || zapr.length > Len1000){
		alert("Поле \"Ваш вопрос\" не должно быть пустым. Длина поля не должна превышать " + Len1000 + " символов.");
		MF.zapr.focus();
		return false;
	}
	return true;
}

//Проверка формы аторизации
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)=="")
		{
		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();
}
