/**
 * Declare local variables
 * 
 */
var id = 1;
var dogs = 6;  // initiate the number of dogs to loop

/**
 * @function: PeriodicalExecuter
 * @library: Prototype
 * @sub-library: Scriptaculous
 * @description:  loops through featured dog pics/details
 * @author: Scott Watkins
 *  
 */
var pe = new PeriodicalExecuter(function(){
				showdog('featured-pic-'+id, false);
				if (id <= 5) {
					id++;
				} else {
					id = 1;
				}
			}, 2);

/**
 * @function: showdog
 * @library: Prototype
 * @sub-library: Scriptaculous
 * @dependencies: PeriodicalExecuter()
 * @param {Int} id
 * @param {Bool} stop
 * @author: Scott Watkins
 * 
 */
function showdog(id, stop){
	if (stop){
		pe.currentlyExecuting = true; // setting this to true stops the PeriodicalExecuter
	}
	var el = $(id);
	var origid = el.getAttribute('id');
	for (i=1; i<=dogs; i++){
		if (origid == 'featured-pic-'+i) {
			$('featured-pic-'+i).show();
			$('featured-'+i).addClassName('featured-hover');
		} else {
			$('featured-pic-'+i).hide();
			$('featured-'+i).removeClassName('featured-hover');
		}
	}
}

/**
 * @function: startshow
 * @library: Prototype
 * @sub-library: Scriptaculous
 * @dependencies: PeriodicalExecuter()
 * @dependencies: showdog()
 * @author: Scott Watkins
 * 
 */
function startshow(getid){
	id = getid;
	pe.currentlyExecuting = false; // setting this to false restarts the PeriodicalExecuter
}
