$(window).load( function()
{
	$(document).ready(function()
	{
		// Slider settings
		var sliderParent	= "#slider";
		var sliderChild 	= "img";
		var scrollInterval 	= 10000;
		var scrollSpeed		= 2000;
		
		
		// The code
		var sliderAmount 	= $(sliderParent).children().length;
		var offset 			= 0;
		
		$(sliderParent +" "+ sliderChild).each(function()
		{	
			$(this).css("left", offset + "px");
			
			var thisWidth	= $(this).css("width");
				
			if( thisWidth == "auto") /* IE */
				thisWidth = parseInt($(this).width());
			else /* FF & SF */
				thisWidth = parseInt($(this).css("width"));
			
			offset = offset + thisWidth;
		});
		
		setInterval(function()
		{
			$(sliderParent +" "+ sliderChild).each(function()
			{
				var thisWidth	= $(this).css("width");
				var thisLeft	= parseInt($(this).css("left"));
				
				if( thisWidth == "auto") /* IE */
					thisWidth = parseInt($(this).width());
				else /* FF & SF */
					thisWidth = parseInt($(this).css("width"));
					
				$(this).animate({left: (thisLeft-thisWidth)+"px"}, scrollSpeed);
				
				if( thisLeft <= -thisWidth )
					$(this).animate({left: (offset-(thisWidth*2))}, 0);
			});
		}, scrollInterval);
		
		
	
		// logoSlider settings
		var logoSliderParent	= "#logos";
		var logoSliderChild 	= "img";
		var logoSliderSpeed 	= 30;
		
		var logoSliderAmount 	= $(logoSliderParent).children().length;
		var logoOffset 			= 0;
		
		$(logoSliderParent +" "+ logoSliderChild).each(function()
		{	
			$(this).css("left", "" + logoOffset + "px");
			
			var logoThisWidth	= $(this).css("width");
			if( logoThisWidth == "auto" )
				logoThisWidth = parseInt($(this).width())  + parseInt($(this).css("padding-right"));
			else
				logoThisWidth = parseInt($(this).width())  + parseInt($(this).css("padding-right"));
				
			logoOffset = logoOffset + logoThisWidth;
		});
		
		setInterval( function()
		{
			$(logoSliderParent +" "+ logoSliderChild).each(function()
			{
				var logoLeft 	= parseInt( $(this).css("left") );
				
				var logoThissWidth	= $(this).css("width");
				
				if( logoThissWidth == "auto" )
					logoThissWidth = parseInt($(this).width())  + parseInt($(this).css("padding-right"));
				else
					logoThissWidth = parseInt($(this).css("width"))  + parseInt($(this).css("padding-right"));
					
				var logoLastChild 	= logoOffset - logoThissWidth;
				
				$(this).css("left", (logoLeft-2)+"px");
				
				if(logoLeft < -(logoThissWidth) )
				{
					$(this).css("left", "" + logoLastChild + "px" );
				}
			});
		},(1000/logoSliderSpeed) );
	});
});
