// JavaScript Document


var curTest = 0;
var testimonialIDs = [ "cutleryHospital", "lordsPrayer", "cutleryproducts", "cutlerymate",	"mensGifts", "magnotherapy", "specialcomission" ];

function senseLocation() {
	for( var i = 0; i < testimonialIDs.length; i++ ) {
		var found = location.toString().lastIndexOf(testimonialIDs[i]);
		
		if( found != -1 ) {
			curTest = i;
			break;
		}
	}
}

function nextTestimonial() {
	senseLocation();
	curTest = ( curTest + 1 ) % testimonialIDs.length;
	location = "#" + testimonialIDs[curTest];
}

function previousTestimonial() {
	senseLocation();
	if( curTest == 0 ) {
		curTest = testimonialIDs.length - 1;
	}
	else {
		curTest--;
	}
	
	location = "#" + testimonialIDs[curTest];
}
