// JavaScript Document
function getRating(groupid,id){
			$.ajax({
				type: "GET",
				url: "rating.php",
				data: "do=getrate&id="+id+"&groupid="+groupid,
				cache: false,
				async: false,
				success: function(result) {
					// apply star rating to element
					//alert(result);
					$("#current-rating-"+groupid+'-'+id).css({ width: "" + result + "%" });
				},
				error: function(result) {
					//alert("some error occured, please try again later");
				}
			});
		}


function rateit(groupid,id,val){
				$.ajax({
				type: "GET",
				url: "rating.php",
				data: "rating="+val+"&do=rate&id="+id+"&groupid="+groupid,
				cache: false,
				async: false,
				success: function(result) {
					
					// remove #ratelinks element to prevent another rate
					$("#ratelinks-"+groupid+'-'+id).remove();
					// get rating after click
					getRating(groupid,id);
				},
				error: function(result) {
					//alert("some error occured, please try again later");
				}
			});
			
		}

/*	$(document).ready(function() {
		// get current rating
		//getRating();
		// get rating function
		
		
		// link handler
		$('#ratelinks-1 li a').click(function(){
			$.ajax({
				type: "GET",
				url: "update.php",
				data: "rating="+$(this).text()+"&do=rate&id=1",
				cache: false,
				async: false,
				success: function(result) {
					// remove #ratelinks element to prevent another rate
					$("#ratelinks-1").remove();
					// get rating after click
					getRating(1);
				},
				error: function(result) {
					alert("some error occured, please try again later");
				}
			});
			
		});
	});
*/