/*function getRating(cid)
{
	$.ajax({
	type: "GET",
		url: "./rating/rating.php",
		data: "id="+sid+"&rating=false",
		cache: false,
		async: false, 
		/*async requests may temporarily lock the browser, disabling any actions while 	the request is active*/
		
		/*success: function(result) {
			// applies star rating to element
			var data=result.split('#');
			$('#cr').html(data[1]);
			$("#current-rating").css({ width: "" + data[2] + "%" });
			$("#tv").html(data[0]);
		},
		error: function(result) {
			//alert(result);
			alert("some error occured, please try again later");
		}
	});
}*/

function rate(cid,value)
{
	
	
	var cid=cid;
	var rate=value;
	//alert(cid+":"+rate);
	$.ajax({
		type: "GET",
		url: "rating.php",
		data: "id="+cid+"&rate="+rate,
		cache: false,
		async: false,
		success: function(result) {
			//alert(result.length);
			$("#ratelinks").remove();
			// applies star rating to element
			var data=result.split('#');
			$("#current-rating").css({ width: "" + data[1] + "%" });
			$("#tv").html(data[0]);
			if(result.length<=3)
				alert("You've already rated");
			else
				alert("Your rating has been added");
			
		},
		error: function(result) {
			alert("some error occured, please try again later");
		}
	});
			
	
}

