function showStars(num,stars) {
	
	img = document.getElementById(num.alt+'_stars');
	vote = img.style.backgroundImage.substring(4, img.style.backgroundImage.length-1)

	if(vote != ""){
		el = document.getElementById(num.alt+'_rate');
		txt = img.alt+"Rate it!"
		if (stars == 1) txt = "Poor"
		else if (stars == 2) txt = "Average"
		else if (stars == 3) txt = "Good"
		else if (stars == 4) txt = "Very good"
		else if (stars == 5) txt = "This totally rocks!"
		el.innerHTML = txt

		if(stars > 0) img.src = "stars-"+stars+".0.png"
		else img.src = vote;
	}
}

function addStars(num,stars){
	img = document.getElementById(num.alt+'_stars');
	if(img.style.backgroundImage != ""){
		sendStars(document.getElementById('banner-image').title,num.alt,document.getElementById(num.alt+'_title').innerHTML,stars);
		//img.src = "stars-"+stars+".0.png";
		vote = img.style.backgroundImage.substring(4, img.style.backgroundImage.length-1);
		img.src = (vote == "stars-0.0.png") ? "stars-"+stars+".0.png" : vote
		img.style.backgroundImage = "";
		document.getElementById(num.alt+'_rate').innerHTML = "Thanks for voting";
	}
}


function sendStars(podcast,id,title,stars) {
	// Here we note the star rating
	if(id){
		xmlhttp = getXMLHTTP()
		title = title.replace("&amp;","and");
		title = title.replace("=","equals");
		title = title.replace("#","HASHSIGN");
		title = title.replace("?","QUESTIONMARK");
		podcast = podcast.replace("?","QUESTIONMARK");
//alert("/amp/stats.html?podcast="+podcast+"&id="+id+"&title="+title+"&starts="+stars)
//		document.getElementById(id+'_rate').innerHTML = "/amp/stats.html?podcast="+podcast+"&id="+id+"&title="+title+"&stars="+stars;
		xmlhttp.open("GET","/amp/stats.html?podcast="+podcast+"&id="+id+"&stars="+stars+"&title="+title,true);
		xmlhttp.send(null);
	}
}
