function OnImageClick(oThis, pk)
{
var currentLocation = "";
var wndChild = null;
var NN4 = document.layers;
var IE4 = document.all;
var NN6 = document.getElementById && !IE4;

	width = 890;
	height = 700;

	var href = "rostovie_kukli?category="+pk;
  var position = "";
	if (NN4 || IE4 || NN6)
	{
		posX = Math.round((screen.width - width) / 2);
		posY = Math.round((screen.height - height) / 2);
		position = (NN4 || NN6) ? ",screenX=" + posX + ",screenY=" + posY : ",left=" + posX + ",top=" + posY;
	}

	wndChild = window.open(href, "_blank", "height="+height+",width="+width+",status=yes,toolbar=no,scrollbars=yes,menubar=no,location=no,resizable=yes"+position);
	
	return false;          
}
function OnImageClick2(oThis, pk)
{
var currentLocation = "";
var wndChild = null;
var NN4 = document.layers;
var IE4 = document.all;
var NN6 = document.getElementById && !IE4;

	width = 700;
	height = 600;

	var href = "rostovie_kukli?category="+pk+"&zakaz=1";
  var position = "";
	if (NN4 || IE4 || NN6)
	{
		posX = Math.round((screen.width - width) / 2);
		posY = Math.round((screen.height - height) / 2);
		position = (NN4 || NN6) ? ",screenX=" + posX + ",screenY=" + posY : ",left=" + posX + ",top=" + posY;
	}

	wndChild = window.open(href, "_blank", "height="+height+",width="+width+",status=yes,toolbar=no,scrollbars=yes,menubar=no,location=no,resizable=yes"+position);
	
	return false;          
}
              function validate(_form, user_name, email_fieldname) {
              	var required_fields = false;
              	var focus_key = false;
              	var i;
              	
                 // проверка незаполненных инпутов
              	for (i = 0; i < _form.length; i++) {
              		if (_form[i].getAttribute("required") == "true") {
              			if (_form[i].value == "") {
              				required_fields = true;
              				if (_form[i].style.backgroundColor && !_form[i].getAttribute('t_color'))
              					_form[i].setAttribute('t_color', _form[i].style.backgroundColor)
              				else
              					_form[i].setAttribute('t_color', '*');
              			 	_form[i].style.backgroundColor = '#ffcccc';
              				if (!focus_key) {
              					_form[i].focus();
              					focus_key = true;
              				}
              			}
              			}
              		}              			

              	
              	if (required_fields) {
              		alert("Не заполнены обязательные поля");
              		return false;
              	}

                   // проверка синтаксиса адреса электронной почты
              		if(!email_fieldname.value.match(/^\w+[\.\-\w]*@(\w+\-*\w*\.)+\w+$/)) {
              			email_fieldname.focus();
              			alert("Недопустимый формат e-mail.");
              			return false;
              		}
              		
              		submit();
              }

