$(document).ready(function(){
	
	// check for homepage logos
	doLogos();
	
});

function doLogos() {
	
	var logos = $('#logos');
	if ( logos.length != 0) {
		
		// initiate container
		logos.css({
			"position":"relative",
			"overflow":"hidden",
			"height":"200px"
		});
		var width = logos.width();
		
		// initiate each logo
		logos.children().each(function(i){
		
			$(this).css({
				"position":"absolute",
				left:315,
				top:0,
				opacity:0
			});
			
		});
		
		// do actions
		var speed = 3000;
		function moveIn(i) {
			logos.children().eq(i)
				.animate({opacity:1}, {
					duration:speed/2, 
					queue:true
				})
				.animate({opacity:0}, {
					duration:speed/2, 
					queue:true,
					complete:function(){
						if (i < logos.children().length -1) moveIn(i+1);
						else moveIn(0);
					}
				})
		}
		
		moveIn(0);
		
	}
	
}
