/* 
	@Description: AJAX event handler using Prototype and Script.aculo.us
	@Author: Aaron Roberson
	@Modified: March 7, 2007
*/
	
// set counter variable
var currentRecord = 1;

// Run init method when window loads
Event.observe(window, 'load', init, false);
// init method
function init() {
	getCount();
	getTestimony();
	Effect.Appear('testimony');
};

// create a function to show the link after it has been clicked and removed
function showMoreLink(obj){
	//obj = document.getElementById(obj);
	window.setTimeout('Effect.Appear(\'view-more\')',500);
}

// get a value and assign it to the currentRecord variable for view the next or first record
function getCount(){
	new Ajax.Request('tags/nextTestimony.cfm?action=getCount&count='+currentRecord,
	{
		method:'get',
		onComplete: function(response) {
			currentRecord = (response.responseText);
		}
	});
}

// reusable function for getting the next testimony
function getTestimony(){
	new Ajax.Updater('testimony','tags/nextTestimony.cfm?action=showNext&count='+currentRecord,{method:'get'});
}

// get the incremented recordCount, get the next testimony and the show it on the page
function showNextTestimony(obj){
	getCount();
	getTestimony();
	Effect.BlindDown('testimony');
}
