OpenWindow = null;

function zoom(url_img,wid,heid,zagolovok)
{
	if (OpenWindow)
	{OpenWindow.close();}

	if (!OpenWindow || (OpenWindow.closed))
	{
		var imag = new Image();
		imag.src = url_img;
		if(!wid) wid = imag.width;
		if(!heid) heid = imag.height;
	
	www=""+url_img;
	OpenWindow=window.open('', 'xxx', 'width='+wid+',height='+heid+'resizable=yes,scrollbars=no,top=50,left=50');
	OpenWindow.document.write("<HTML>")
	OpenWindow.document.write("<TITLE>")
	OpenWindow.document.write(zagolovok)
	OpenWindow.document.write("</TITLE>")
	OpenWindow.document.write('<BODY topmargin="0" leftmargin="0">')
	OpenWindow.document.write("<CENTER>")
	OpenWindow.document.write('<link href="/css/style.css" type="text/css" rel="stylesheet">')
	OpenWindow.document.write('<img onclick="window.close()" src="')
	OpenWindow.document.write(url_img)
	OpenWindow.document.write('" alt="" border="0">')
	OpenWindow.document.write("</CENTER>")
	OpenWindow.document.write("</BODY>")
	OpenWindow.document.write("</HTML>")
	OpenWindow.document.close()
	OpenWindow.focus();
	}
	
	return false;
}

function getBrowserInfo() {
 var t,v = undefined;
 if (window.opera) t = 'Opera';
 else if (document.all) {
  t = 'IE';
  var nv = navigator.appVersion;
  var s = nv.indexOf('MSIE')+5;
  v = nv.substring(s,s+1);
 }
 else if (window.sidebar) t = 'Netscape';
 return {type:t,version:v};
}

function addBookmark(url,title)
{
  if (!url) url = "http://sauna.spb.ru/";
  if (!title) title = "Сауны Санкт-Петербурга — Sauna.Spb.Ru";

 var b = getBrowserInfo();
 if (b.type == 'IE') window.external.AddFavorite(url,title);
 else if (b.type == 'Opera') {
	alert("Нажмите CTRL-D, чтобы добавить страницу в закладки.");
	return true;
 }
 else if (b.type == "Netscape") window.sidebar.addPanel(title,url,"");
 else alert("Нажмите CTRL-D, чтобы добавить страницу в закладки.");
 return true;
}

function addBookmarkOld(url, title)
{
  if (!url) url = "http://sauna.spb.ru/";
  if (!title) title = "Сауны Санкт-Петербурга — Sauna.Spb.Ru";

  //Gecko
  if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) window.sidebar.addPanel (title, url, '');
  //IE4+
  else if (typeof window.external == "object") window.external.AddFavorite(url, title);
  //Opera7+
  else if (window.opera && document.createElement)
  {
    //var a = document.createElement('A');
    //if (!a) return false; //IF Opera 6
    //a.setAttribute('rel','sidebar');
    //a.setAttribute('href',url);
    //a.setAttribute('title',title);
    //a.click();
	alert("Нажмите CTRL-D, чтобы добавить страницу в закладки.");
  }
  else {
	alert("Нажмите CTRL-D, чтобы добавить страницу в закладки.");
  }

  return true;
}

$(document).ready(function() {
    $('.stories-bottom>a').mouseover(function(){
		$(this).parent().css('background-color','#B1B1B1');
    }).mouseout(function(){
		$(this).parent().css('background-color','#DBDBDB');
	});

	$('#showmap').click(function(){
		if ($('#map-contener').css('display')=='block') {
			$('#map-contener').css('display','none');
			$('#showmap').html('<img src="/gif/chupa.png" alt="показать на карте"> показать на карте');
			pageTracker._trackEvent("Map","Hide");
		} else {
			$('#map-contener').css('display','block');
			$('#showmap').html('<img src="/gif/chupa.png" alt="показать на карте"> скрыть карту');
			pageTracker._trackEvent("Map","Show");
}
	});
});

function showCode(blok, links) {
	if (document.getElementById(blok).style.display=="block")
	{
		document.getElementById(blok).style.display="none";
		document.getElementById(links).style.backgroundColor="#FFFFFF";
	}
	else 
	{
		document.getElementById(blok).style.display="block";
		document.getElementById(links).style.backgroundColor="#F2F2F2";
	}
}

function popupurl (fileName,w,h,s,door,m) {
	    if (w == null) var w = 500;
            if (h == null) var h = 400;
            if (s == null) var s = 1;
            if (m == null) var m = 0;
            if (door == null) var door = '';
                    
            var t = (screen.height - h) / 2;
	    var l = (screen.width - w) / 2;
   	    var winArgs = 'height=' + h + ',width=' + w + ',top=' + t + ',left=' + l + 'status=no,toolbar=no,menubar=' + m + ',location=no,fullscreen=no,resizable=no,directories=no' + ',scrollbars=' + s;
            //if(x_newWin != null) x_newWin.close();
            //x_newWin = window.open(fileName,'',winArgs);
            window.open(fileName,door,winArgs);
}
