//run masonry when page first loads
			$(window).load(function() {
				$('#masonry').masonry({
				columnWidth: 20, 
				itemSelector: '.type-post' 
				}); 
			});
			//run masonry when window is resized
	 		$(window).resize(function() {
				$('#masonry').masonry({
				itemSelector: '.type-post' 
				});
			});
			



      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(){

        $('.xxx').data('desaturate', {'level':0.5});

        $(".switched_images").bind("mouseenter mouseleave", function(event) {
            if (event.type == 'mouseenter')
            {
              //$(".des:not(.color)", this).fadeOut(1000);
              $(".des.color", this).fadeIn(500);
            }
            if (event.type == 'mouseleave')
            {
              //$(".des:not(.color)", this).fadeIn(1000);
              $(".des.color", this).fadeOut(500);
            }
          });
      });


