	function open_window(link,w,h)
	{
		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) //http://www.needit.ru
	{
		var win = "menubar=no,location=no,resizable=yes,scrollbars=yes";
		newWin = window.open(link,'perintableWin',win);
		newWin.focus();
	}

	function confirmDelete(id, ask, url) //http://www.needit.ru
	{
		temp = window.confirm(ask);
		if (temp) //delete
		{
			window.location=url+id;
		}
	}



	function confirmUnsubscribe() //http://www.needit.ru
	{
		temp = window.confirm('{/literal}{$smarty.const.QUESTION_UNSUBSCRIBE}{literal}');
		if (temp) //delete
		{
			window.location="/killuser.yes/";
		}
	}

	function validate() // http://www.needit.ru
	{
		if (document.subscription_form.email.value.length<1)
		{
			alert("{/literal}{$smarty.const.ERROR_INPUT_EMAIL}{literal}");
			return false;
		}
		if (document.subscription_form.email.value == 'Email')
		{
			alert("{/literal}{$smarty.const.ERROR_INPUT_EMAIL}{literal}");
			return false;
		}
		return true;
	}
	function validate_disc() // http://www.needit.ru
	{
		if (document.formD.nick.value.length<1)
		{
			alert("{/literal}{$smarty.const.ERROR_INPUT_NICKNAME}{literal}");
			return false;
		}

		if (document.formD.topic.value.length<1)
		{
			alert("{/literal}{$smarty.const.ERROR_INPUT_MESSAGE_SUBJECT}{literal}");
			return false;
		}

		return true;
	}
	function validate_search()
	{

		if (document.Sform.price1.value!="" && ((document.Sform.price1.value < 0) || isNaN(document.Sform.price1.value)))
		{
			alert("{/literal}{$smarty.const.ERROR_INPUT_PRICE}{literal}");
			return false;
		}
		if (document.Sform.price2.value!="" && ((document.Sform.price2.value < 0) || isNaN(document.Sform.price2.value)))
		{
			alert("{/literal}{$smarty.const.ERROR_INPUT_PRICE}{literal}");
			return false;
		}

		return true;
	}
    function toggle_gsearch_visibility() {
        gsearch = document.getElementById('gsearch');

        switch (gsearch.style.display){
           case 'none':
              gsearch.style.display= 'block';
              break;
           case 'block' :
              gsearch.style.display = 'none';
              break;

           default : gsearch.style.display = 'block';
        }

    }

	function check_region() {
		agreement = document.getElementById('agreement');
		region = document.getElementById('region');

		if (region.value=='Piter' || region.value=='Moskva' ) agreement.style.display = "none";
		if (region.value=='Minsk') agreement.style.display = "block";

	}

	function check_form() {

		if (document.getElementById("vid").value == "") { alert("Выберите тип работы!"); return false; }
		if (document.getElementById("category").value == "") { alert("Выберите раздел!"); return false; }
		return true;

	}
