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;
}

var requiredMajorVersion = 8;
var requiredMinorVersion = 0;
var requiredRevision     = 24;

var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function detectFlash()
{
	return DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
}

function banner()
{
	
}

function camera1()
{
	if (detectFlash()) 
	{
		return '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="165" height="96" id="camera" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="/camera.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="/camera.swf" quality="high" bgcolor="#ffffff" width="165" height="96" name="camera" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
	}
	else
	{
		return '<a href="/web-camera/"><img src="/camera1.jpg"></a>';
	}
}

function noflash()
{
	if (!detectFlash()) 
	{
		document.write('<div class=offline>Если вы видите эту надпись, значит ваш интернет-браузер не позволяет воспроизводить потоковое видео с помощью Adobe Flash. Чтобы решить эту проблему, пожалуйста, обратитесь к вашему системному администратору. Либо попробуйте посмотреть наши веб-камеры на другом компьютере, например - домашнем.</div>');
	}
}

function cameras()
{
	document.write("<p style='color:red'>Новая <b>обзорная</b> Web-камера!</p><a href=\"http://vpiter.com/web-camera-petrop-obzor/\"><p>Наша веб-камера установлена на <b>шпиле Петропавловской крепости!</b></p><img src='/petrop.gif' width=165 height=124></a><br><a href=\"http://vpiter.com/web-camera-palace-square/\"><p>Наша веб-камера установлена на Эрмитаже!</p><img src='/palace.jpg' width=165 height=124></a><br> <a href=\"http://vpiter.com/web-camera-kazan/\"><p>Вид на Казанский собор!</p><img src='/kazan.jpg' width=165 height=124></a><br><a href=\"http://vpiter.com/web-camera-move/\"><p>Поворотная обзорная Web-камера в самом центре Санкт-Петербурга!</p><img src='/cam-po.jpg' width=165 height=124></a><br><a href=\"http://vpiter.com/web-camera-admiral/\"><p>Адмиралтейская набережная, Дворцовый мост, Петропавловка</p><img src='/web-admiral.gif' width=165 height=124></a><br><a href=\"http://vpiter.com/web-camera-isaak/\"><p>Он-лайн трансляция Исаакиевской площади!</p><img src='/camera-isaak.jpg' width=165 height=124></a><br><a href=\"http://vpiter.com/web-camera-new/\"><p>Он-лайн трансляция Дворцового моста и Стрелки Васильевского!</p><img src='/camera-new.jpg' width=165 height=124></a><br><p>Web-камера, транслирующая Невский проспект! Установлена в офисе нашей бронирующей организации</p><a href=\"http://vpiter.com/web-camera/\"><p>Он-лайн трансляция всего Невского проспекта !</p>" + camera1() + "</a>");
}

function fotolicense()
{
	documet.write("<div class=fotolicense>Внимание! При копировании фотографий на ваш сайт, установка активной, незакрытой от поисковых систем ссылки на vpiter.com обязательна! <b>Будем проверять!</b></div>");
}

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=490, top=50, left=10');
	win.window.focus();
}

function oclick(text)
{
	if (text.value == "введите название ...")
	{
		text.value = "";
		text.style.color = "#000000";
	}
}

function oblur(text)
{
	if (text.value == "")
	{
		text.value = "введите название ...";
		text.style.color = "#A0A0A0";
	}
}

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);
		}
	}	
}

function social(command)
{
	document.write('<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script><table align=center class=social><tr><td><g:plusone></g:plusone></td><td><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fvpiter.com%2F' + command + '%2F&amp;layout=button_count&amp;show_faces=true&amp;width=150&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:150px; height:21px;" allowTransparency="true"></iframe></td><td><a onclick="window.open(\'http://www.livejournal.com/update.bml?event=http%3A%2F%2Fvpiter.com%2F' + command + '%2F\'&subject=vpiter.com\', \'lj\', \'width=626, height=436\'); return false;" rel="nofollow" href="http://www.livejournal.com/update.bml?event=http%3A%2F%2Fvpiter.com%2F' + command + '%2F\'&subject=vpiter.com" title="Опубликовать в своем блоге livejournal.com"><img src="/livejournal.gif" alt="Опубликовать в своем блоге livejournal.com" width="26" height="26"></a></td><td><a onclick="window.open(\'http://zakladki.yandex.ru/userarea/links/addfromfav.asp?bAddLink_x=1&lurl=http%3A%2F%2Fvpiter.com%2F' + command + '%2F&lname=vpiter.com\', \'Yandex.Zakladki\', \'width=626, height=636\'); return false;" rel="nofollow" href="\'http://zakladki.yandex.ru/userarea/links/addfromfav.asp?bAddLink_x=1&lurl=http%3A%2F%2Fvpiter.com%2F' + command + '%2F&lname=vpiter.com"><img src="/zakladki.gif" width="26" height="26" title="Добавить в Яндекс.Закладки"></a></td><td><a onclick="window.open(\'http://www.google.com/reader/link?url=http%3A%2F%2Fvpiter.com%2F' + command + '%2F&title=vpiter.com&srcURL=http%3A%2F%2Fvpiter.com%2F' + command + '%2F\', \'buzz\', \'width=626, height=436\'); return false;" rel="nofollow" href="http://www.google.com/reader/link?url=http%3A%2F%2Fvpiter.com%2F' + command + '%2F&title=vpiter.com&srcURL=http%3A%2F%2Fvpiter.com%2F' + command + '%2F"><img src="/buzz.gif" width="26" height="26" title="Добавить в Google Buzz"></a></td><td><a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></td><td><a onclick="window.open(\'http://vkontakte.ru/share.php?url=http%3A%2F%2Fvpiter.com%2F' + command + '%2F\', \'vkontakte\', \'width=626, height=436\'); return false;" href="http://vkontakte.ru/share.php?url=http%3A%2F%2Fvpiter.com%2F' + command + '%2F" rel="nofollow"><img src="/vkontakte.gif" width="88" height="21" title="Поделиться с друзьями ВКонтакте"></a></td></tr></table>');
}

var xmlHttp  = null;
var xmlHttp2 = null;
var xmlHttp3 = null;

function hide(code)
{
	var div  = document.getElementById("hid" + code.toString());

	if (div != null)
	{
		div.innerHTML = "<a href='javascript:call(" + code + ");'></a>";
	}
}
    
function updatePage()
{
	if (xmlHttp.readyState == 4 && xmlHttp.status == 200) 
	{
		//alert(xmlHttp.responseText);
		var html = xmlHttp.responseText;
		var pos = html.indexOf("#");
		if (pos > 0)
		{
			var code = html.substr(0, pos);
			var text = html.substr(pos + 1);

			var div  = document.getElementById("hid" + code.toString());

			if (div != null)
			{
				div.innerHTML = "<a href='javascript:hide(" + code + ");' class=hide></a><br>" + text;
			}
		}
	}
}

function getXmlHttp()
{
	var xmlhttp;

	try 
	{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} 
	catch (e) 
	{
		try 
		{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} 
		catch (E) 
		{
			xmlhttp = false;
		}
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') 
	{
		xmlhttp = new XMLHttpRequest();
	}

	return xmlhttp;
}
 
function call(code)
{
	if(!xmlHttp)
	{
		xmlHttp = getXmlHttp();
	}

	if(!xmlHttp ) 
	{
		return;
	}
 
	var url = "/price.php?code=" + code;
	xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = updatePage;
	xmlHttp.send(null);
}

function updatechat()
{
	if (xmlHttp2.readyState == 4 && xmlHttp2.status == 200) 
	{
		var html = xmlHttp2.responseText;

		var div  = document.getElementById("messages");

		if (div != null)
		{
			div.innerHTML = html;
		}
	}
}

function updatebm()
{
	if (xmlHttp.readyState == 4 && xmlHttp.status == 200) 
	{
		var html = xmlHttp.responseText;

		var div  = document.getElementById("bm");

		if (div != null)
		{
			div.innerHTML = html;// + "<a href=\"http://vpiter.com/web-camera-palace-square/#navig\" class=newyear title=\"Празднуйте Новый год с нами!\"></a>";
			gapi.plusone.go();
		}
	}
}

function updatemap()
{
	if (xmlHttp3.readyState == 4 && xmlHttp3.status == 200) 
	{
		var html = xmlHttp3.responseText;

		var temp = new Array();
		temp = html.split('|');
		var count = temp.length / 4;
		var type  = temp[0];

		clearovl();

		var image = "";
		if (type == "best")
		{
			image = "/i/map-hot.png";
		}
		else if (type == "hot")
		{
			image = "/i/map-best.png";
		}
		else if (type == "dost")
		{
			image = "/i/map-dost.png";
		}
		else if (type == "web")
		{
			image = "/i/map-web.png";
		}
		else if (type == "temp")
		{
			image = "/i/map-temp.png";
		}
		else if (type == "all")
		{
			image = "/i/map-all.png";
		}

		for (var i = 0; i < count; i++)
		{
			if (i * 4 + 4 >= temp.length)
			{
				break;
			}
			
			addIcon(temp[i * 4 + 1], temp[i * 4 + 2], temp[i * 4 + 3], temp[i * 4 + 4], image);
		}
	}
}

var serverip1 =  "vpiter.tv";  // "50.7.242.250";
var serverip2 = /* "vpiter.tv";  */ "50.7.242.250";

function bigcam()
{
	var bcam  = document.getElementById("bigcam");
	var scam  = document.getElementById("smallcam");

	if (bcam != null && scam != null)
	{
		$f().stop();
		$f().unload();

		setLop(1);
		
		scam.innerHTML = "";

		bcam.innerHTML = getcamtop("bigcam") + '<div id="player" style="width:640px;height:480px;"></div>' + getcambottom("bigcam");
		flowplayer("player", "http://vpiter.com/swf/flowplayer-3.2.7.swf", {clip: {live: true, url: 'http://' + serverip1 + ':8083/camera19/h264'}});

		typecam = true;
	}
}

function smallcam()
{
	var bcam  = document.getElementById("bigcam");
	var scam  = document.getElementById("smallcam");

	if (bcam != null && scam != null)
	{
		$f().stop();
		$f().unload();

		setLop(4);
		
		bcam.innerHTML = "";

		scam.innerHTML = getcamtop("smallcam") + '<div id="player" style="width:412px;height:312px;"></div>' + getcambottom("smallcam");
		flowplayer("player", "http://vpiter.com/swf/flowplayer-3.2.7.swf", {clip: {live: true, url: 'http://' + serverip1 + ':8083/camera19/h264'}});

		typecam = false;
	}
}

function slideshow()
{
	if ($f().getVolume() == 0)
	{
		$f().setVolume(30);
	}

	dur = 30;

	$f("player", "http://vpiter.com/swf/flowplayer-3.2.7.swf", 
	{
		playlist:
		[
			{  
				url:'http://' + serverip1 + ':8083/hermitage/h264', duration: dur,
			}, 
			{  
				url:'http://' + serverip2 + ':8083/camera15/h264', duration: dur,
			}, 
			{  
				url:'http://' + serverip1 + ':8083/camera1/h264', duration: dur,
			},
			{  
				url:'http://' + serverip1 + ':8083/camera6/h264', duration: dur,
			},
			{  
				url:'http://' + serverip1 + ':8083/camera8/h264', duration: dur,
			},
			{  
				url:'http://' + serverip2 + ':8083/camera4/0,0,640,480/h264', duration: dur,
			},
			{  
				url:'http://' + serverip1 + ':8083/camera2/h264', duration: dur,
			},
			{  
				url:'http://' + serverip2 + ':8083/camera3/h264', duration: dur,
			},
			{  
				url:'http://' + serverip1 + ':8083/camera11/h264', duration: dur,
			},
			{  
				url:'http://' + serverip1 + ':8083/camera16/h264', duration: dur,
			},
			{
				url:'http://' + serverip1 + ':8083/camera19/h264', duration: dur,

onFinish: function() {this.play(0);} 
			}
		]
	});
}

function slideshow2()
{
	alert('Нажмите на кнопку "Слайд шоу камер", а затем раскройте на весь экран, нажав прямоугольник в правом нижнем углу камеры');
	window.open("http://vpiter.com/", "_self");
}

function temperature()
{
	window.open("http://vpiter.com/#allmap", "_self");
}

var typecam = false; // false - small, true - big

function so()
{
	if ($f().getVolume() == 0 && !typecam)
	{
		$f().setVolume(30);
	}
}

function sound()
{
	if ($f().getVolume() == 0)
	{
		$f().setVolume(30);
	}
	else
	{
		$f().setVolume(0);
	}
}

function getcamtop(divname)
{
	center = "";
	if (divname == "bigcam")
	{
		center = "<center>";
	}
	return center + "<div class=ourweb>Наша веб-камера с видом на</div> <div class=hotelspb>гостиницу Санкт-Петербург</div>";
}

function getcambottom(divname)
{
	if (divname == "smallcam")
	{
		buttons = "<a href='javascript:bigcam();' class=resize></a><a href='javascript:sound();' class=sound></a><a href='javascript:slideshow();' class=slideshow></a>";
	}
	else
	{
		buttons = "<div style='margin-left: 60px;'><a href='javascript:smallcam();' class=smallsize></a><a href='javascript:sound();' class=sound></a><a href='javascript:slideshow();' class=slideshow></a></div>";
	}

	center = "";
	if (divname == "bigcam")
	{
		center = "</center>";
	}

	allcams = "<div class=allcams>";

	var cams = [ "dwortz", "petrop", "kazan", "aurora", "nev7", "admir", "nev47", "wmove", "pvos", "isaak", "hyde2" ];
	var titles = [ 
		"Дворцовая площадь (Веб-камера на Эрмитаже)",
		"Вид с Петропавловской крепости (Веб-камера на Петропавловке)",
		"Казанский собор",
		"Крейсер Аврора",
		"Невский проспект",
		"Дворцовый мост",
		"Камера для приветов на Невском проспекте",
		"Обзорная веб-камера",
		"Площадь Восстания",
		"Исаакиевский собор",
		"На Петропавловке" ];

	var urls = [ 
		"web-camera-palace-square",
		"web-camera-petrop-obzor",
		"web-camera-kazan",
		"web-camera-kreiser-aurora",
		"web-camera",
		"web-camera-admiral",
		"web-camera-hyde1",
		"web-camera-move",
		"web-camera-ploshad-vosstaniya",
		"web-camera-isaak",
		"web-camera-hyde2" ];

	for (i = 0; i < 11; i++)
	{
		allcams += "<a href='http://vpiter.com/" + urls[i] + "/' title='" + titles[i] + "' class='" + cams[i] + "' onclick='so();'></a>";
	}

	allcams += "</div>";

	return buttons + " <div class=aboutcam>Мы установили сеть качественных веб-камер со звуком, на всех исторически-значимых объектах города. <br><b>От Эрмитажа до шпиля Петропавловки</b>. Заходите посмотреть!</div><div class=allsc>" + allcams + "</div>" + center + "<div id=bm></div><hr>";
}

function setLop(count)
{
	for (i = 1; i < count; i++)
	{
		var div  = document.getElementById("lop" + i);
		

		if (div != null)
		{
			div.innerHTML = "";
		}
	}

	do
	{
		var div  = document.getElementById("lop" + count);
		count++;

		if (div != null)
		{
			div.innerHTML = "&nbsp;&nbsp;&nbsp;Только от компании &laquo;В Питер.ком&raquo; такая низкая стоимость!";
		}
	}
	while (div != null);
}

function loadbm(command)
{
	if (command == "mainpage")
	{
		var pos = document.referrer.indexOf('camera');

		if (pos > -1) 
		{
			divname = "bigcam";
			count   = 1;
			typecam = true;
		}
		else
		{
			divname = "smallcam";
			count   = 4;
			typecam = false;
		}

		if (detectFlash()) 
		{
			var div  = document.getElementById(divname);

			if (div != null)
			{
				if (divname == "smallcam")
				{
					div.innerHTML = getcamtop(divname) + '<div id="player" style="width:412px;height:312px;"></div>' + getcambottom(divname);
					flowplayer("player", "http://vpiter.com/swf/flowplayer-3.2.7.swf", {clip: {live: true, url: 'http://' + serverip1 + ':8083/camera19/h264', onBegin: function () {this.setVolume(0);}}});
				}
				else
				{
					div.innerHTML = getcamtop(divname) + '<div id="player" style="width:640px;height:480px;"></div>' + getcambottom(divname);
					flowplayer("player", "http://vpiter.com/swf/flowplayer-3.2.7.swf", {clip: {live: true, url: 'http://' + serverip1 + ':8083/camera19/h264'}})
				}
			}
		}
		else
		{
			count = 1;
		}

		setLop(count);
	}

	if(!xmlHttp)
	{
		xmlHttp = getXmlHttp();
	}

	if(!xmlHttp ) 
	{
		return;
	}
 
	var url = "";
	if (command == "mainpage")
	{
		url = "/bookmarks_main.php?command=" + command;
	}
	else
	{
		url = "/bookmarks.php?command=" + command;
	}

	xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = updatebm;
	xmlHttp.send(null);

	if (command == "mainpage")
	{
		if (window.location.hash == "#allmap")
		{
			mapxml("temp");
		}
		else
		{
			mapxml("hot");
		}
	}

	if (window.location.hash == "#showchat")
	{
		showchat2();
	}

	if(!xmlHttp2)
	{
		xmlHttp2 = getXmlHttp();
	}

	if (!xmlHttp2) 
	{
		return;
	}

	if (command.substring(0, 10) == "web-camera")
	{
		var url = "/readchat.php";
		xmlHttp2.open("GET", url, true);
		xmlHttp2.onreadystatechange = updatechat;
		xmlHttp2.send(null);
	}
}

function mapxml(type)
{
	if(!xmlHttp3)
	{
		xmlHttp3 = getXmlHttp();
	}

	if(!xmlHttp3) 
	{
		return;
	}

	var url = "/positions.php?type=" + type;

	xmlHttp3.open("GET", url, true);
	xmlHttp3.onreadystatechange = updatemap;
	xmlHttp3.send(null);
}

function consult()
{
	document.write('<script type="text/javascript" src="http://consultsystems.ru/script/328/2/corner/left/" charset="utf-8"></script>');
}

function showchat()
{	
	var div  = document.getElementById("chat");

	if (div != null)
	{
		div.style.display = "block";
	}

	var show  = document.getElementById("showchat");
	var smal  = document.getElementById("smallsize");
	var resi  = document.getElementById("resize");

	if (show != null && smal != null && resi != null)
	{
		show.style.display = "none";
		smal.style.display = "block";
		resi.style.display = "block";
	}
}

function showchat2()
{
	showchat();
	window.open("http://cn.vpiter.com/chat/index.php", "chat");
}

function bigchat()
{
	var div  = document.getElementById("chat");

	if (div != null)
	{
		if (div.style.height == "")
		{
			div.style.height = "450px";
		}
		else
		{
			div.style.height = (parseInt(div.style.height) + 100) + "px";
		}
		div.offsetHeight = parseInt(div.style.height);
	}
}

function smallchat()
{
	var div  = document.getElementById("chat");

	if (div != null)
	{
		if (div.style.height == "")
		{
			div.style.height = "250px";
		}
		else
		{
			div.style.height = (parseInt(div.style.height) - 100) + "px";
		}
		div.offsetHeight = parseInt(div.style.height);
	}
}
