<!--

var aRateTeamBGY = new Array();
aRateTeamBGY[0] = 0;
aRateTeamBGY[1] = -20;
aRateTeamBGY[2] = -40;
aRateTeamBGY[3] = -60;
aRateTeamBGY[4] = -80;
aRateTeamBGY[5] = -100;

function changeBGPosition(iBGY)
{
	divStars = jQuery("#rateTeamStars");
	divStars.css('backgroundPosition', '0px ' + iBGY + 'px');
}

function setStarsBG(iTeamRate)
{
	if (iTeamRate < 0 ) {
		changeBGPosition(0);
	} else {
		iBGY = aRateTeamBGY[iTeamRate];
		changeBGPosition(iBGY);
	}
}

function getTeamRate(iTeamId)
{
	showHideLoading();
	divGetTeamRate = jQuery("#getDiv");
	jQuery.ajax({
		method: "get",url: "ajax/teams/getTeamRate.php",data: "teamId=" + iTeamId + "&random=" + Math.random(),
			beforeSend: function(){
			}, //show loading just when link is clicked
//			complete: function(){ jQuery("#loading").hide("fast");}, //stop showing loading when the process is complete
		success: function(html){ //so, if data is retrieved, store it in html
//				jQuery(".content").show("slow"); //animation
			showHideLoading(true);
			jQuery(divGetTeamRate).html(html); //show the html inside .content div
		}
	}); //close jQuery.ajax(
}

function setTeamRate(iTeamId, iTeamRate)
{
	showHideLoading();
	divSetTeamRate = jQuery("#getDiv");
	jQuery.ajax({
		method: "get",url: "ajax/teams/setTeamRate.php",data: "teamId=" + iTeamId + "&rate=" + iTeamRate + "&random=" + Math.random(),
			beforeSend: function(){
				;}, //show loading just when link is clicked
//			complete: function(){ jQuery("#loading").hide("fast");}, //stop showing loading when the process is complete
		success: function(html){ //so, if data is retrieved, store it in html
//				jQuery(".content").show("slow"); //animation
			jQuery(divSetTeamRate).html(html); //show the html inside .content div
			showHideLoading(true);
			getTeamRate(iTeamId);
		}
	}); //close jQuery.ajax(
}

function showHideLoading(bHide)
{
	divStars = jQuery("#rateTeamStars");
	divLoading = jQuery("#rateTeamLoading");
	if (bHide) {
		divLoading.hide();
		divStars.show();
	} else {
		divLoading.show();
		divStars.hide();
	}
}

function changeTeamRateText()
{
	divStarsButtons = jQuery("#rateTeamButtons");
	divStarsButtons.hide();
	divStarsButtons.html('');

	divStarsText = jQuery("#rateTeamText");
	divStarsText.html(sTeamRateText);
}

function logInToRateTeam(bShow)
{
	divStars = jQuery("#rateTeamStars");
	if (bShow) {
		 divStars.css('backgroundPosition', '0px ' + (-120) + 'px');
	} else {
		setStarsBG(iTeamRate);
	}
}

jQuery(document).ready(function()
{
	jQuery(".rateTeamButton").each(
		//// For each hottie, run this code. The "intIndex" is the
		// loop iteration index on the current element.
		function(intIndex) {
			// Bind the onclick event to simply alert the
			// iteration index value.
			intIndex++
			jQuery(this).bind (
				"click",
				function(){
//					alert(intIndex);
					setTeamRate(iTeamId, intIndex);
				}
			);

			jQuery( "#rateTeamButton_" + intIndex).hover(function() {
//			  jQuery(this).addClass('lastArticleCategoryHover');
				iBGY = aRateTeamBGY[intIndex];
				changeBGPosition(iBGY);

			}, function() {
//			  jQuery(this).removeClass('lastArticleCategoryHover');
				iBGY = aRateTeamBGY[iDefaultTeamRate];
				changeBGPosition(iBGY);
			});
		}
	);
});

-->
