﻿	// function to allow opening of lightbox from Flash
	function GroupDelegate(id) 
	{
	   var objLink = document.getElementById(id);
		var lbx = new lightbox(objLink);
	}																								   

	// rotates text in the special events widget
	// NOTE: this function uses an array (specialEventsArray) defined in the .php page
	function contentRotate(increment)
	{
		// find the length of the array containing special events entries
		specialEventsLength = specialEventsArray.length;	
		// grab the current index from the hidden form field
		hiddenCounterField = document.getElementById("widgetLeftTextCurrentIndex");
		var currentIndex = parseInt(hiddenCounterField.value);

		var newIndex = currentIndex + increment;
		
		// need to perform some logic on the newIndex to prevent out of bounds errors
		if(newIndex < 0)
		{
			newIndex = specialEventsLength - 1;
		}
		else if(newIndex > (specialEventsLength -1))
		{
			newIndex = 0;
		}
		
		// loop through all the array items; display the one matching the new index and hide the rest
		for(i = 0; i < specialEventsLength; i++)
		{
			var thisDiv = document.getElementById(specialEventsArray[i]);
			if(thisDiv)
			{
				if(i == newIndex)
				{
					thisDiv.style.display = "block";
				}
				else
				{
					thisDiv.style.display = "none";
				}
			}
		}

		// finally update the hidden form field with the current index
		hiddenCounterField.value =  newIndex;
	}
	
	// rotates text in the special events widget
	// NOTE: this function uses an array (specialEventsArray) defined in the .php page
	function peopleShowHide(el)
	{
		var e_id = 'biztownPeopleDiv'+el;
		var mainDiv = $('bizTownOverview');
		mainDiv.style.display = "none";
	
		// loop through all the array items; display the one matching the new index and hide the rest
		for(i = 0; i < peopleArray.length; i++)
		{
			var thisDiv = document.getElementById(peopleArray[i]);
			
			if(thisDiv)
			{
				if(peopleArray[i] == e_id)
				{
					thisDiv.style.display = "block";
				}
				else
				{
					thisDiv.style.display = "none";
				}
			}
		}
	}
	
	function hidePeople()
	{
			for(i = 0; i < peopleArray.length; i++)
			{
				var thisDiv = document.getElementById(peopleArray[i]);

				if(thisDiv)
				{
						thisDiv.style.display = "none";
				}
			}	
	}
