var fishingRotatorAutoToggle = new Array();

function fishRotator(idName,amountTotal,amountCurrent,autoRotatorTimer) {
	// Check for content
	if (idName != null && amountTotal != null && amountCurrent != null) {
		// Check data type
		if (!isNaN (amountTotal) && !isNaN (amountCurrent)) {
			amountTotal = parseInt(amountTotal);
			amountCurrent = parseInt(amountCurrent);
			// Check for at least one total amount
			if (amountTotal > 0 && idName != '') {
				// Check the the current selected tab is in the valid range
				if (amountCurrent < 1 || amountCurrent > amountTotal) amountCurrent = 1;
				var obj = null;
				// Loop through the tabs and toggle their display status
				for (var i = 1; i <= amountTotal; i++) {
					obj = document.getElementById(idName + i);
					if (obj != null) {
						if (i != amountCurrent) {
							obj.style.display = 'none';
						} else {
							obj.style.display = 'block';
						}
					}
				}

				// Keep a record of the automatic rotator, a number in milliseconds calls this function again.
				fishingRotatorAutoToggle[idName] = autoRotatorTimer;
				
				if (autoRotatorTimer != null) {
					if (!isNaN(autoRotatorTimer)) {
						autoRotatorTimer = parseInt(autoRotatorTimer);
						setTimeout("fishRotator('" + idName + "'," + amountTotal + "," + (amountCurrent + 1) + "," + autoRotatorTimer + ");", autoRotatorTimer);
					}
				}

				// Clean up
				amountTotal = null;
				amountCurrent = null;
				i = null;
				obj = null;
				delete amountTotal;
				delete amountCurrent;
				delete i;
				delete obj;
			}
		}
	}
	// Clean up
	amountTotal = null;
	amountCurrent = null;
	delete amountTotal;
	delete amountCurrent;
}