current = 'slider-notizie';
toHide = current;


function ismoving() {
/* ritorna true se qualche box è in movimento,
controllando che un box sia nella posizione visibile (coordinata x = 594) */

	moving = true;

	boxes = new Array('slider-notizie', 'slider-dicono', 'slider-tariffa', 'slider-domande', 'slider-moduli', 'slider-scrivici');
	for (i=0; i<boxes.length; i++) {
		xpos = parseInt(Element.getStyle($(boxes[i]), 'left'));
		if (xpos == 594) {
			moving = false;
		}
	}

	return moving;
}


function entra(id) {
	if (current != id && !ismoving()) {

		squareid = 'square' + id.substring(id.indexOf('-'));
		squareimg = $(squareid);
		srcimg = squareimg.getAttribute('src');
		if (srcimg.substring(srcimg.length - 6) != "_s.gif") {
			srcimg = srcimg.substring(0, srcimg.length - 4) + "_s.gif";
		}

		squareimg.setAttribute('src', srcimg);

		squarecurrent = 'square' + current.substring(current.indexOf('-'));
		squareimg = $(squarecurrent);
		srcimg = squareimg.getAttribute('src');

		if (srcimg.substring(srcimg.length - 6) == "_s.gif") {
			srcimg = srcimg.substring(0, srcimg.length - 6) + ".gif";
		}
		
		squareimg.setAttribute('src', srcimg);

// Faccio sparire il box correntemente visualizzato
		xpos = parseInt(Element.getStyle($(current), 'left'));
		offset = xpos - 260;
		if (offset > 0) {
			new Effect.MoveBy(current, 0, -offset);
		}
// Faccio apparire il box richiesto
		xpos = parseInt(Element.getStyle($(id), 'left'));
		offset = 594 - xpos;
		if (offset > 0) {
			new Effect.MoveBy(id, 0, offset);
			current = id;
		}

	}
}



function movetab(element, dir) {
	return;
	DISTANCE = -5;
	ypos = parseInt(Element.getStyle(element, 'top'));
	if (ypos == 0) {
		offset = -5;
	} else
	if (ypos == -5) {
		offset = 5;
	} else {
		offset = -ypos;
	}
//	if (ypos == -5 || ypos == 0) {
		new Effect.MoveBy(element, offset, 0, {duration: 0.2})
//	}
}

