$(document).ready(function() {
  
  $('input[title], textarea[title]').each(function() {
    var title = $(this).attr('title');
    $(this).addClass('hinted');
    if ($(this).is('input')) {
      $(this).attr('value', title);
      $(this).focus(function() {
        if ($(this).attr('value') == title) {
          $(this).removeClass('hinted').attr('value', '');
        };
      });
      $(this).blur(function() {
        if ($(this).attr('value').length == 0) {
          $(this).addClass('hinted').attr('value', title);
        };
      });
    } else {
      $(this).html(title);
      $(this).focus(function() {
        if ($(this).val() == title) {
          $(this).removeClass('hinted').empty();
        };
      });
      $(this).blur(function() {
        if ($(this).val().length == 0) {
          $(this).addClass('hinted').html(title);
        };
      });
    };
  });
  
  $('.sitemap h4').click(function() {
       //узнаем где якорь
      elementClick = $(this).attr("href");
      destination = $(elementClick).offset().top;

    var container = $(this).parent();
    if (container.hasClass('expanded')) {
      $(this).next().slideUp('fast', function() {
        container.removeClass('expanded');
       
      });
    } else {
      container.addClass('expanded');
      $(this).next().slideDown('fast');
       //двигоемся до якоря
      if($.browser.safari){
        $('body').animate( { scrollTop: destination }, 1100 );
      }else{
        $('html').animate( { scrollTop: destination }, 1100 );
      }
      return false;
    };

  });

   $("#showSeoHolder").click(function () {
        //$("span").show(2000);
        alert(1);
        if($("#seo-holder").is(":hidden")) {
             $("#seo-holder").show("slow");
        } else {
             $("#seo-holder").hide("slow");
        }
       

        return false;
   });
});

