/* Author: 

*/

$(document).ready(function(){

 if ( !$.browser.msie ) {
$(".shadow").css('opacity',0);
$(".shadow:visible").animate({'opacity':1},3000);
}

$(".gallery").css('opacity',0);

$('.gallery').waypoint(function() {
   
  $(this).animate({'opacity':1},2000);
   //console.log(this);
}, {
   offset: 600  // middle of the page
});

 /*

$('.gallery').scroll(function() {
  $.waypoints('refresh')
});
*/

$('.gallery.overview.images').addClass('scrollable');
$('.gallery.overview.images .item a').attr('rel','group');
$('#actions').addClass('js');

$(".scrollable").scrollable({ vertical: false, mousewheel: true,circular:false,
	onSeek: function(){
	//$(".gallery a").css('opacity',0);
		//$(".gallery a").css('opacity',0);
		$.waypoints('refresh');
	},
	onBeforeSeek:function(){
		
		
	}
}).navigator();	


//$('.gallery a:nth-child(7n)').prepend('<div>TEST');
//$('.gallery a:nth-child(6n+1)').wrap('<p>TEST</p>');

$('.gallery .item a').colorbox({
	title: ' ',
	opacity: 0.5,
	initialWidth: 437,
	initialHeight: 100,
	maxWidth: '100%',
	maxHeight: '100%',
	slideshow: true,
	slideshowAuto: false,
	rel:'group'
});


var nav_sel = '#navigation-global a';

$(nav_sel).wrapInner($('<span class="line" />'));
$(nav_sel).parent('.current:first').find('span:first').addClass('cur');

$(nav_sel).mouseover(function(event) {
	//event.preventDefault();
	//console.log($(this).css('backgroundPosition'));
	//$(this).css('backgroundPosition','-20px 0');
	$(this).find('> .line:first').stop().animate({
		'background-position': '0 10px'
	},500);
});
$(nav_sel).not('.cur').mouseout(function(event) {
	//event.preventDefault();
	//console.log(this);
				
	$(this).find('> .line:first').not('.cur').stop().animate({
		'background-position': '-215px 10px'
	},500);
});

if ($('#browsable .item').length < 7) {
	$('.navi, #actions').hide();
}

if ($('#browsable .item').length < 4) {
	$('#browsable').addClass('small');
}
//console.log($('#browsable .item').length);

}); // READY ENDE

