$(window).load(function() {
		$("#topContainer .custLogos .viewPort ul li img").each(function (){
			var imgwidth = $(this).width();		
			$(this).parent().css('width',imgwidth);				
		});
		
		var logoUlWidth = 0
		
		$("#topContainer .custLogos .viewPort ul li").each(function (){
			logoUlWidth += $(this).width();					
		});
		//alert (logoUlWidth);
		$('ul.logos').css('width',logoUlWidth);
});
	// JavaScript Document

$(document).ready(function() { 
		
		var intval=""
		$('.custLogos a.left').hover(function(){
				intval=window.setInterval(function() { slideLeft() } ,1);
		},function(){
				window.clearInterval(intval);
		});
		
		var intval2=""	
		$('.custLogos a.right').hover(function(){
											 
				intval2=window.setInterval(function() { slideRight() } ,1);
		},function(){
				window.clearInterval(intval2);
		});

});

function slideLeft(){
			var leftVal = $('.custLogos ul.logos').css('margin-left');
				leftVal = parseInt(leftVal);
				leftVal = (leftVal*-1); 
					 
				if (!$('.custLogos ul.logos').is(':animated')) {
					if (leftVal>=0){
							$('.custLogos ul.logos').animate({
												'marginLeft': '+=5'	},1)
							}
				}
				
}


function slideRight(){
			var ulwidth = $('ul.logos').width();
				var viewPort = 875;
				var lessThanViewPort = ulwidth-viewPort;
				
				var leftVal = $('.custLogos ul.logos').css('margin-left');
					leftVal = parseInt(leftVal);
					leftVal = (leftVal*-1); 
					
				if (!$('.custLogos ul.logos').is(':animated')) {
					if (leftVal<lessThanViewPort){
						$('.custLogos ul.logos').animate({
											'marginLeft': '-=5'	},1)
					}
				}
}



