// -*- javascript -*-
// FILE: "/home/znouza/projects/php/akelos2/public/javascripts/stripe.js"
// DESC: ""
// LAST MODIFICATION: "�t, 04 �en 2009 11:12:52 +0200 (znouza)"
// (C) 2009 by Tom Meinlschmidt <tomas@meinlschmidt.org>
// $Id: js/stripe.js,v 0.0 2009/05/21 12:18:36 znouza Exp $
// $Log: $

	// default position to start from
    var pozice =0;
	// 0 = beginning, 1 = at the end
	var stav_pozice = 0;
	// 5 sec delay
	var default_timeout = 5*1000;

    var scroll = new Fx.Scroll('galerie', {
  		wait: false,
  		duration: 1500,
		offset: {'x': 0, 'y': 0},
		transition: Fx.Transitions.Quad.easeInOut
		});

	function moveRight () {
		pozice+=4;
		if (document.getElementById('img_'+pozice)!=null) {
			scroll.toElement('img_'+pozice)
		} else {
			pozice-=4;
			// jsme na konci
			stav_pozice = 1;
		}
	}

	function moveLeft () {
		if (pozice>=4) { 
			pozice-=4;
		} else {
			// jsme na zacatku
			stav_pozice = 0;
		}
		scroll.toElement('img_'+pozice)
	}

	function moveAuto () {
		if (stav_pozice==0) {
			moveRight();
		} else {
			moveLeft();
		}
		setTimeout('moveAuto()',default_timeout);
	}
	     			
	$('move-right').addEvent('click', function(event) {
		event = new Event(event).stop();
		moveRight();
		});

	$('move-left').addEvent('click', function(event) {
		event = new Event(event).stop();
		moveLeft();
		});

//	setTimeout('moveAuto()',default_timeout);
