$(document).ready(function() {
  $('a:not(.jq_ignore)').filter(function() {
    return this.hostname && this.hostname !== location.hostname;
  }).addClass('external');
  	var offset = $("#scrollparent").offset();
    $(document).delay(10000);
	doScroll(offset.left);	
	$(".name_overlay").css({ opacity: 0.5 });
	$(".jq_ignore").css({ opacity: 1 });
});

function doScroll(oldLeft) {
	
	var offset = $("#scrollparent").offset();
	var adjust = oldLeft - (offset.left*-1);
	var scrWidth = $(".scroller").outerWidth(true);
	
	if(offset.left < 0) 
			{
				offset.left = (offset.left*-1);
				var newLeft = (offset.left+scrWidth)+adjust;
					
			} else {
				var newLeft = scrWidth;
			};
		

	$('#scrollparent').animate(
							   {left: -newLeft},
							   2500,
							   function()
							     {
									if($(".scroller:last").offset().left < 0) 
										{
											$('#scrollparent').animate({left: 0},2500);
											doScroll(0);
										} else {
									doScroll(newLeft);
										};
  								 }
							  );
}