function initGallery() {
	// hover function init
	$('div.gallery ul.list li').each(function(){
		var _duration = 500;
		var _holder = $(this);
		var _slider = _holder.find('div.description');
		var _sheight = _slider.height();

		_slider.css({marginTop:-_sheight})

		_holder.mouseenter(function(){
			_slider.animate({marginTop:0}, {duration:_duration, queue:false});
		}).mouseleave(function(){
			_slider.animate({marginTop:-_sheight}, {duration:_duration, queue:false});
		});
	});

	// fade gallery
	$('div.gallery ').slideShow({
		slideEl:'ul.list li',
		numElementLink:'ul.pager a',
		linkNext:'a.link-next',
		linkPrev:'a.link-prev',
		linkPause:'a.pause',
		autoSlideShow:true,
		switchTime:3000,
		duration:750,
		event:'click'
	});

}

$(document).ready(function(){
	initGallery();
	Cycler();
});

function hideGSVideo()
{
    $('div[id$=GSVideos]').remove();
}

function Cycler()
{
    $('.tab ul').each(function(){
        $(this).children('li:first').show();
    });
    $('.tab').each(function(){
        var scrolltab = $(this);
        scrolltab.find('.prev-next a').each(function(){
            //alert('found prev/next link');
            var pnLink = $(this);
            pnLink.click(function(event){
                //alert('clicked a link');
                event.preventDefault();
                var toShow = scrolltab.find('li').index(scrolltab.find('li:visible'));
                var stuff = pnLink.attr('rel');
                if(pnLink.attr('rel') == 'Prev')
                {
                    toShow--;
                    if(toShow < 0)
                    {
                        toShow = $(scrolltab).find('li').length - 1;
                    }
                }
                else
                {
                    toShow++;
                    if(toShow >= $(scrolltab).find('li').length)
                    {
                        toShow = 0;
                    }
                }
                scrolltab.find('li').hide();
                scrolltab.find('li:eq('+toShow+')').show();
            });
        });
    });
}