
_activeTabCategoryName = 'TopRated';
_categoryTabPage = 1;
_categoryTabMaxPage = 1;
_featuredRadioFillOpacity = 1.0;
_featuredContentAnimating = false;
_currentFeaturedContent = 1;
_nextFeaturedContent = 2;

_featuredBtnsNotPressed = true;

_regIndex = 1;
_signinData = null;

$(document).ready(function() {
	$('.tutorialThumbDiv').hover(
		function() {
			$(this).css('background-color', '#e5e5e5');
		},
		function() {
			$(this).css('background-color', '#fff');
		}
	);
	if (_pageType == 'game home') {
		callCategoryUpdatePost();
		advanceFeaturedTimer();
	} else if (_pageType == 'tutorials home') {
		jQuery("abbr.timeago").timeago();
	} else if (_pageType == 'game page') {
		jQuery("abbr.timeago").timeago();
		setGoldStars(_userRating);
		setTimeout('countGamePlay()', 10000);
	}
	$('#registerDOB').birthdaypicker();
	$('#signinBtn').click(function(e) {
		e.preventDefault();
		if (_pageType == 'tutorials home') {
			var signinurl = '../../../cgi-bin/signin.php';
		} else {
			var signinurl = '../../cgi-bin/signin.php';
		}
		$('#signinErrorMsg').css('display', 'none');
		$.post(signinurl,
			  {username:$('#signinUsername').val(), password:$('#signinPassword').val(), gid:_gid},
			  function(data) {
				  if (data == 0) {
					  $('#signinErrorMsg').css('display', 'block');
				  } else {
					  _signinData = data;
					  if (data.hasOwnProperty('userRating')) {
						  _userRating = data.userRating;
					  }
					  closeRegistration();
					  updateSignInElements(true);
				  }
			  }, 'json'
		);
	});
	addPlusMinusBtnHandlers('');
	$('.birth-day').focus(function() {
		$('#ageTooLow').css('display', 'none');
	});
	$('.birth-month').focus(function() {
		$('#ageTooLow').css('display', 'none');
	});
	$('.birth-year').focus(function() {
		$('#ageTooLow').css('display', 'none');
	});
	$('#registerBtn').click(function(e) {
		e.preventDefault();
		if (_pageType == 'tutorials page') {
			var registerurl = '../../../cgi-bin/verify.php';
		} else {
			var registerurl = '../../cgi-bin/verify.php';
		}
		$('#registerErrorMsg').css('display', 'none');
		$('#invalidCaptcha').css('display', 'none');
		$.post(registerurl,
			   {
					username:$('#registerUsername').val(),
			 		password:$('#registerPassword').val(),
					email:$('#registerEmail').val(),
					day:$('.birth-day').val(),
					month:$('.birth-month').val(),
					year:$('.birth-year').val(),
					recaptcha_challenge_field:$('#recaptcha_challenge_field').val(),
					recaptcha_response_field:$('#recaptcha_response_field').val()
			   },
			   function(data) {
				   if (data == 1) {  // everything's peachy
						if (_pageType == 'tutorials home') {
							var signinurl = '../../../cgi-bin/signin.php';
						} else {
							var signinurl = '../../cgi-bin/signin.php';
						}
						$('#signinErrorMsg').css('display', 'none');
						$.post(signinurl,
							  {username:$('#registerUsername').val(), password:$('#registerPassword').val(), gid:_gid},
							  function(data) {
								  if (data == 0) {
									  $('#signinErrorMsg').css('display', 'block');
								  } else {
									  _signinData = data;
									  if (data.hasOwnProperty('userRating')) {
										  _userRating = data.userRating;
									  }
									  closeRegistration();
									  $('#activationEmailMessage').show();
									  updateSignInElements(true);
								  }
							  }, 'json'
						);
				   } else if (data == 2) {  // email already registered
				   		$('#registeredEmail').css('display', 'block');
						$('#registerErrorMsg').css('display', 'block');
						Recaptcha.reload();
				   } else if (data == 3) {
						$('#registerErrorMsg').css('display', 'block');
						Recaptcha.reload();
				   } else if (data == 4) {  // invalid age
				   		$('#registerErrorMsg').css('display', 'block');
						$('#ageTooLow').css('display', 'block');
				   } else if (data == 0) {  // incorrect captcha response
						$('#invalidCaptcha').css('display', 'block');
						Recaptcha.reload();
				   }
			   }
		);
	});
	$('#registerUsername').blur(function() {
		if ($('#registerUsername').val().length == 0) {
			$('#usernameTooShort').css('display', 'none');
			$('#noUsername').css('display', 'block');
		}
	});
	$('#registerUsername').keypress(function(e) {
		var allowed = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_';
		var code = (e.keyCode ? e.keyCode : e.which);
		var ch = String.fromCharCode(code);
		var len;
		if (allowed.indexOf(ch) == -1) {
			e.preventDefault();
		}
	});
	$('#registerUsername').keyup(function() {
		len = $('#registerUsername').val().length;
		$('#availableUsername').css('display', 'none');
		$('#unavailableUsername').css('display', 'none');
		if (len != 0 && len < 3) {
			$('#usernameTooShort').css('display', 'block');
			$('#noUsername').css('display', 'none');
		} else {
			$('#usernameTooShort').css('display', 'none');
			$('#noUsername').css('display', 'none');
			if (len >= 3) {
				_regIndex++;
				$('#checkingUsername').css('display', 'block');
				$.post('../../cgi-bin/availability.php',
					   {username:$('#registerUsername').val(), index:_regIndex},
					   function(data) {
							$('#checkingUsername').css('display', 'none');
							if (data == 0) {
								$('#unavailableUsername').css('display', 'block');
							} else if (data == _regIndex) {
								$('#availableUsername').css('display', 'block');
								$('#unavailableUsername').css('display', 'none');
							}
					   }
				);
			}
		}
	});
	$('#registerPassword').blur(function() {
		if ($('#registerPassword').val().length == 0) {
			$('#noPassword').css('display', 'block');
			$('#passwordTooShort').css('display', 'none');
		}
	});
	$('#registerPassword').keyup(function() {
		var len = $('#registerPassword').val().length;
		if (len != 0 && len < 5) {
			$('#passwordTooShort').css('display', 'block');
			$('#noPassword').css('display', 'none');
		} else {
			$('#passwordTooShort').css('display', 'none');
			$('#noPassword').css('display', 'none');
		}
	});
	$('#registerEmail').blur(function() {
		var re = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/;
		if (re.test($('#registerEmail').val())) {
			$('#invalidEmail').css('display', 'none');
		} else {
			$('#invalidEmail').css('display', 'block');
		}
	});
	$('#registerEmail').focus(function() {
		$('#registeredEmail').css('display', 'none');
	});
	$('#featuredLeftBtn').click(function() {
		var next = (_currentFeaturedContent == 1) ? 3 : (_currentFeaturedContent - 1);
		animateToFeaturedContent(next, 0);
		_featuredRadioFillOpacity = 1.0;
		$('#featuredRadioButtonFill').css({'opacity':'1.0', 'left':((4 + ((next - 1) * 30)) + 'px')});
		_featuredBtnsNotPressed = false;
	});
	$('#featuredRightBtn').click(function() {
		var next = (_currentFeaturedContent == 3) ? 1 : (_currentFeaturedContent + 1);
		animateToFeaturedContent(next, 1);
		_featuredRadioFillOpacity = 1.0;
		$('#featuredRadioButtonFill').css({'opacity':'1.0', 'left':((4 + ((next - 1) * 30)) + 'px')});
		_featuredBtnsNotPressed = false;
	});
	attachGameTileEvents();
	$('.userStar').hover(
		function() {
			var starNum = $(this).attr('id').substr(4);
			setGoldStars(starNum);
		},
		function() {
			setGoldStars(_userRating);
		}
	);
	$('.userStar').click(function() {
		if (_loggedIn) {
		   var alreadyVoted = true;
		   var newRating = $(this).attr('id').substr(4);
		   if (_userRating == '0') {
			   alreadyVoted = false;
			   _numRatingVotes++;
			   $('#avgRatingText').html('(' + _numRatingVotes + ' votes)');
		   }
		   var currentDate = new Date();
		   $('#userRatingDate').html('(on ' + currentDate.getFullYear() + '-' + (currentDate.getMonth() + 1) + '-' + (currentDate.getDate()) + ')');
		   var newAvgRating;
		   // works, but very slight margin of error b/c of rounding of floats (e.g. 3.333 * 3 < 10 != 10)
		   if (alreadyVoted) {
			   newAvgRating = ((parseInt(_numRatingVotes) * parseFloat(_avgRating)) - parseInt(_userRating) + parseInt(newRating)) / parseInt(_numRatingVotes);
		   } else {
			   newAvgRating = ((parseFloat(_avgRating) * (parseInt(_numRatingVotes) - 1)) + parseInt(newRating)) / parseInt(_numRatingVotes);
		   }
		   setAvgStars(newAvgRating);
		   _userRating = newRating;
			$.post('../../cgi-bin/rateGame.php',
				   {gid:_gid, rating:$(this).attr('id').substr(4)},
				   function(data) {
				   }
			);
		} else {
			showRegistration(true);
		}
	});
	$('.categoryTabHit').click(function() {
		var categoryName = $(this).parent().attr('id').substr(11);
		if (categoryName == 'DressUp') {
			categoryName = 'Dress-Up';
		} else if (categoryName == 'BoardGame') {
			categoryName = 'Board Game';
		}
		_activeTabCategoryName = categoryName
		var selectedTabDiv = $(this).parent();
		var rowDiv = $(this).parent().parent();
		var row1 = $('#categoryTabsRow1');
		var row2 = $('#categoryTabsRow2');
		if (rowDiv.attr('id') == 'categoryTabsRow1') {
			row1.css({'top':'27px', 'left':'15px', 'zIndex':5});
			row1.attr('id', 'categoryTabsRow2');
			row2.css({'top':'7px', 'left':'35px', 'zIndex':4});
			row2.attr('id', 'categoryTabsRow1');
		}
		var selectedTab = $('#selectedCategoryTab');
		selectedTab.prependTo(selectedTabDiv);
		_categoryTabPage = 1;
		callCategoryUpdatePost();
	});
	$('.leftEndPage').click(function() {
		_categoryTabPage = 1;
		callCategoryUpdatePost();
	});
	$('.rightEndPage').click(function() {
		_categoryTabPage = _categoryTabMaxPage;
		callCategoryUpdatePost();
	});
	$('.leftOnePage').click(function() {
		if (_categoryTabPage > 1) {
			_categoryTabPage--;
		}
		callCategoryUpdatePost();
	});
	$('.rightOnePage').click(function() {
		if (_categoryTabPage < _categoryTabMaxPage) {
			_categoryTabPage++;
		}
		callCategoryUpdatePost();
	});
	$('#tutorializeButton').click(function() {
		if (_loggedIn) {
			$('#tutorializeLabel').html(' Thanks for voting!');
			$.post('../../cgi-bin/reqTut.php',
				   {gid:_gid},
				   function(data) {
//					   alert('reqTut return: ' + data);
				   }
			);
		} else {
			showRegistration(true);
		}
	});
});
function countGamePlay() {
	$.post('../../cgi-bin/countGamePlay.php',
		   {gid:_gid},
		   function(data) {
		   }
	);
}
function callCategoryUpdatePost() {
	var thumbsOffset = (_categoryTabPage - 1) * 24;
	$.post('../../cgi-bin/categoryThumbs.php',
		   {category:_activeTabCategoryName, offset:thumbsOffset},
		   function(data) {
			   updateCategoryGameThumbs(data.thumbData);
			   attachGameTileEvents();
				_categoryTabMaxPage = data.numPages;
			   updateCategoryPageControls();
			   updateCategoryTitleLabel();
		   }, 'json'
	);
}
function updateCategoryTitleLabel() {
	var titleText = _activeTabCategoryName;
	if (titleText == 'Puzzles') {
		titleText = 'Puzzle';
	} else if (titleText == 'Board Game') {
		titleText = 'Board';
	} else if (titleText == 'TopRated') {
		titleText = 'Top Rated';
	}
	titleText = titleText + ' Games';
	$('.categoryTitle').html(': : : : : : : : :&nbsp;&nbsp;&nbsp;&nbsp;' + titleText + '&nbsp;&nbsp;&nbsp;&nbsp;: : : : : : : : :');
}
function updateCategoryPageControls() {
	if (_categoryTabPage == 1) {
		$('.leftOnePage').hide();
		$('.leftEndPage').hide();
	} else {
		$('.leftOnePage').show();
		$('.leftEndPage').show();
	}
	if (_categoryTabPage == _categoryTabMaxPage) {
		$('.rightOnePage').hide();
		$('.rightEndPage').hide();
	} else {
		$('.rightOnePage').show();
		$('.rightEndPage').show();
	}
	$('.categoryPageLabel').html(_categoryTabPage + ' of ' + _categoryTabMaxPage);
}
function attachGameTileEvents() {
	$('.gameTile').hover(
		function() {
			$(this).css('background-color', '#e5e5e5');
		},
		function() {
			$(this).css('background-color', '#fff');
		}
	);
	/*$('.gameTile').click(function() {
		document.location.href = 'http://www.bigtac.com/t_game_page.php?gid=' + $(this).attr('id').substr(8);
	});*/
}
function updateCategoryGameThumbs(data) {
	var tabBody = $('#categoryTabBody');
	tabBody.empty();
	for (var i = 0; i < 24 && i < data.length; i++)
	{
		var gid = data[i]['gid'];
		var thumb = data[i]['thumbnail_url'];
		var name = data[i]['name'];
		var desc = data[i]['description'];
		var dx = 25 + (300 * (i % 3));
		var dy = 89 + (90 * Math.floor(i / 3));
		tabBody.append('<a href="http://www.bigtac.com/t_game_page.php?gid=' + gid + '" style="text-decoration:none; border:none"><div class="gameTile" id="gameTile' + gid + '" style="position:absolute; width:290px; height:90px; top:' + dy + 'px; left:' + dx + 'px; cursor:pointer"><img alt="game thumb ' + name + '" src="' + thumb + '" style="position:absolute; top:10px; left:10px; width:70px; height:70px" /><div style="position:absolute; top:10px; left:88px; width:192px; height:35px; font:13px verdana; font-weight:bold; color:#800; overflow:hidden">' + name + '</div><div style="position:absolute; top:40px; left:87px; width:193px; height:38px; font:10px verdana; color:#000; overflow:hidden">' + desc + '</div></div></a>');
	}
}
function setGoldStars(starNum) {
	for (var i = 1; i < 6; i++) {
		if (i <= starNum) {
			$('#star' + i).attr('src', 'http://bigtac.com/images/gold_star.png');
		} else {
			$('#star' + i).attr('src', 'http://bigtac.com/images/grey_star.png');
		}
	}
}
function setAvgStars(starNum) {
	for (var i = 1; i < 6; i++) {
		if (i <= starNum) {
			$('#avgStar' + i).attr('src', 'http://bigtac.com/images/gold_star.png');
		} else {
			$('#avgStar' + i).attr('src', 'http://bigtac.com/images/grey_star.png');
		}
		$('#avgStar' + i).attr('alt', _avgRating);
	}
}
function addPlusMinusBtnHandlers(paramCid) {
	var plusSelector = '.plusBtn';
	var minusSelector = '.minusBtn';
	if (paramCid != '') {
		plusSelector = '#bplus' + paramCid + ',#rplus' + paramCid;
		minusSelector = '#bminus' + paramCid + ',#rminus' + paramCid;
	}
	$(plusSelector).hover(
		function (e) {
			var bOrR = $(this).attr('id').substr(0, 1);
			var cid = $(this).attr('id').substr(5);
			$('.commentHolder#' + bOrR + cid).css('background-color', '#e5e5e5');
		},
		function (e) {
			var bOrR = $(this).attr('id').substr(0, 1);
			var cid = $(this).attr('id').substr(5);
			$('.commentHolder#' + bOrR + cid).css('background-color', '#fff');
		}
	);
	$(plusSelector).click(function (e) {
		if (_loggedIn) {
			var cid = $(this).attr('id').substr(5);
			$.post('../../cgi-bin/comment_plus.php',
				  {cid:cid},
				  function(data) {
					  if (data != 0) {
						  var spanArray = $('.plusNums#bplus' + data);
						  spanArray.each(function(index) {
							  innerText = $(this).text();
							  voteCount = innerText.substr(1, innerText.length - 2);
							  $(this).text('(' + (parseInt(voteCount) + 1) + ')');
						  });
					  }
				  }
			);
		} else {
			showRegistration(true);
		}
	});
	$(minusSelector).hover(
		function (e) {
			var bOrR = $(this).attr('id').substr(0, 1);
			var cid = $(this).attr('id').substr(6);
			$('.commentHolder#' + bOrR + cid).css('background-color', '#e5e5e5');
		},
		function (e) {
			var bOrR = $(this).attr('id').substr(0, 1);
			var cid = $(this).attr('id').substr(6);
			$('.commentHolder#' + bOrR + cid).css('background-color', '#fff');
		}
	);
	$(minusSelector).click(function (e) {
		if (_loggedIn) {
			var cid = $(this).attr('id').substr(6);
			$.post('../../cgi-bin/comment_minus.php',
				  {cid:cid},
				  function(data) {
					  if (data != 0) {
						  var spanArray = $('.minusNums#bminus' + data);
						  spanArray.each(function(index) {
							  innerText = $(this).text();
							  voteCount = innerText.substr(1, innerText.length - 2);
							  $(this).text('(' + (parseInt(voteCount) + 1) + ')');
						  });
					  }
				  }
			);
		} else {
			showRegistration(true);
		}
	});
}
function addFeedbackForm() {
	if (_loggedIn) {
		$('#addFeedbackBtn').hide();
		$('#feedbackForm').show();
		$('#commentBox').slideDown('fast');
	} else {
		showRegistration(true);
	}
}
function submitFeedback() {
	$('.defaultComment').hide();
	$.post('../../cgi-bin/comment.php',
		   {gid:_gid, comment:$('#commentBox').val()},
		   function(data) {
				if (data != 0) {
					$('#addFeedbackBtn').show();
					$('#feedbackForm').hide();
					$('#commentBox').hide();
					var divContent = '				<div class="commentHolder" id="r' + data + '" style="padding:5px 0; display:none">';
					var divContent = divContent + '		<div style="position:relative; left:5px; font:10px verdana">';
					var divContent = divContent + '			<span style="color:#03f">' + _username + '</span>';
					var divContent = divContent + '			<span style="color:#5f5f5f">(<abbr class="timeago" title="' + toIsoDatetime(new Date()) + 'Z"></abbr>) :</span>';
					var divContent = divContent + '			<div style="position:absolute; top:0; left:395px">';
					var divContent = divContent + '				<img class="plusBtn" id="rplus' + data + '" src="http://bigtac.com/images/comment_plus.png" style="position:absolute; cursor:pointer" />';
					var divContent = divContent + '				<span class="plusNums" id="bplus' + data + '" style="color:#5f5f5f; position:absolute; left:18px">(0)</span>';
					var divContent = divContent + '				<img class="minusBtn" id="rminus' + data + '" src="http://bigtac.com/images/comment_minus.png" style="position:absolute; left:70px; cursor:pointer" />';
					var divContent = divContent + '				<span class="minusNums" id="bminus' + data + '" style="color:#5f5f5f; position:absolute; left:88px">(0)</span>';
					var divContent = divContent + '			</div>';
					var divContent = divContent + '		</div>';
					var divContent = divContent + '		<div style="position:relative; width:510px; margin-top:5px; font:10px verdana; left:30px">' + ($('#commentBox').val()) + '</div>';
					var divContent = divContent + '	</div>';
					$('#recentCommentsLabel').after(divContent);
					$('#commentBox').val('');
					jQuery("abbr.timeago").timeago();
					addPlusMinusBtnHandlers(data);
					$('#r' + data).slideDown('fast');
				}
		   }
	);
}
function showRegistration(loginNotRegister) {
	elem = document.getElementById('registrationOverlay');
	elem.style.display = 'block';
	if (loginNotRegister) {
		$('#signinUsername').focus();
	} else {
		$('#registerUsername').focus();
	}
}
function toIsoDatetime(currentDate) {
	var year = currentDate.getUTCFullYear();
	if (year < 2000) year = year + 1900;
	var month = currentDate.getUTCMonth() + 1;
	var day = currentDate.getUTCDate();
	var hour = currentDate.getUTCHours();
	var minute = currentDate.getUTCMinutes();
	var second = currentDate.getUTCSeconds();
	if (month <= 9) month = '0' + month;
	if (day <= 9) day = '0' + day;
	if (hour <= 9) hour = '0' + hour;
	if (minute <= 9) minute = '0' + minute;
	if (second <= 9) second = '0' + second;
	isoDatetime = year + '-' + month + '-' + day + 'T' + hour + ':' + minute + ':' + second;
	
	return isoDatetime;
}
function closeRegistration() {
	elem = document.getElementById('registrationOverlay');
	elem.style.display = 'none';
	Recaptcha.reload();
}
function closeEmailMessage() {
	$('#activationEmailMessage').hide();
}
function signout() {
	$.post('../../cgi-bin/signout.php', function(data) {
		location.reload();
	});
}
function updateSignInElements(signin) {
	if (signin) {
		$('#headerLogin').css('display', 'none');
		$('#headerLogout').css('display', 'inline');
		_loggedIn = true;
		_username = _signinData.username;
		_ratingTime = _signinData.ratingTime;
		var tutVoteDatetime = _signinData.tutVoteDatetime;
		$('#userWelcome').html(_username);
		if (_pageType == 'game page') {
			if (tutVoteDatetime != '0') {
				var oldhtml = $('#tutorializeLabel').html();
				var tutVoteDate = new Date(1000 * tutVoteDatetime);
				oldhtml = oldhtml.substr(0, oldhtml.length - 4);
				oldhtml += tutVoteDate.getFullYear() + '-' + (tutVoteDate.getMonth() + 1) + '-' + tutVoteDate.getDate() + ')';
				$('#tutorializeLabel').html(oldhtml);
			}
			setGoldStars(_userRating);
			if (_userRating != 0) {
				var ratingDate = new Date(1000 * _ratingTime);
				$('#userRatingDate').html('(on ' + ratingDate.getFullYear() + '-' + (ratingDate.getMonth() + 1) + '-' + ratingDate.getDate() + ')');
			} else {
				$('#userRatingDate').html('(not rated)');
			}
		}
	}/* else {
		$('#headerLogin').css('display', 'inline');
		$('#headerLogout').css('display', 'none');
		_username = "Guest";
		_loggedIn = false;
		_signinData = null;
		if (_pageType == 'game page') {
			setGoldStars(0);
			$('#userRatingDate').html('(not rated)');
		}
	}*/
}
function advanceFeaturedTimer() {
	_featuredRadioFillOpacity -= 0.007;
	if (_featuredRadioFillOpacity < 0.2) {
		_featuredRadioFillOpacity = 0.2;
	}
	fill = document.getElementById('featuredRadioButtonFill');
	fill.style.opacity = _featuredRadioFillOpacity;
	if (_featuredRadioFillOpacity == 0.2) {
		_featuredRadioFillOpacity = 1.0;
		fill.style.opacity = 1.0;
		if (fill.style.left == '4px') {
			animateToFeaturedContent(2, 1);
			fill.style.left = '34px';
		} else if (fill.style.left == '34px') {
			animateToFeaturedContent(3, 1);
			fill.style.left = '64px';
		} else {
			animateToFeaturedContent(1, 0);
			fill.style.left = '4px';
		}
	}
	if (_featuredBtnsNotPressed) {
		setTimeout('advanceFeaturedTimer()', 50);
	}
}
function animateToFeaturedContent(next, rightNotLeft) {
	if (_featuredContentAnimating) {
		return;
	}
	nextContent = document.getElementById('featuredGameIconsContainer' + next);
	nextContent.style.display = 'block';
	if (rightNotLeft) {
		nextContent.style.left = '630px';
	} else {
		nextContent.style.left = '-630px';
	}
	_nextFeaturedContent = next;
	_featuredContentAnimating = true;
	animateFeaturedContent(rightNotLeft);
}
function animateFeaturedContent(rightNotLeft) {
	currentContent = document.getElementById('featuredGameIconsContainer' + _currentFeaturedContent);
	left = parseInt(currentContent.style.left.substr(0, currentContent.style.left.length - 2));
	if (rightNotLeft) {
		left -= 16;
		if (left < -630) {
			left = -630;
		}
	} else {
		left += 16;
		if (left > 630) {
			left = 630;
		}
	}
	currentContent.style.left = left + 'px';
	nextContent = document.getElementById('featuredGameIconsContainer' + _nextFeaturedContent);
	left = parseInt(nextContent.style.left.substr(0, nextContent.style.left.length - 2));
	if (rightNotLeft) {
		left -= 16;
		if (left < 0) {
			left = 0;
		}
	} else {
		left += 16;
		if (left > 0) {
			left = 0;
		}
	}
	nextContent.style.left = left + 'px';
	if (left == 0) {
		currentContent.style.display = 'none';
		_featuredContentAnimating = false;
		_currentFeaturedContent = _nextFeaturedContent;
	} else {
		setTimeout('animateFeaturedContent(' + rightNotLeft + ')', 16);
	}
}
function leftFeaturedButtonMouseOver() {
	elem = document.getElementById('leftFeaturedButtonU');
	elem.src = 'http://bigtac.com/images/left_featured_button_over_u.png';
	elem = document.getElementById('leftFeaturedButtonB');
	elem.src = 'http://bigtac.com/images/left_featured_button_over_b.png';
	elem = document.getElementById('leftFeaturedButtonC');
	elem.style.backgroundColor = '#000';
}
function leftFeaturedButtonMouseOut() {
	elem = document.getElementById('leftFeaturedButtonU');
	elem.src = 'http://bigtac.com/images/left_featured_button_u.png';
	elem = document.getElementById('leftFeaturedButtonB');
	elem.src = 'http://bigtac.com/images/left_featured_button_b.png';
	elem = document.getElementById('leftFeaturedButtonC');
	elem.style.backgroundColor = '#333';
}
function rightFeaturedButtonMouseOver() {
	elem = document.getElementById('rightFeaturedButtonU');
	elem.src = 'http://bigtac.com/images/right_featured_button_over_u.png';
	elem = document.getElementById('rightFeaturedButtonB');
	elem.src = 'http://bigtac.com/images/right_featured_button_over_b.png';
	elem = document.getElementById('rightFeaturedButtonC');
	elem.style.backgroundColor = '#000';
}
function rightFeaturedButtonMouseOut() {
	elem = document.getElementById('rightFeaturedButtonU');
	elem.src = 'http://bigtac.com/images/right_featured_button_u.png';
	elem = document.getElementById('rightFeaturedButtonB');
	elem.src = 'http://bigtac.com/images/right_featured_button_b.png';
	elem = document.getElementById('rightFeaturedButtonC');
	elem.style.backgroundColor = '#333';
}
function pageChangeButtonMouseOver() {
	
}
