$(document).ready(function() {
$('[class^=star_]').mouseenter(
	function() {
		if($(this).parent().data('selected') == undefined) {
			var selectedStar = $(this).parent().find('.hover').length - 1;
			$(this).parent().data('selected', selectedStar)
		}
		$(this).children().addClass('hover');
		$(this).prevAll().children().addClass('hover');
		$(this).nextAll().children().removeClass('hover');
	});
$('[id^=rating_]').mouseleave(
	function() {
		var selectedIndex = $(this).data('selected')
		var $selected = $(this).find('img').eq(selectedIndex).addClass('hover').parent();
		$selected.prevAll().children().addClass('hover');
		$selected.nextAll().children().removeClass('hover');
});

$("[id^=rating_]").children("[class^=star_]").click(function() {
	var current_star = $(this).attr("class").split("_")[1];
	var rid = $(this).parent().attr("id").split("_")[1];
	$('#rating_'+rid).load('http://www.the-jokes.com/rating/send_g.php', {rating: current_star, id: rid});
});
});
//Solves the problem with iexplorer
onload = function() {
	var theframes = document.getElementsByTagName('iframe');
	for(var i = 0; i < theframes.length; i++) {
		theframes[i].setAttribute("allowTransparency","true");
	}
}