function addScrollers() {
	// code each scroller as follows:
	// startScroll('id of scroller div','content of scroller');
	startScroll(
			'myscroller',
			//'<div class = "scrollingTitle"><div/><div class = "scrollingText"></div>');
			'<div class = "scrollingContent" STYLE=" overflow:hidden; height:660px"></div>');
			
}

var speed = 8; // scroll speed (bigger = faster)
var dR = false; // reverse direction

// Vertical Scroller Javascript
// copyright 24th September 2005, by Stephen Chapman
// permission to use this Javascript on your web page is granted
// provided that all of the code below (as well as these
// comments) is used without any alteration
var step = 2;
function objWidth(obj) {
	if (obj.offsetWidth)
		return obj.offsetWidth;
	if (obj.clip)
		return obj.clip.width;
	return 0;
}
function objHeight(obj) {
	if (obj.offsetHeight)
		return obj.offsetHeight;
	if (obj.clip)
		return obj.clip.height;
	return 0;
}
function scrF(i, sH, eH) {
	var x = parseInt(i.top) + (dR ? step : -step);
	if (dR && x > sH)
		x = -eH;
	else if (x < 2 - eH)
		x = sH;
	/*else if (x == 0) 
	{
		i.top = x + 'px';
		i.display = "none";
	}*/
	i.top = x + 'px';

}
function startScroll(sN, txt) {
	var scr = document.getElementById(sN);
	var sW = objWidth(scr) - 6;
	var sH = objHeight(scr);
	scr.innerHTML = '<div id="' + sN
			+ 'in" style="position:relative; left:3px; width:' + sW + ';">'
			+ txt + '<\/div>';
	var sTxt = document.getElementById(sN + 'in');
	// var sTxt = document.getElementById(sN);
	var eH = objHeight(sTxt);
	sTxt.style.top = (dR ? -eH : sH) + 'px';
	// sTxt.style.top = 0;
	sTxt.style.clip = 'rect(0,' + sW + 'px,' + eH + 'px,0)';
	setInterval(function() {
		scrF(sTxt.style, sH, eH);
	}, 1000 / speed);
}
//window.onload = addScrollers;
$(document).ready(function() {
	addScrollers();
	var scrollStr="";
	 //$.getJSON('CCIProj/DatabaseJQ.php', function(json){
		$.getJSON('CCIProj/DatabaseJQ.php', function(data){
			$.each(data, function(key, val){
			    //$.each(val,function(property, value){
				//$('div.scrollingContent').html(data.title).append(data.text);
				//$('div.scrollingContent').append(data.title).append(data.text);
				//$('div.scrollingContent').html(val.title).append(val.text);
			    	//$('#horse1_r').html(JSON.stringify(horse_array));
					if(val != null)
						scrollStr = scrollStr + val + '</br>';
				//scrollStr = scrollStr + ' ' + value + ' ' + property + '</br>';
				//$('div.scrollingContent').html(val);
				//$('div.scrollingContent').append('<li id="' + key + '">' + val.title + ' ' + val.text +'</li>');
			    //});
			});
			$('div.scrollingContent').html(scrollStr);
	 });
		//$('div.scrollingContent').html($scrollStr);
	});
