////////////////////JQUERY IS REQUIRED///////////////////////
if (typeof jQuery == 'undefined') { 
	alert("ERROR: Ajax Rotator needs jQuery to run!"); 
}//end if
/////////////////////////////////////////////////////////////
/**
 * setContent()
 * 
 * Updates the inner content area (aka, the rotating content) with either next or 
 * previous content in the series. Please use the supplied wrapper functions
 * nextContent() and prevContent() for enhanced code readability.
 */
function setContent(funct,Target,Name,Type,Optional_Data){
	//TODO: figure out how to add transitions later
	
	//use ajax to load the requested content.
	$.ajax({
		type: 	"POST",
		url:	"http://www.norcrossga.net/ajax_rotator/run.php",
		data:	"function_name="+funct+"&param[0]="+Name+"&param[1]="+Type+"&param[2]="+Optional_Data,
		success: function(retval){
	
			var contentarea = $("#"+Target);
			if(contentarea!=null && contentarea!="undefined"){
				contentarea.html(retval);
			}else{
				alert("ERROR: Ajax Rotator: the contentarea ("+Target+") could not be found");
			}//end else
	
		}//end function
	});

}//end function
/**
 * nextContent()
 * 
 * Updates the inner content area (aka, the rotating content) with the next 
 * content in the series. 
 */
function nextContent(Target,Name,Type){
	setContent("getNextContent",Target,Name,Type,0);
}//end function
/**
 * prevContent()
 * 
 * Updates the inner content area (aka, the rotating content) with the previous 
 * content in the series. 
 */
function prevContent(Target,Name,Type){
	setContent("getPrevContent",Target,Name,Type,0);
}//end function

/**
 * Norcross::changeCategory()
 * 
 * Updates the inner content area (aka, the rotating content) with the
 * a different category of information. Used specifically by norcross calendars.
 */
function changeCategory(Target,Name,Type,Category){
	setContent("getCategoryContent",Target,Name,Type,Category);
}//end function
