var aTags = document.getElementById("RATING-LINKS").getElementsByTagName("A");
var pDescr = document.getElementById("star-descr");
var initialStarText = pDescr.firstChild.nodeValue;

for (var i=0; i<aTags.length; i++) {											
	aTags[i].onmouseover=function() {
		highlightStars(this);
	}
	//MouseOut
	aTags[i].onmouseout=function() {
		removeHighlightFromStars();
	}
}
var countHover;
var countActive;
var activeDiv;
var newP;
function highlightStars(activeA) {
	activeDiv = activeA.parentNode;
	
	countHover = 0;
	countActive = -1;
	
	var aChildTags = activeDiv.getElementsByTagName("A");
	for (var i=0; i<aChildTags.length; i++) {
		countHover = i;
		if (aChildTags[i].firstChild.src.search('/images/star_full.png') != -1) {
			countActive = i;
		}
		if (aChildTags[i] == activeA) {
			aChildTags[i].firstChild.src = '/images/star_full.png';
			break;
		}
		else {
			aChildTags[i].firstChild.src = '/images/star_full.png';	
		}
	}
	var starDescr = new Array("Geht so", "Okay", "Gut", "Sehr gut", "Super!"); 
	//newP = document.createElement("p");
	//var newPText = document.createTextNode(starDescr[countHover]);
	var newPText = starDescr[countHover];
	//newP.className = "star-descr";
	//newP.appendChild(newPText);
	pDescr.firstChild.nodeValue = newPText;
}
function removeHighlightFromStars() {
	var aChildTags = activeDiv.getElementsByTagName("A");
	for (var i=0; i<=countHover; i++) {
		
		if (i <= countActive) {
			aChildTags[i].firstChild.src = '/images/star_full.png';
		}
		else {
			aChildTags[i].firstChild.src = '/images/star_blank.png';	
		}
	}
	pDescr.firstChild.nodeValue = initialStarText;
	/*var pTags = activeDiv.getElementsByTagName("p");
	for (var i=0; i<pTags.length; i++) {
		activeDiv.removeChild(pTags[0]);
	}*/
}