// Добавить в Избранное 
function add_favorite(a) { 
  title=document.title; 
  url=document.location; 
  try { 
    // Internet Explorer 
    window.external.AddFavorite(url, "Словари и энциклопедии на Академике: "+title); 
  } 
  catch (e) { 
    try { 
      // Mozilla 
      window.sidebar.addPanel("Словари и энциклопедии на Академике: "+title, url, ""); 
    } 
    catch (e) { 
      // Opera 
      if (typeof(opera)=="object") { 
        a.rel="sidebar"; 
        a.title="Словари и энциклопедии на Академике: "+title; 
        a.url=url; 
        return true; 
      } 
      else { 
        // Unknown 
        alert('Нажмите Ctrl-D чтобы добавить страницу в закладки'); 
      } 
    } 
  } 
  return false; 
}

jQuery(document).ready(function(){
	
	$.fn.alignCenter = function() {
 var marginLeft = Math.max(40, parseInt($(window).width()/2 - $(this).width()/2)) + 'px';
 var marginTop = Math.max(20, parseInt($(window).height()/2 - $(this).height()/2)) + $(window).scrollTop() + 'px';
 return $(this).css({'margin-left':marginLeft, 'margin-top':marginTop, 'top':0, 'left':0});
	};
	$(".zoom").click(function () {
	$(".pop-up").fadeIn(700).alignCenter();
	$('#opaco').height($(document).height());
	return false;
	});
	$(".close").click(function () {
		$(this).parent().fadeOut(500);
		$('#opaco').height(0);
		return false;
	}); 
	$("#opaco").click(function () {
		$(".pop-up").fadeOut(500);
		$('#opaco').height(0);
		return false;
	});
	
	$("input, textarea").focus(function(){
	if ($(this).attr("value") == $(this).attr("title"))
		$(this).attr("value", "");
		$(this).addClass("text")
	});
	
	$("input, textarea").blur(function(){
	if ($(this).attr("value") == "")
		$(this).attr("value", $(this).attr("title"))
	});
	$("input, textarea").blur(function(){
	if ($(this).attr("value") == $(this).attr("title"))
		$(this).removeClass ("text")
	});
	
	$(".opener").click(function(){
		if($(this).parent().hasClass("open")){
			$(this).next("div.drop").slideToggle();
			$(this).parent().removeClass("open");
			return false;
		} else {
			$(this).next("div.drop").slideToggle();
			$(this).parent().addClass("open");
		}
		return false;
	});

})



