$(document).ready(function(){
	
	// check if cookies are available and activate objects-per-page dropdown
	// + write viewport size to cookie
	if($.cookiesAvailable()) {
		var dropdown = $('.objects-per-page');
		dropdown.show();
		dropdown.find('select').change(function() {
			var value = $('.objects-per-page option:selected').attr('value');
			$.cookie('items_per_page', parseInt(value) ? value : 5000, {path: '/'});
			location.reload();
		});
		$.cookie('viewportWidth', $(window).width());
		$(window).resize(function(){
			$.cookie('viewportWidth', $(window).width());
		});
	}
	

	// make objects hidden from general users transparent to admins
	$('#content .invisible img').css('opacity', 0.3);
	

	// make objects hoverable
	$('#content .object .info').css('opacity', 0.9);
	$('#content .object').hover(
		function(){
			$(this).find('.info').show();
		},
		function(){
			$(this).find('.info').hide();
		}
	);
	
	
	// activate search box
	$('#search-box #q').focus(function(event) {
		$(this).attr('value', '');
	});
	
	
	
});
