/**
* CNPP JavaScript stuff.
* @author UniversalBureau
*/
var CNPP = {
	
	/**
	* Initialize.
	*/
	initOnReady : function() {	
		
		// context
		var ctxPage = jQuery("#page");
		var ctxContent = jQuery("#content");
		
		// init all
		CNPP.initScroller(ctxPage);
		CNPP.initHoverable(ctxContent);
		CNPP.initKeyNav(ctxPage);
		CNPP.initPrintLinks(ctxPage);

	},
	
	/**
	* Initialize the hoverable.
	*/
	initHoverable : function(ctx) {
		
		// events
		jQuery(".items .thumbnail",ctx).bind("mouseenter",function(){
			jQuery("img",this).animate({opacity: 0.9}, 180);
		});
		jQuery(".items .thumbnail",ctx).bind("mouseleave",function(){
			jQuery("img",this).animate({opacity: 1.0}, 300);
		});
		
	},
	
	/**
	* Initialize the scroller.
	*/
	initScroller : function(ctx) {
		jQuery(".scroller",ctx).scroller();
	},
	
	/**
	* Initialize the keyboard navigation.
	*/
	initKeyNav : function(ctx) {
		// init
		jQuery.keyNav();
		jQuery.whenPressed('h',function(){
			jQuery("#navigator_previous a",ctx).navigateTo();
		});
		jQuery.whenPressed('l',function(){
			jQuery("#navigator_next a",ctx).navigateTo();
		});
		jQuery.whenPressed('t',function(){
			jQuery("#footer_toplink a",ctx).navigateTo();
		});
	},
	
	/**
	* Initialize the print links.
	*/
	initPrintLinks : function(ctx) {	
		jQuery(".print",ctx).bind("click",function(){
			window.print();
		})
	}
}
jQuery(document).ready(function(){
	CNPP.initOnReady();
});