$(document).ready(function() {
	if(jQuery('.gallery').length > 0){
        jQuery('.gallery').each(function(index,galerry){
            jQuery(galerry).after('<ul id="mycarousel' + index + '" class="jcarousel-skin-tango"></ul>');
            jQuery(galerry).find('a').each(function(index2, link){
                jQuery(link).clone().attr('rel','fancygroup').appendTo('#mycarousel' + index).wrap('<li></li>');
            });
		    jQuery('#mycarousel' + index).wrap('<div class="fgallery"></div>');
            var isH2 = jQuery(galerry).prev();
            if(isH2.is('h2')){
                isH2.prependTo(jQuery('#mycarousel' + index).parent());
            }
            jQuery('#mycarousel' + index).jcarousel();
            jQuery(galerry).remove();
        });
    }
			/*
			*   Examples - images
			*/

			$("a#example1").fancybox({
				'titleShow'		: false
			});

			$("a.fancyimg").fancybox({
				'titleShow'		: false,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic'
			});

			$("a[rel=fancygroup]").fancybox({
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'elastic',
				'titlePosition' 	: 'over',
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over"> ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});

			/*
			*   Examples - various
			*/

			$("#various1").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});

			$("#various2").fancybox();

			$("#various3").fancybox({
				'width'				: '75%',
				'height'			: '75%',
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
			});

			$("#various4").fancybox({
				'padding'			: 0,
				'autoScale'			: false,
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});
		});



$(function () {
        if ($.browser.msie && $.browser.version < 7) return;
        
        $('#navigation li')
            .removeClass('highlight')
            .find('a')
            .append('<span class="hover" />').each(function () {
                    var $span = $('> span.hover', this).css('opacity', 0);
                    $(this).hover(function () {
                        // on hover
                        $span.stop().fadeTo(500, 1);
                    }, function () {
                        // off hover
                        $span.stop().fadeTo(500, 0);
                    });
                });
                
    });


