function changeClass(obj, newClass){
	obj.setAttribute('class', newClass);
	obj.setAttribute('className', newClass);
	obj.className = newClass;
}

var porta = 0;
var isScrolling = false;

function scroll(pixel) {
	var obj = document.getElementById('elenco_porte_interno');
	
	if (obj.style.marginLeft == "") {
		obj.style.marginLeft = 0;
	}
	
	if (pixel > 0) {
		obj.style.marginLeft = parseInt(obj.style.marginLeft) - 2 + "px";
		setTimeout("scroll(" + (pixel - 2) + ")", 1);
	}
	else if (pixel < 0) {
		obj.style.marginLeft = parseInt(obj.style.marginLeft) + 2 + "px";
		setTimeout("scroll(" + (pixel + 2) + ")", 1);
	}
	if (pixel == 0) {
		isScrolling = false;
	}
}

function scroll2(pixel) {
	if (!isScrolling) {
		var ok = false;
		if (pixel > 0 && porta + 6 < porte) {
			porta += 6;
			ok = true;
		}
		if (pixel < 0 && porta > 0) {
			porta -= 6;
			ok = true;
		}
		
		if (ok) {
			isScrolling = true;
			scroll(pixel);
		}
	}
}

function scrollDoorsRight() {
	scroll2(306);
}

function scrollDoorsLeft() {
	scroll2(-306);
}
