// JavaScript Document

$(document).ready(function() { 
// ========= fancybox ================
$("a[rel=viewGallery]").fancybox({
		'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'titlePosition' 	: 'over',
		'centerOnScroll'    : 'true', 
		'cyclic'            : 'true',
		'overlayOpacity'    : '0.8', 
		'overlayColor'      : '#000',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Фото ' + (currentIndex + 1) + ' из ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
});
});
$(document).ready(function() { 
$("a[rel=viewObjects]").fancybox({
		'transitionIn'		: 'fade',
		'transitionOut'		: 'fade',
		'titlePosition' 	: 'over',
		'centerOnScroll'    : 'true', 
		'cyclic'            : 'true',
		'overlayOpacity'    : '0.8', 
		'overlayColor'      : '#000',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Фото ' + (currentIndex + 1) + ' из ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
});
});




// desaturate
 var paircount = 0;

      /* If you want to desaturate after page loaded - use onload event
       * of image.
      */
      function initImage(obj)
      {
        obj.onload = null;
        var $newthis = $(obj);
        if ($.browser.msie)
        {
          // You need this only if desaturate png with aplha channel
          $newthis = $newthis.desaturateImgFix();
        }
        // class for easy switch between color/gray version
        $newthis.addClass("pair_" + ++paircount);
        var $cloned = $newthis.clone();
        // reset onload event on cloned object
        $cloned.get(0).onload = null;
        // add cloned after original image, we will switch between
        // original and cloned later
        $cloned.insertAfter($newthis).addClass("color").hide();
        // desaturate original
        $newthis.desaturate();
      };

      $(function(){

         $(".switched_images").bind("mouseenter mouseleave", function(event) {
            if (event.type == 'mouseenter')
            {
              //$(".des:not(.color)", this).fadeOut(1000);
              $(".des.color", this).fadeIn(300);
            }
            if (event.type == 'mouseleave')
            {
              //$(".des:not(.color)", this).fadeIn(1000);
              $(".des.color", this).fadeOut(300);
            }
          });
      });
$(document).ready(function(){
									
	$("#toggleLink_01").click(function () {
	  $("#toggleBox_01").slideToggle("slow");
	});
	$("#toggleLink_02").click(function () {
	  $("#toggleBox_02").slideToggle("slow");
	});
	$("#toggleLink_03").click(function () {
	  $("#toggleBox_03").slideToggle("slow");
	});
	$("#toggleLink_04").click(function () {
	  $("#toggleBox_04").slideToggle("slow");
	});
	$("#toggleLink_05").click(function () {
	  $("#toggleBox_05").slideToggle("slow");
	});

  });





       
   

