/**
 * @project: PURNA
 * @location: Wax Interactive - www.wax.be
 * @date: 29.09.2010
 * @author: Jan De Wilde
 * @description: Core logic
 */ 

if(typeof $.PURNA == "undefined") {
	$.PURNA = Object;
}

/**
 * Something
 */
$.PURNA.init = {
	construct		:		function(){
		$.PURNA.init.navigation();
		$.PURNA.init.innercontent();
		$.PURNA.init.cycle();
		/*$.PURNA.init.background();
		$(window).bind('resize',function(){
			$.PURNA.init.background();
		});*/
	},
	
	navigation		:		function(){
		$("ul.sf-menu").superfish({
			autoArrows: false,
			dropShadows: false,
			speed: 0,
			delay: 100
		});
	},
	
	innercontent	:		function(){
		$('#scrollpane').jScrollPane({
			verticalDragMinHeight: 20,
			verticalDragMaxHeight: 20,
			horizontalDragMinWidth: 20,
			horizontalDragMaxWidth: 20,
			hijackInternalLinks: true
		});
	},
	
	background		:		function(){
		var bgWidth = $('#background').width();
		var bgHeight = $('#background').height();
		
		var docWidth = $(document).width();
		var docHeight = $(window).height();
		
		var diffWidth = bgWidth - docWidth;
		var diffHeight = bgHeight - docHeight;
		
		if(diffWidth < diffHeight){
			$('#background').css('width','100%');
			$('#background').css('height','auto');
		} else {
			$('#background').css('height','100%');
			$('#background').css('width','auto');
		}
	},
	
	cycle			:		function(){
		$('#wrapper').cycle({
			fx:      'fade',
			timeout:  5000,
			slideExpr: 'img.background'
		});
	}
}

/**
 * Execute when DOM is ready
 */
$(document).ready(function(){
	$.PURNA.init.construct();
});
