
function strstr( haystack, needle, bool ) {
	var pos = 0;
	haystack += '';
	pos = haystack.indexOf( needle );
	if (pos == -1)
	{
		return false;
	}
	else
	{
		if( bool )
		{
			return haystack.substr( 0, pos );
		}
		else
		{
			return haystack.slice( pos );
		}
	}
}	

$(function()
{
	$('.ImageHolder a').lightBox();
	$('.GalleryRow dt a').lightBox();
});

$(function()
{
	$('#SlideShow').cycle({ 
		fx: 'fade'
		//delay:  -6000
	});
});

$(function()
{
	$('#Form textarea').autogrow();				
});

$(function(){

	$('.FAQToggle').click(function () 
	{
		var ResultID = this.id.replace('more_', '');
		$('#detail_'+ResultID+'').slideToggle('fast');
		
		$( this ).toggleClass('FAQCollapse');
	}),

	$('.FAQToggleAll').click(function () 
	{
		$('.FAQAnswer').show('fast');
		$('.FAQToggle').addClass('FAQCollapse');
		
		$( this ).hide();
		$('.FAQCollapseAll').show();
	}),

	$('.FAQCollapseAll').click(function () 
	{
		$('.FAQAnswer').hide('fast');
		$('.FAQToggle').removeClass('FAQCollapse');
		
		$( this ).hide();
		$('.FAQToggleAll').show();
	})
});

jQuery.fn.fadeToggle = function(speed, easing, callback) {
   return this.animate({opacity: 'toggle'}, speed, easing, callback);

}; 