$(function(){	
	// loads image bouncer on partners div
	$.image_bouncer({
		source_selector:   '#partners a.partner img'
	});
	
	// newsTools effects
	$.news_scroller({
		source_id: 'newsToolControls',
		wrapper:   'newsTool',
		nav_prev_link_class: undefined,
		nav_prev_link_html: '<img src="' + APP_PATH + 'images/newstool/newstool_back.png"/>',
		nav_next_link_class: undefined,
		nav_next_link_html: '<img src="' + APP_PATH + 'images/newstool/newstool_forward.png"/>',
		// this is shown when reproducing
		status_html_on: '<img src="' + APP_PATH + 'images/newstool/newstool_pause.png"/>',
		// this is shown when paused
		status_html_off: '<img src="' + APP_PATH + 'images/newstool/newstool_play.png"/>'			
	});
	
	// first level menu effects
	$('#firstLevelMenu li').each(function(){
		if(!$(this).hasClass('selectedItem')){
			$(this).hover(
				function(){
					$(this).addClass('selectedItem');
					$($(this).children('a').get(0)).addClass('selectedItem');
				},
				function(){
					$(this).removeClass('selectedItem');				
					$($(this).children('a').get(0)).removeClass('selectedItem');
				}			
			);		
		}
	});
});

$(window).bind('load', function(){
	// align partner images to top
	$('.imgContainer > img').each(function(){
		var wrap_size = $(this).parent().innerHeight();
		var imag_size = $(this).attr('height');
		
		var margin    = Math.floor((wrap_size - imag_size) / 2) - 10;
		
		if(margin > 0){
			$(this).css({ 'marginTop': Math.floor(margin) + 'px' });
		}
	});
});
