/* any error or bug can be reported to shahmeet.singh@morningstar.com */
var divId = 'sct';
var slideW = 450;  /* Slide Width */
var maxL = 450;   /* Presentation Width*/
var jump = 0;      /* Start From */
var s = 20;	   /* Slow Motion Time */
var intV = 10;	   /* Speed */

var act = true;
var n, obj, forW, reW, fwId, rwId, newSlideW, pos, position, myIntV;
myIntV = intV;
function pack() { obj = document.getElementById(divId); obj.scrollLeft = jump; }
window.onload = pack;
function pointTo(position) {
	pos = position;
	if (jump > pos) {
		rewind();
	} else {	
		forward();
	}
}
function forward() {
	intV = myIntV;
	if(fwId) {
		clearInterval(fwId);
	} else {
		n = s;
	}
	if (rwId) {
		clearInterval(rwId);
	} else {
		n = s;
	}
	if(position) {
		newSlideW = pos;
		position = 0;
	} else {
		newSlideW = jump + slideW;
	}
	if (newSlideW > maxL) {
		newSlideW = maxL;
	}
	newSlideW = parseInt(newSlideW);
	fwId = setInterval( "fw()", 0 );
}
function rewind() {
	intV = myIntV;
	if(fwId) {
		clearInterval(fwId);
	} else {
		n = s;
	}
	if (rwId) {
		clearInterval(rwId);
	} else {
		n = s;
	}
	n = s;
	if(position) {
		newSlideW = pos;
		position = 0;
	} else {
		newSlideW = jump - slideW;
	}
	if (newSlideW < 0) {
		newSlideW = 0;
	}
	newSlideW = parseInt(newSlideW);
	rwId = setInterval( "rw()", 0 );
}	
function fw() {
	if(jump < newSlideW) {
		clearInterval(fwId);
		obj.scrollLeft = jump;
		jump = jump+intV;
		fwId = setInterval( "fw()", n );
	} else {
		n = s;
		clearInterval(fwId);
		jump = newSlideW;
		obj.scrollLeft = jump;
	}
	if(act) {
		intV++;
	}
}
function rw() {
	if(jump > newSlideW) {
		clearInterval(rwId);
		obj.scrollLeft = jump;
		jump = jump-intV;
		rwId = setInterval( "rw()", n );
	} else {
		n = s;
		clearInterval(rwId);
		jump = newSlideW;
		obj.scrollLeft = jump;
	}
	if(act) {
		intV++;
	}
}