jQuery.fn.imageScroll = function() {
    var args = arguments[0] || {};
    var imageWidth = args.width;
    
    var slider = $(this);
    
    var images = $(".slider-image", slider);
    var numImages = images.length;
    var scrollPosition = 0;
    
    var windowWidth = $(window).width();
    
    var sliderLength = numImages * imageWidth;
    
    var dif = sliderLength - windowWidth - imageWidth;
    
    $(".ico_prev", slider).click( function(){
    	    
    	console.log(sliderLength);
    	  	
    	if (scrollPosition > 0)
    	{
    		$(".pics", slider).animate({
				left: '+=' + imageWidth + ''			
			}, 1000, function() {
				scrollPosition -= imageWidth;
			});
    	}
    });
    
    $(".ico_next", slider).click( function(){
    	
    	
    	
    	if (scrollPosition < dif)
    	{
    		console.log(scrollPosition);
    		
    		$(".pics", slider).animate(
    			{
					left: '-=' + imageWidth + 'px'			
				}, 1000, function() {
				scrollPosition += imageWidth;
			});
    	}
    });
};
