$(function() {
	// activate first tab
	var firstTabLoaded = false;
	$.each($('#hometab'), function(){
       if(!firstTabLoaded){ makeTabActive(s.id); firstTabLoaded=true; }
    });
	if(runSlideshow){ setTimeout('playSlideshow()',slideTimeout); }
});
makeTabActive = function(tabID){
	// if not already active
	if(!$(tabID).hasClassName('hometabActive')){
		makeAllTabsInactive();
		if($(tabID)){
			$(tabID).addClassName('hometabActive');
			$(tabID).removeClassName('hometab');
			var tabContentID = tabID+"Content";
			if($(tabContentID)){ $(tabContentID).appear(); }
		}
		return true;
	} else { return false; }
}
makeAllTabsInactive = function(){
	$.each($('#hometabActive'), function(){
		s.addClassName('hometab');
		s.removeClassName('hometabActive');
		var tabContentID = s.id+"Content";
		if($(tabContentID)){ $(tabContentID).hide(); }
	});
}
makeNextTabActive = function(){
	var activateNextTab = 0;
	// get active tab ID
	var activeTabID = 0;
	var firstActiveTabFound = false;
	$.each($('#hometabActive'), function(){
		if(!firstActiveTabFound){ activeTabID = s.id; firstActiveTabFound=true; }
	});
	if(activeTabID){
		makeAllTabsInactive();
		var hometabARRAY = new Array();
		$.each($('#hometab'), function(){ hometabARRAY.push(s); });
		// check to see if active tab was last tab, and if so, make activeTabID the first
		var lastTabID = -1;
		if(hometabARRAY.length>0){ lastTabID = hometabARRAY[hometabARRAY.length-1].id; }
		if(activeTabID==lastTabID){
			// activate first tab
			makeTabActive(hometabARRAY[0].id);
		} else {
			// activate next tab
			$.each($('#hometab'), function(){
				if(activateNextTab){ makeTabActive(s.id); activateNextTab = 0; }
				if(s.id==activeTabID){ activateNextTab = 1; }
			});
		}
	}
	
}
playSlideshow = function(){
	if(runSlideshow){
		makeNextTabActive();
		setTimeout('playSlideshow()',slideTimeout);
	}
}
