$(window).load(function() {
	App.initNavigationPosition();
})

App = {
	
	currentSlideIndex: 0,
	currentProductIndex: 0,
	currentProduct: null,
	isSliding: false,
	currentStepIndex: 0,
	kommen: [ 0, 0, 0 ],
	kommenMax: 3,
	
	bootReady: function()
	{
		this.initNavigation();
	},
		
	initNavigationPosition: function(){
		//loaded when window is ready (because fonts are not loaded before)
		var items = $( '#header div.submenu' );
		$.each( items, function( key, value ){
			//change menu position
			$( value ).css( {'margin-left': - (  $( value ).width() / 2   )  + ( $( '> a', $( value ).parent() ).width() / 2  ) } );
			
			//change pointer position
			$(' > div', $( value )).css(   {'margin-left': ($( value ).width() / 2   ) - 7  }   );
		});		
		
	},
	
	initNavigation: function(){
		var items = $( '#header div.submenu' );
		$.each( items, function( key, value ){
			$( '> a', $( this ).parent()).addClass('hassubs');
			
			$( $( this ).parent()).mouseenter( function(event){
				$(value).show();
			});

			$( $( this ).parent()).mouseleave( function(event){
				$(value).hide();
			})
			$( value ).hide();
		});
	}
}
