function li()
{
	document.write("<!--LiveInternet counter--><script type=\"text/javascript\">document.write(\"<a href='http://www.liveinternet.ru/click' target=_blank><img src='http://counter.yadro.ru/hit?t14.3;r\" + escape(document.referrer) + ((typeof(screen)==\"undefined\")?\"\":\";s\"+screen.width+\"*\"+screen.height+\"*\"+(screen.colorDepth?screen.colorDepth:screen.pixelDepth)) + \";u\" + escape(document.URL) + \";\" + Math.random() + \"' border=0 width=88 height=31 alt='' title='LiveInternet: показано число просмотров за 24 часа, посетителей за 24 часа и за сегодня'><\/a>\")</script><!--/LiveInternet-->");
}

function mail(name, domain)
{
	document.location.href = "mailto:" + name + "@" + domain;
}

function upload2()
{
	var autor = document.send_mail.autor_name;

	if (autor.value.length <= 1)
	{	
		var div = document.getElementById('au_name');
		div.style.display = 'block';
		return false;
	}
	else
	{
		var div = document.getElementById('au_name');
		div.style.display = 'none';
	}

	var email = document.send_mail.autor_email;

	if (email.value.length <= 1)
	{	
		var div = document.getElementById('au_email');
		div.style.display = 'block';
		return false;
	}
	else
	{
		var div = document.getElementById('au_email');
		div.style.display = 'none';
	}
	send_mail.submit();
}

function setCookie(name, value, days, path, domain, secure) 
{
	var expires;
	var date;

	if (typeof days == "number") 
	{
		date = new Date();
		date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
		expires = date.toGMTString();
	}
	document.cookie = name + "=" + escape(value) +
	    ((expires) ? "; expires=" + expires : "") +
	    ((path) ? "; path=" + path : "") +
	    ((domain) ? "; domain=" + domain : "") +
	    ((secure) ? "; secure" : "");
}

function sortt(type)
{
	setCookie("sort", type, 365000, "/");
	location.reload(true);
}

function bron(code, count)
{
	var link = "/bron.php?code=" + code + "&count=" + count;
	win = window.open(link, 'bron', 'toolbar=no,location=no,status=no,menubar=no,resizable=yes, directories=no, scrollbars=no, width=600, height=430, top=50, left=10');
	win.window.focus();
}

function oclick(text)
{
	if (text.value == "поиск ...")
	{
		text.value = "";
	}
}

function oblur(text)
{
	if (text.value == "")
	{
		text.value = "поиск ...";
	}
}

function years12()
{
	document.write("Уже <b>12</b> лет компания &laquo;В Питер&raquo; бронирует гостиницы для вас!");
}

function sendmail()
{
	document.write('<a href="mailto:info@vpiter.com">написать письмо</a>');
}

function addprice(val)
{
	var codes  = new Array(0, 1, 2, 3, 4, 5, 6);
	var values = new Array( "-- Любая --",
				"До 1500 руб.",
				"1500-2500 руб.",
				"2500-3500 руб.",
				"3500-4500 руб.",
				"4500-6000 руб.",
				"Свыше 6000 руб.");

	fillelem("price", codes, values, val);
}

function addplace(val)
{
	var codes  = new Array(1, 2, 3, 4, 5, 6, 7);
	var values = new Array( "-- Любое место --",
				"Центр города",
				"Московский вокзал",
				"Ленэкспо",
				"Петроградский район",
				"Василеостровский район",
				"Аэропорт (Пулково)");

	fillelem("place", codes, values, val);
}

function addmetro(val)
{
	var codes  = new Array(0, 2, 61, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 63, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 64, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 62, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60);

	var values = new Array("-- Любое метро --",
			"Автово",
			"Адмиралтейская",
			"Академическая",
			"Балтийская",
			"Василеостровская",
			"Владимирская",
			"Выборгская",
			"Горьковская",
			"Гостиный двор",
			"Гражданский пр.",
			"Девяткино",
			"Достоевская",
			"Елизаровская",
			"Звездная",
			"Звенигородская",
			"Кировский завод",
			"Комендантский пр.",
			"Крестовский остров",
			"Купчино",
			"Ладожская",
			"Ленинский проспект",
			"Лесная",
			"Лиговский проспект",
			"Ломоносовская",
			"Маяковская",
			"Московская",
			"Московские ворота",
			"Нарвская",
			"Невский проспект",
			"Новочеркасская",
			"Обводный канал",
			"Обухово",
			"Озерки",
			"Парк Победы",
			"Парнас",
			"Петроградская",
			"Пионерская",
			"Пл. Ал. Невского",
			"Пл. Восстания",
			"Пл. Ленина",
			"Пл. Мужества",
			"Политехническая",
			"Пр. Большевиков",
			"Пр. Ветеранов",
			"Пр. Просвещения",
			"Приморская",
			"Пролетарская",
			"Пушкинская",
			"Рыбацкое",
			"Садовая",
			"Сенная пл.",
			"Спасская",
			"Спортивная",
			"Старая деревня",
			"Технолог. институт",
			"Удельная",
			"Ул. Дыбенко",
			"Фрунзенская",
			"Черная речка",
			"Чернышевская",
			"Чкаловская",
			"Электросила");

	fillelem("metro", codes, values, val);
}

function fillelem(name, codes, values, value)
{
	var elem = document.getElementById(name);
	if (elem.options.length <= 1)
	{
		elem.options.length = 0;
		for (i = 0; i < codes.length; i++)
		{
			elem.options[elem.options.length] = new Option(values[i], codes[i], false, codes[i] == value);
		}
	}	
}