$(document).ready(function(){
  //Кнопка-слайд: открыть/закрыть панель
  $(".btn-slide").click(function(){$("#panel").slideToggle("slow"); $(this).toggleClass("active"); return false;});

  //Всплывающий титул на жёлтом фоне
  $(".menu2 a").append("<em></em>");
  $(".menu2 a").hover(function(){
	$(this).find("em").animate({opacity:"show",top:"-75"},"slow");
	var hoverText = $(this).attr("title");
	$(this).find("em").text(hoverText);
  },function(){$(this).find("em").animate({opacity:"hide",top:"-85"},"fast")});

  //Подсветка тегов
  var f_color = ''; var f_back = ''; //backgroundColor
  $(".cloudtags a").hover(function() {
	f_color = this.style.color; f_back = this.style.background;
	$(this).animate({background:"#84d0f0",color:"blue"},500);
  },function() {$(this).animate({background:"transparent",color:"#844e44"},200);});

  //Карусель в хидере
  $("#carousel").Carousel({itemWidth:50,itemHeight:50,itemMinWidth:50,items:"a",reflections:.5,rotationSpeed:2});

  $(".cats").treeview({
	collapsed:true,
	animated:"medium",
	control:"#sidetreecontrol",
	persist:"location"
  });
});


//Переменные
var msgstat = "Добро пожаловать на литературный сайт Остров ПОЭЗЫ...";
var url = "http://isle-poem.ru/";
var title = document.title;


//Сделать стартовой, Добавить в избранное.
function bookmark() {
  if (window.sidebar) window.sidebar.addPanel("Литературный сайт Остров ПОЭЗЫ","http://isle-poem.ru/","");
  else if (document.all) window.external.AddFavorite("http://isle-poem.ru/","Литературный сайт Остров ПОЭЗЫ");
}


//Заставка при загрузке (3 части)
function hideLoading() {
  document.getElementById("PageIsLoading").style.display="none";
}


//Дата в приветствии
var month=new Array(
  "января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"
);
var now = new Date();
thisYear = now.getYear();
if (thisYear < 1900) {thisYear += 1900};
function date_wellcome() {
  document.write(now.getDate()+" "+month[now.getMonth()]+", "+thisYear+" года &nbsp;");
}


//Приветствие
function hello_gest() {
  var h=(new Date()).getHours();
  if (h>23 || h<6) hello="Доброй ночи";
  if (h>5 && h<12) hello="Доброе утро";
  if (h>11 && h<18) hello="Добрый день";
  if (h>17 && h<24) hello="Добрый вечер";
  document.write(' '+hello+', ');
}


//Переключает Календарь/Архив
var arr = new Array("block_calendar","block_archive");
function myswitch(n) {
  var _j = null;
  for (j=1;j<=arr.length;j++){
	if (_j = document.getElementById(arr[j-1])) {
	  if (j!=n) _j.style.display = "none";
	  else _j.style.display = "block";
	}
  }
}


//Переключает статистика_сайта / статистика_он-лайн
var informer_s=new Array('static_site','static_on-line');
function informer_static(n){
  var _j1=null;
  for (j1=1;j<=informer_s.length;j1++){
	if (_j1=document.getElementById(informer_s[j1-1])) {
	  if (j1!=n) _j1.style.display='none'; else _j1.style.display='block';
	}
  }
}


