$(document).ready(function() {

	$('#json-holder').addClass('json-active');

	var $url = website_url + "admin_plugins/quotes/quote_json.asp";
	var $theHolder = $('#json-quotes');
	var $theHeight = $('#json-quotes').height();
	var $thePage = 0;
	var $theEnd;
	var $theDelay = 20000;

	$theHolder.html('<p class="json-loading">Loading quotes...</p>');


	$.getJSON($url, function(data) {

		var $theNumber = data.html.length;

		$theEnd = $theNumber - 1;
		$theHolder.height($theHeight * $theNumber);
		$theHolder.html(data.html.join(""));

		setTimeout(function(){moveTo($thePage);}, $theDelay);

	});



	function moveTo($lastPage) {
		$thePage = $lastPage + 1;

		if($thePage == $theEnd) {
			$thePage = 0;
			var $newPos = 0;
		} else {
			var $newPos = 0 - ((($thePage) * 425) + $thePage);
		}

		$('#json-quotes').animate({ top : $newPos }, 1000);
		setTimeout(function(){moveTo($thePage);}, $theDelay);
	};

	/**/



});