	function open_window(link,w,h) //opens new window
	{
		var win = "width="+w+",height="+h+",menubar=no,location=no,resizable=yes,scrollbars=yes";
		newWin = window.open(link,'newWin',win);
		newWin.focus();
	}

	function open_printable_version(link) //opens new window
	{
		var win = "menubar=no,location=no,resizable=yes,scrollbars=yes";
		newWin = window.open(link,'perintableWin',win);
		newWin.focus();
	}

	function confirmDelete(id, ask, url) //confirm order delete
	{
		temp = window.confirm(ask);
		if (temp) //delete
		{
			window.location=url+id;
		}
	}



	function confirmUnsubscribe() //unsubscription confirmation
	{
		temp = window.confirm('Вы уверены, что хотите отменить регистрацию в магазине?');
		if (temp) //delete
		{
			window.location="index.php?killuser=yes";
		}
	}

	function validate() // newsletter subscription form validation
	{
		if (document.subscription_form.email.value.length<1)
		{
			alert("Пожалуйста, вводите email правильно");
			return false;
		}
		if (document.subscription_form.email.value == 'Email')
		{
			alert("Пожалуйста, вводите email правильно");
			return false;
		}
		return true;
	}
	function validate_disc() // review form verification
	{
		if (document.formD.nick.value.length<1)
		{
			alert("Пожалуйста, введите Ваш псевдоним");
			return false;
		}

		if (document.formD.topic.value.length<1)
		{
			alert("Пожалуйста, введите тему сообщения");
			return false;
		}

		return true;
	}
	function validate_search()
	{

		if (document.Sform.price1.value!="" && ((document.Sform.price1.value < 0) || isNaN(document.Sform.price1.value)))
		{
			alert("Цена должна быть положительным числом");
			return false;
		}
		if (document.Sform.price2.value!="" && ((document.Sform.price2.value < 0) || isNaN(document.Sform.price2.value)))
		{
			alert("Цена должна быть положительным числом");
			return false;
		}

		return true;
	}

//---------------------------

function gebi(id) {return document.getElementById(id);}

document.onclick = function() {
	//gebi("help_div").style.display = "none";
	//document.getElementById('opacity_container').className='';
	//document.getElementById('body').style.overflow-x='auto';
}

function absPosition(obj) { // Опрелеляем top - left координаты блока obj
	this.x = 0;
	this.y = 0;
    while(obj) {
		this.x += obj.offsetLeft;
		this.y += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return {x:this.x,y:this.y};
}

//alert (helpDate.length);

function clear_help(evt) {
	evt = evt || window.event;
	evt.cancelBubble = true;
	gebi("help_div").style.display = "none";
	document.getElementById('opacity_container').className='';
	//document.getElementById('body').style.overflow-x='auto';
}
function contHelp (img, evt, id, rgt) {
	evt = evt || window.event;
	evt.cancelBubble = true;

	var a = document.getElementById('opacity_container');
	a.className='opacity_container_act';
	//document.getElementById('body').style.overflow='hidden';
	//document.getElementById('opacity_container').style.width=document.getElementById('body').offsetWidth - 40 + 'px';return true;

	if (rgt)
		var rightFlag = true;
	else {
		var rightFlag = false;
		var bodyWidth = (window.innerWidth) ? window.innerWidth : window.document.body.clientWidth;
		if (bodyWidth - absPosition(img).x < 350) rightFlag = true;
	}

	var targetDiv = gebi("help_div");
	if(img && targetDiv) {
		gebi("help_div").className = "help_div";
		gebi("help_div").innerHTML="<a onclick=\"clear_help(event);return false;\" href=\"\"><img src=/images/action_delete_grey.gif height=16 width=16 align=right style='margin:5px 5px 0 0;'></a><br><div>" + helpDate[id] + "</div>";
		var xRemainder = (rightFlag) ? -557 : 0;
		gebi("help_div").style.top = absPosition(img).y-2 - 55 + "px";
		gebi("help_div").style.left = absPosition(img).x + xRemainder + "px";
		gebi("help_div").style.display = "";
	}
	return false;
}