	var interval = 0;
	
	var slideTimeout;
	var imgSize = 150;
	var totalWidth;

	$(function(){
		var divWidth	= 0;
		var totalWidth 	= 0;
		var left = 0;
		
		//Random images
		var slides = $('div.slideView div.slides a');
		slides.each(function(index)
		{
			var place = parseInt(Math.random() * slides.length);
			$(this).insertAfter(slides.eq(place));
		});
		
		$('div.slideView div.slides').attr('moveTo', 0);

		$('.slides').each(function()
		{
			totalWidth = $(this).find('img').length * imgSize;
			
			$(this).css({'position':'absolute', 'width': totalWidth + 'px' });
		});
		
		$('div.slideLeft').mouseenter(function() {
			animate(1);
		}).mouseleave(function() {
			//animate(false,true);
			clearTimeout(slideTimeout);
		});		
		$('div.slideRight').mouseenter(function() {
			animate(2);
		}).mouseleave(function() {
			//animate(false,true);
			clearTimeout(slideTimeout);
		});
		
		// Animeer
		function animate(direction)
		{
			clearTimeout(slideTimeout);
			
			var theWay = parseInt($('div.slideView div.slides').attr('moveTo'));
			
			if (direction == 1)
			{
				theWay -= imgSize;
				
				if (theWay <= -(totalWidth + -889)) theWay = -(totalWidth + -889)
			}
			else
			{
				theWay += imgSize;
				
				if (theWay >= 0) theWay = 0;
			}
						
			$('div.slideView div.slides').stop(true, false)
			$('div.slideView div.slides').attr('moveTo', theWay);
			
			$('div.slideView div.slides').animate(
			{ 'left': theWay }, 750, 'linear');
			
			slideTimeout = setTimeout(function() { animate(direction) }, 750);
		}
		
		/*
		function animate(direction,stop){
		if(stop){
			interval = window.clearInterval(interval);
		} else {
			if(direction == 1){ theWay = '-='+slideWidth} else { theWay = '+='+slideWidth};
			
			
			$('div.slideView').stop().animate({
					'left': theWay
				}, 1500,'linear', function(i) {
					
			});
			interval = setInterval(function(){ 
				 $('div.slideView').stop().animate({
						'left': theWay
				}, 1500, function(i) {
					
					});
			}, 2000);
		}
		}
	*/
	});
