function GetRating() {
var httpRequest = new XMLHttpRequest();

	if (httpRequest) {
		httpRequest.onreadystatechange = function() {
			if (httpRequest.readyState == 4) {
				if (httpRequest.status == 200) {
					var source = httpRequest.responseText;

					var rating = source.split("versionOverall = ");
					rating = rating[1].split(";");
					rating = rating[0].split(".");
			
					var firstpart = rating[0];
					var secondpart = rating[1].substr(0,1);
					
					if (parseInt(secondpart) <= 2) {
						if (parseInt(secondpart) > 0) {
							secondpart = "5";
						}
					}
			
					if (parseInt(secondpart) >= 3) {
						if (parseInt(secondpart) <= 7) {
							secondpart = "5";
						} else {
							if (parseInt(secondpart) >= 8) {
								firstpart = (parseInt(firstpart) + 1).toString();
								secondpart = "0";
							}
						}
					}
			
					ProcessRating(firstpart, secondpart);
				}
			}
		}
		
		httpRequest.open("GET", "/itubex/rating/source.php", true);
		httpRequest.send(null);
	}
}

function ProcessRating(firstpart, secondpart) {
var ratingahref = document.getElementById("macupdaterating");

	if (ratingahref) {
		var zerocount = 5 - parseInt(firstpart);
		var i = 0;
		var i1 = 0;
		var htmlcode = "";
		
		for (i = 0; i < parseInt(firstpart); i++) {
			htmlcode = htmlcode + "<img src='/itubex/rating/images/star_2.png' alt=''/>";
		}
		
		if (secondpart >= "5") {
			htmlcode = htmlcode + "<img src='/itubex/rating/images/star_1.png' alt=''/>";
			zerocount = zerocount - 1;
		}
		
		for (i1 = 0; i1 < zerocount; i1++) {
			htmlcode = htmlcode + "<img src='/itubex/rating/images/star_0.png' alt=''/>";
		}

		ratingahref.innerHTML = htmlcode;
	}
}

GetRating();
