function f_scroll_init(direction,scollingarea_width) {
	// Set global scroll area width
	v_direction = direction;
	v_scollingarea_width = scollingarea_width;
	document.getElementById('scrollingarea').style.width = v_scollingarea_width + "px";
	document.getElementById('scrollingarea2').style.width = v_scollingarea_width + "px";
	// Set initial left position if not set
	if (document.getElementById('scrollingarea').style.left == "") {document.getElementById('scrollingarea').style.left = "0px";}
	// Create 2nd scrolling area for continuous scroll
	if (document.getElementById('scrollingarea2').innerHTML == "") {
		document.getElementById('scrollingarea2').innerHTML = document.getElementById('scrollingarea').innerHTML;
		document.getElementById('scrollingarea2').style.left = v_scollingarea_width + "px";
	}
	if (v_direction == "left") {v_scroll_speed = "1";} else {v_scroll_speed = "-1";};
	f_scroll_timer();
}
function f_scroll_timer() {
	func = "f_scroll_perform()";
	v_scroll_perform_timer = setTimeout(func,25);
}
function f_scroll_perform() {
	clearTimeout(v_scroll_perform_timer);
	v_scrollingarea_left = (parseInt(document.getElementById('scrollingarea').style.left)-v_scroll_speed);
	v_scrollingarea_left2 = (parseInt(document.getElementById('scrollingarea2').style.left)-v_scroll_speed);
	if (v_direction == "left" && v_scrollingarea_left < v_scollingarea_width-(v_scollingarea_width*2)) {
		v_scrollingarea_left = 0;
	}
	if (v_direction == "right" && v_scrollingarea_left > v_scollingarea_width) {
		v_scrollingarea_left = v_scollingarea_width-(v_scollingarea_width*2)+1;
	}
	if (v_direction == "left" && v_scrollingarea_left2 < 0 && v_scrollingarea_left < 0) {
		v_scrollingarea_left2 = v_scrollingarea_left+v_scollingarea_width;
	}
	if (v_direction == "right" && v_scrollingarea_left2 > v_scollingarea_width) {
		v_scrollingarea_left2 = v_scollingarea_width-(v_scollingarea_width*2)+1;
	}
	document.getElementById('scrollingarea').style.left = v_scrollingarea_left + "px";
	document.getElementById('scrollingarea2').style.left = v_scrollingarea_left2 + "px";
	f_scroll_timer();
}
function f_scroll_stop() {
	clearTimeout(v_scroll_perform_timer);
}





function f_scollingareawidth() {
	// Calculate scrolling area width by adding widths of all images
	scollingareawidth = 0;
	if (v_scollingimglist.indexOf(',') > 0) {
		v_scollingimglist_split = v_scollingimglist.split(',');
		for (var v_scollingimglist_loop = 0; v_scollingimglist_loop < v_scollingimglist_split.length; v_scollingimglist_loop++) {
			if (v_scollingimglist_split[v_scollingimglist_loop].length > 0) {
				scollingareawidth += document.getElementById(v_scollingimglist_split[v_scollingimglist_loop]).scrollWidth+2;
			}
		}
		f_scroll_init("left",scollingareawidth);
		v_scollingimglist_timer = setTimeout("f_scollingareawidth();",50);
	}
}
f_scollingareawidth();






