var paircount = 0;

      /* If you want to desaturate after page loaded - use onload event
       * of image.
      */
      function initImage(obj)
      {
        obj.onload = null;
        var $newthis = $j(obj);
        // 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();
      };


var $j = jQuery.noConflict();

		
$j(function() { 

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

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

	$j('.top_slider').easyAccordion({autoStart: true,slideInterval: 7000});
	$j('.scrollable').scrollable({circular: true, speed:40000}).autoscroll({ autoplay: true, interval:500 });
	$j('.scrollable2').scrollable();
	
	$j('.thumb_title')
	$j('.event_thumb').mouseover(function(){
		$j('.thumb_title', this).stop().animate({top: '0px'})  
	});
	$j('.event_thumb').mouseout(function(){
		$j('.thumb_title', this).stop().animate({top: '300px'})  
	});
	
	$j(".tweet").tweet({
            username: "gemraymedia",
            join_text: "auto",
            avatar_size: 50,
            count: 4,
            auto_join_text_default: "we said,", 
            auto_join_text_ed: "we",
            auto_join_text_ing: "we were",
            auto_join_text_reply: "we replied to",
            auto_join_text_url: "we were checking out",
            loading_text: "loading tweets..."
        });
        
           

});
