/**********************************************\
Required Libraries:
Jquery
Tooltip-Plugin
\**********************************************/
/*
document.write('\u003Cscript src="/_js/lib/jquery-1.5.2.min.js"\u003E\u003C/script\u003E');
document.write('\u003Cscript src="/_js/lib/jquery-tooltip-plugin.js"\u003E\u003C/script\u003E');
*/

$(document).ready(function()
{
/**********************************************\
Map
\**********************************************/ 
	$('#smallMap img').hide();	
	
/**********************************************\
External links
\**********************************************/ 
	$('a[href^="http://"]').attr('target', '_blank');

/**********************************************\
Tooltips
\**********************************************/ 	
	$('a[title]').addClass('tooltip');
	$('a[href="#"]').removeAttr('href');
	$('a[title]').tooltip({showURL: false, delay: 0});

/**********************************************\
Member logo animation
\**********************************************/ 	
	// disable non-javascript scrollbar
	$('#footer').css('height', '28px');
	$('#footer').css('overflow', 'hidden');
	
	// start animation
	endlessLoop();
});

// Average animation duration (and thus animation speed) 
// will be recalculated based on image width 
// to achive a smooth animation
var duration = 4000;		

							
function endlessLoop()
{
	var $elmLast = $('#footer img:last');
	
	// reset width
	$elmLast.css('width', 'auto');
	
	// get width
	var marginLeft = parseInt($elmLast.width());

	// remove last image and prepend it
	$elmLast.remove();
	$elmLast.css('marginLeft', '-'+marginLeft+'px');
	$elmLast.insertBefore('#footer img:first');

	$elmFirst = $('#footer img:first');	
	
	// recalculate animation duration based on image width 
	var dur = (marginLeft*duration)/100;
	
	// move first image
	$($elmFirst).animate(
	{
		marginLeft: '0'
		
	}, {duration:dur, easing:'linear', complete: endlessLoop});
}

