////////////////// AUTO SCROLL ////////////
autoScroll2ing = false;
function initAutoScroll2() {
	// find scroll2ing items
	if (asEl2 = document.getElementById('autoScroll2')) {
		prevBtn2 = document.getElementById('autoScroll2Prev');
		nextBtn2 = document.getElementById('autoScroll2Next');
		scroll2TargetEl = document.getElementById(asEl2.getAttribute('scrollTarget'));
		scroll2TargetContentsEl = document.getElementById(asEl2.getAttribute('scrollTarget')+'Content');
		nextBtn2.onclick = scroll2NextFunction = function() {
			if (this.className!='inactive' && !autoScroll2ing) {
				prevBtn2.className = '';
				leftDestination2 = (parseInt(scroll2TargetContentsEl.style.left) - parseInt(scroll2TargetEl.getAttribute('scrollJump')));
				if (scroll2TargetEl.getAttribute('scrollType')=='fade') {
					fade2TargetTo(scroll2TargetContentsEl,leftDestination2);
				} else {
					scroll2TargetTo(scroll2TargetContentsEl,leftDestination2,-1*(scroll2TargetEl.getAttribute('scrollSpeed')),scroll2TargetEl.getAttribute('smooth'));
				}
				if ((leftDestination2 + parseInt(scroll2TargetContentsEl.style.width)) - parseInt(scroll2TargetEl.getAttribute('scrollJump')) < parseInt(scroll2TargetEl.style.width)) {
					this.className = 'inactive';
				}
			}
		}
		if (!((parseInt(scroll2TargetContentsEl.style.left) + parseInt(scroll2TargetContentsEl.style.width)) > parseInt(scroll2TargetEl.style.width))) {
			nextBtn2.className = 'inactive';
		}
		prevBtn2.onclick = function() {
			if (this.className!='inactive' && !autoScroll2ing) {
				nextBtn2.className = '';
				leftDestination2 = (parseInt(scroll2TargetContentsEl.style.left) + parseInt(scroll2TargetEl.getAttribute('scrollJump')));
				if (scroll2TargetEl.getAttribute('scroll2Type')=='fade') {
					fade2TargetTo(scroll2TargetContentsEl,leftDestination2);
				} else {
					scroll2TargetTo(scroll2TargetContentsEl,leftDestination2,scroll2TargetEl.getAttribute('scrollSpeed'),scroll2TargetEl.getAttribute('smooth'));
				}
				if (!leftDestination2) {
					this.className = 'inactive';
				}
			}
		}
		if (!parseInt(scroll2TargetContentsEl.style.left)) {
			prevBtn2.className = 'inactive';
		}
		asEl2.style.display = 'block';
	}
}
function scroll2TargetTo(el,leftTarget,step,smooth) {
	autoScroll2ing = true;
	if (smooth) {
		// go 10% of the way
		smoothStep = Math.ceil(0.3*(leftTarget - parseInt(el.style.left)));
		if (!smoothStep && (leftTarget - parseInt(el.style.left))) smoothStep = -1;
		// limit speed to step
		if (Math.abs(smoothStep) > Math.abs(step)) smoothStep = step;
		el.style.left = (parseInt(el.style.left)+parseInt(smoothStep))+'px';
	} else {
		el.style.left = (parseInt(el.style.left)+parseInt(step))+'px';
	}
	if (step > 0) {
		if (parseInt(el.style.left) >= leftTarget) {
			el.style.left = leftTarget + 'px';
			autoScroll2ing = false;
			return true;
		}
	} else {
		if (parseInt(el.style.left) <= leftTarget) {
			el.style.left = leftTarget + 'px';
			autoScroll2ing = false;
			return true;
		}
	}
	setTimeout("scroll2TargetTo(scroll2TargetContentsEl,'"+leftTarget+"','"+step+"','"+smooth+"')",20);
}

function fade2TargetTo(el,leftTarget) {
	autoScroll2ing = true;
	setOpacity('',100,el);
	fadeTargetEl = el;
	fadeOut('','scroll2FadeStep1('+leftTarget+')',el);
}
function scroll2FadeStep1(leftTarget) {
	setOpacity('',0,fadeEl);
	fadeTargetEl.style.left = leftTarget+'px';
	fadeIn('','scroll2FadeStep2()',fadeEl);
}
function scroll2FadeStep2() {
	autoScroll2ing = false;
}


loadMeUp += "initAutoScroll2();";
