$(document).ready(function() {
	// Hehe. Konami :D
	var kkeys=[],konami="38,38,40,40,37,39,37,39,66,65";
	$(document).keydown(function(e) {
		kkeys.push( e.keyCode );
		if ( kkeys.toString().indexOf( konami ) >= 0 ){
			$(document).unbind('keydown',arguments.callee);
				$.getScript('http://www.cornify.com/js/cornify.js',function(){
					cornify_add();
					$(document).keydown(cornify_add);
			});          
		}
	});
	
	//var i=0;
	$(".photo img").each(function(){ // for each photo
		var url="";
		var src=$(this).attr("src"); // get the src value
		var parent=$(this).parent(); // get parent
		url=parent.attr("href"); // get the href attribute from the parent
		if((url==undefined)||(url.length==0)) { // check if the parent was a link
			parent.attr("href",src);
		}
		parent.fancybox({
			'zoomSpeedIn':500,
			'zoomSpeedOut':500,
			'zoomSpeedChange':800,
			'easingIn':'easeOutBack',
			'easingOut':'easeInBack',
			'easingChange':'easeInOutBack',
			'padding':0,
			'hideOnContentClick':true,
			'zoomOpacity':false,
			'centerOnScroll':false,
			'imageScale':false,
			'overlayShow':false 
		});
	});
	
	// make stuff transparent
	var opacity=0.9;
	$("#content").css('opacity',opacity);
	$(".labels").css('opacity',opacity);
	var image_opacity=0.8;
	var image_selector=".photo img:not(.fullsize)";
	$(image_selector).css('opacity',image_opacity);
	$(image_selector).mouseover(function(){
		$(this).animate({opacity:1},200);
	});
	$(image_selector).mouseout(function(){
		$(this).stop().animate({opacity:image_opacity},200);
	});
});