// JavaScript Document

$(document).ready(function() {
	$('#oBottomBoxes div.oBottomBox ul li span.stars img').bind('mouseover', function() {
		var rating = $(this).attr('alt');
		switch(rating) {
			case '1':
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(1)').attr('src', 'images/common/star-on.gif');
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(2)').attr('src', 'images/common/star-off.gif');
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(3)').attr('src', 'images/common/star-off.gif');
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(4)').attr('src', 'images/common/star-off.gif');
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(5)').attr('src', 'images/common/star-off.gif');
				break;
			case '2':
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(1)').attr('src', 'images/common/star-on.gif');
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(2)').attr('src', 'images/common/star-on.gif');
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(3)').attr('src', 'images/common/star-off.gif');
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(4)').attr('src', 'images/common/star-off.gif');
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(5)').attr('src', 'images/common/star-off.gif');
				break;
			case '3':
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(1)').attr('src', 'images/common/star-on.gif');
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(2)').attr('src', 'images/common/star-on.gif');
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(3)').attr('src', 'images/common/star-on.gif');
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(4)').attr('src', 'images/common/star-off.gif');
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(5)').attr('src', 'images/common/star-off.gif');
				break;
			case '4':
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(1)').attr('src', 'images/common/star-on.gif');
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(2)').attr('src', 'images/common/star-on.gif');
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(3)').attr('src', 'images/common/star-on.gif');
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(4)').attr('src', 'images/common/star-on.gif');
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(5)').attr('src', 'images/common/star-off.gif');
				break;
			case '5':
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(1)').attr('src', 'images/common/star-on.gif');
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(2)').attr('src', 'images/common/star-on.gif');
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(3)').attr('src', 'images/common/star-on.gif');
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(4)').attr('src', 'images/common/star-on.gif');
				$('#oBottomBoxes div.oBottomBox ul li span.stars img:nth-child(5)').attr('src', 'images/common/star-on.gif');
				break;
		}
	}).bind('mouseout',function() {
		//reset to originals
		$('#oBottomBoxes div.oBottomBox ul li span.stars img.on').attr('src','images/common/star-on.gif');
		$('#oBottomBoxes div.oBottomBox ul li span.stars img.off').attr('src','images/common/star-off.gif');
	}).bind('click', function() {
		var rating = $(this).attr('alt');
		$.ajax({
			url: 'rating.php',
			data: {
				'url': rating_url,
				'rating': rating
			}});
		$('#oBottomBoxes div.oBottomBox ul li span.stars img').unbind('mouseover').unbind('mouseout').css('cursor',''); //stop tracking now
	}).css('cursor','pointer');
});