function init() {
	setTimeout('initSlide("fotoslider")', 1000);
	setTimeout('initSlide2("fotoslider2")', 1000);
}

var effect = "";
var effect2 = "";
var sliding = true;
var sliding2 = true;
var rowpic = 1;
var rowpic2 = 1;
var totalpics = 0;
var totalpics2 = 0;
var currentpic = 0;
var currentpic2 = 0;
var dir = 0;
var dir2 = 0;
var photowidth = 68;
var photowidth2 = 68;

function initSlide(id) {
	var fotoslider = document.getElementById(id);
	var imgs = fotoslider.getElementsByTagName("IMG");
	
	totalpics = imgs.length;
	dir = photowidth * -1;
	
	fotoslider.style.width = (imgs.length * photowidth) + "px";
	
	slidePics();
}

function slidePics() {
	if (sliding == true) {
		
		effect = new Effect.Move('fotoslider', { x: dir, y: 0, duration: 0.5, delay: 0, mode: 'relative'});
		//document.getElementById('fotos').style.overflow = "hidden";
		currentpic++;
		
		if (currentpic == ((totalpics - rowpic) - 3)) {
			//setTimeout('resetPics()', 4000);
			dir = dir * -1;
			currentpic = 0;
		} else {
			
		}
		
		//document.getElementById('pic1').innerHTML = (currentpic + 1) + "/" + totalpics;
		
		setTimeout('slidePics()', 4000);
	}
}
function resetPics() {
	dir = -68;
	sliding = false;
	currentpic = 0;
	
	effect.cancel();
	
	effect = new Effect.Move('fotoslider', { x: 0, y: 0, duration: 0.5, mode: 'absolute'});
	
	setTimeout('resetRecursiveSliding()', 4000);
}

function resetRecursiveSliding() {
	sliding = true;
	
	effect.cancel();
	
	slidePics();
}


/* FOTOSLIDER 2 */



function initSlide2(id2) {
	var fotoslider2 = document.getElementById(id2);
	var imgs2 = fotoslider2.getElementsByTagName("IMG");
	
	totalpics2 = imgs2.length;
	dir2 = photowidth2 * -1;
	
	fotoslider2.style.width = (imgs2.length * photowidth2) + "px";
	
	slidePics2();
}

function slidePics2() {
	if (sliding == true) {
		
		effect2 = new Effect.Move('fotoslider2', { x: dir2, y: 0, duration: 0.5, delay: 0, mode: 'relative'});
		//document.getElementById('fotos').style.overflow = "hidden";
		currentpic2++;
		
		//alert('total:' + totalpics2 + ' rowpic: ' + rowpic2 + ' currentpic: ' + currentpic2);
		
		if (currentpic2 == ((totalpics2 - rowpic2) - 3)) {
			//setTimeout('resetPics()', 4000);
			dir2 = dir2 * -1;
			currentpic2 = 0;
		} else {
			
		}
		
		//document.getElementById('pic2').innerHTML = (currentpic2 + 1) + "/" + totalpics2;
		
		setTimeout('slidePics2()', 4000);
	}
	
}
function resetPics2() {
	dir2 = -68;
	sliding2 = false;
	currentpic2 = 0;
	
	effect2.cancel();
	
	effect2 = new Effect.Move('fotoslider2', { x: 0, y: 0, duration: 0.5, mode: 'absolute'});
	
	setTimeout('resetRecursiveSliding2()', 4000);
}

function resetRecursiveSliding2() {
	sliding2 = true;
	
	effect2.cancel();
	
	slidePics2();
}
