window.onload = function() {
	var offset = 0;
	var diff = 2;
	var stop = false;
	var containerWidth = 0
	if($('slide')) {
		
		var width = $('slide').getWidth();
	
		$$('.slideImage').each(function(element){
			element.setStyle({left: offset+'px'});
			offset += element.down('img').width + 13;
		});
		containerWidth = offset;
		offset = 0;
		$('rightHandler').onclick = function() {
			return false;
		}
		$('rightHandler').onmousedown = function() {
			diff = 10;
		}
		$('rightHandler').onmouseup = function() {
			diff = 2;
		}
		$('leftHandler').onmousedown = function() {
			diff = 10;
		}
		$('leftHandler').onmouseup = function() {
			diff = 2;
		}
		$('leftHandler').onclick = function() {
			return false;
		}
		$('rightHandler').onmouseover = function() {
			stop = false;
			new PeriodicalExecuter(function(slider) {
				if (stop) {
					slider.stop();
				} else {
					if(containerWidth + offset > width) {
						offset -= diff;
						$('slideContent').setStyle({left: offset+'px'});	
					} 
				}
				if(containerWidth + offset < width+80) {
					if(diff > 1) {
						diff--;
					}
				}
			}, 0.001);
		}
		$('leftHandler').onmouseover = function() {
			stop = false;
			new PeriodicalExecuter(function(slider) {
				if (stop) {
					slider.stop();
				} else {
					if(offset < 0) {
						offset += diff;
						$('slideContent').setStyle({left: offset+'px'});
					}
				}
				if(offset > -80) {
					if(diff > 1) {
						diff--;
					}
				}
			}, 0.001);
		}
		$('rightHandler').onmouseout = function() {
			stop = true;
		}
		$('leftHandler').onmouseout = function() {
			stop = true;
		}
	}	
}