jQuery(document).ready(function() {

    var params = {
      changedEl: "#cmbSelectTheme",
      scrollArrows: false
    }
    //cuSel(params);

    $('.submenu_icon').click(function(){
        $(this).parent().find('.submenu').slideToggle('slow');
    });

    $('#navigation ul li').hover(function(){
        $(this).find('#submenu').stop(true, true).slideToggle('slow');
    });

    $(".close").bind("click", function(){
      $(this).parents(".fixed").fadeOut("slow");
    });

    $("#btnAskQuestion, #btnAskQuestion2").bind("click", function(){
      $(".fixed").hide();
      $('#1').fadeIn('slow');
    });

    $("#btnBigComments").bind("click", function(){
      $(".fixed").hide();
      $('#2').fadeIn('slow');
    });

    $("#btnReception").bind("click", function(){
      $(".fixed").hide();
      $('#3').fadeIn('slow');
    });

     $('a.comment').toggle(function(){
        $(this).html('Скрыть форму ответа &uarr;');
        $(this).parents("div.comment").find(".formcomment").slideDown();
        return false;
       },function (){
        $(this).html('Ответить &darr;');
        $(this).parents("div.comment").find(".formcomment").slideUp();
        return false;
     });
/*
    $(".folder").bind("click", function(){
      if ($(this).hasClass("active"))
      {
        $(this).parent("li").children("ul").slideDown("slow");
        $(this).removeClass("active");
      } else {
        $(this).parent("li").children("ul").slideUp("slow");
        $(this).addClass("active");
      }
    });
*/
    $(".active").bind("mouseover", function(){
        $(this).parent("li").children("ul").slideDown("slow");
        $(this).removeClass("active");
    });

    $(".folder").bind("click", function(){
        $(this).parent("li").children("ul").slideUp("slow");
        $(this).addClass("active");
    });

    var href = window.location.href;
    href = href.substring(href.lastIndexOf('/'));
    $('a[href="'+href+'"]').parents("ul").prevAll(".active").trigger("mouseover");

  $('.slider').mobilyslider({
    content: '.sliderContent',
    children: 'div',
    transition: 'fade',
    animationSpeed: 1000,
    autoplay: true,
    autoplaySpeed: 4000,
    pauseOnHover: false,
    bullets: true,
    arrows: false,
    arrowsHide: false
  });


  var url = window.location.href;
  var anchor = url.substring(url.lastIndexOf("#") +1);
  if (anchor == "reception")
    $("#3").fadeIn('slow');
  if (anchor == "question")
    $("#1").fadeIn('slow');

 /* // для слепых only начало
  $(window).resize(function (){
    $("#container").width($(window).width()+"px");
    $(".sliderContent img").each(function(i) {
      var _url = $(this).attr("zoom");
      var _wdt = $(window).width();
      _url = "/image.php?src="+_url+"&w="+_wdt+"&h=235&zc=1";
      $(this).attr("src", _url);
    });
  });

  $(".sliderContent img").each(function(i) {
      var _url = $(this).attr("src");
      var _wdt = $(window).width();
      $(this).attr("zoom", _url);
      _url = "/image.php?src="+_url+"&w="+_wdt+"&h=235&zc=1";
      $(this).attr("src", _url);
  });
  // для слепых only конец*/

});
