var currency, pr, glob_ID, timeout_id=0;

	re3=/([^<)\s]+@\S+\.[^>(\s]+)/;

function Hidden2(id, style, mode)
{
	if (mode==2)
	{
		glob_ID=id;
		if (glob_ID=="big_win") curtainHeight = 860;
		else if (glob_ID=="big_win2") curtainHeight = 400;

		if (glob_ID=="search2")
		{
			curtainStep=5;
			curtainTimeout=50;
		}
		else
		{
			curtainStep=35;
			curtainTimeout=15;
		}
		

		if (style == "inline")	{clearTimeout(timeout_id); curtainOpen();}
		if (style == "none")	{clearTimeout(timeout_id); curtainClose();}
	}
	else
	{
		if (document.getElementById(id))
		{
			if (style == "table-row")
			{
					if (ie4) document.getElementById(id).style.display="inline";
					else document.getElementById(id).style.display=style;
			}
			else
			document.getElementById(id).style.display=style;
		}
	}
}

function Subscribes(mode)
{
	email=document.Subscribe.email.value;
	if(!re3.test(email))
	{
		alert("Неправильный почтовый адрес!");
		return;
	}
	document.Subscribe.mode.value=mode;
	document.Subscribe.submit();
}

function ShowSearch(mode)
{
	curtainHeight=50;
	if (mode==1)
	{
		InnerHtml("advs", '<a onclick="ShowSearch(2)">Простой поиск</a>');
		Hidden2("search2", "inline", 2);
		document.getElementById("search1").style.backgroundImage='url("../img/ru/fon_search1a.gif")';
	}
	else if (mode==2)
	{
		curtainBottom=50;
		InnerHtml("advs", '<a onclick="ShowSearch(1)">Расширенный поиск</a>');
		Hidden2("search2", "none", 2);
		document.getElementById("search1").style.backgroundImage='url("../img/ru/fon_search1.gif")';
	}
}

function save()
{
	re = /^\s*$/;
	re2 = /^\d+$/;
	re3= /([^<)\s]+@\S+\.[^>(\s]+)/;
	flag=true;
	if (document.Form.parent_id)
	document.Form.parent_id.value=parent_id;
	document.Form.sent.value=1;
	with (document.Form)
	{
		if (document.getElementById("name"))
		{
			if (re.test(name.value))
			{
				alert("Введите имя");
				name.focus();
				return;
			}
		}
		if (document.getElementById("secondname"))
		{
			if (re.test(secondname.value))
			{
				alert("Введите фамилию");
				secondname.focus();
				return;
			}
		}
		if (document.getElementById("email"))
		{
			if (!re3.test(email.value))
			{ 
				alert("Введите email");
				email.focus();
				return;
			}
		}
		if (document.getElementById("question"))
		{
			if (re.test(question.value) || question.value=="")
			{
				
				alert("Сообщение отсутствует");
				question.focus();
				return;
			}
		}
		if (document.getElementById("checknum"))
		{
			if (!re2.test(checknum.value) || checknum.value=="")
			{
				
				alert("Введите проверочный текст");
				checknum.focus();
				return;
			}
		}
		submit();
	}
}

function Search2(mode, type)
{
	id=document.getElementById(mode).value;
	url="/misc/search2.php?mode="+mode+"&id="+id+"&t="+type;
	goAjax(url);
}

function SearchTours2()
{
	document.Search.submit();
}
