$(document).ready(function() {
	//$(".gallery a").fancybox();
	$('a[target="_fancybox"]').fancybox({
		'titlePosition' : 'inside',
		'overlayColor'  : '#000',
		'overlayOpacity': '0.8',
		//'transitionIn'  : 'elastic',
		///'transitionOut'  : 'elastic'
	});
	/*
	if(GetSwfVer()!=-1) {
		$('a.media').media({
				flashVersion:  '7'
		});
		//$('.mainNav').hide();
		$('.flashNav').css({
			'position' : 'absolute',
			'top'	   : '0px',
			'right'	   : '0px'
		})
	}
	*/
	if($('body.fb')[0]) {
		var showThumbs = function() {
			$('.list a.item span.img').each(function() {
				if($(this).attr('rel')!=1 && $('.content').scrollTop()+$('.content').height()>$(this).offset().top) {
					$(this).attr('style',$(this).attr('bg'));
					$(this).attr('rel',1);
				}
			});
	    };
	    $('.content').scroll(showThumbs);
	} else {
		var showThumbs = function() {
			$('.list a.item span.img').each(function() {
				if($(this).attr('rel')!=1 && $(window).scrollTop()+$(window).height()>$(this).offset().top) {
					
					$(this).attr('style',$(this).attr('bg'));
					
					$(this).attr('rel',1);
				}
			});
	    };
	    $(window).scroll(showThumbs);
	}
	
    
	
	showThumbs();
	// fade in
	if($('.mainMedia .slider img').length>1) {
	    $('.mainMedia .slider').cycle({
			  fx: 'fade',
			  timeout : 3000
			 });
	}
	$('.backToTop').click(function(){
		$('html, body').animate({scrollTop:0}, 'slow');
	});
});
