$j = jQuery.noConflict();

$j(document).ready(function() {
	$j('.puff').fitted();
	$j('.toppuff').fitted();
	$j('.receptpuff').fitted();

	if( $j('#myGalleryText').length )
	{	
		var n = $j('#myGalleryText').find('.gallerytext').length;
		if( n > 0 )
		{
			$j('#myGalleryText').css("visibility","hidden");
			for( i=0; i < n; i++ )
			{
				// set height of text items
				var item = $j('#myGalleryText').find('.gallerytext').get(i);
				$j(item).css({ "display": "block" });
				var content = $j(item).find(".textcontent").get(0);
				var h = $j(content).height();
				$j(item).css({ "display": "none" });
				var bg = $j(item).find(".textbg").get(0);
				$j(bg).fadeTo(10,0.5);
				var top = 50 - h;
				$j(bg).css({ "height": h+"px", "top": top+"px" });
				$j(content).css({ "top": top+"px" });
			}
			$j('#myGalleryText').css("visibility","visible");
		}
	}
});

$j(window).bind('load', function () {
	if( $j('#myGalleryText') )
	{
		var n = $j('#myGalleryText').find('.gallerytext').length;
		if( n > 0 )
		{
			$j('#myGallery').cycle('fade');
			if($j.browser.msie)
			{
				$j('#myGalleryText').cycle({ 
	    			fx:    'fade', 
	    			speed:  0 
	 			});
			}
			else
			{
				$j('#myGalleryText').cycle('fade');
			}
		}
	}
});

