// ActionScript Document
// JavaScript Document

/*$(document).ready(function() {
		// get current rating
		//getRating();
		// get rating function
		function getRating(){
			$.ajax({
				type: "GET",
				url: "update.php",
				data: "do=getrate",
				cache: false,
				async: false,
				success: function(result) {
					// apply star rating to element
					$("#current-rating").css({ width: "" + result + "%" });
				},
				error: function(result) {
					alert("some error occured, please try again later");
				}
			});
		}
		
			
	});
	*/
	
function get_rating(domain,id,act)
{	

		// link handler
		//$('#rating #gddw a').click(function(){
			if(act=="up")
				loadinfo = "loading_dw_"+id;
			else
				loadinfo = "loading_up_"+id;
				
			$('#'+loadinfo).show("fast");
			$('#'+loadinfo).html("<img src='"+domain+"/images/ajax-loader.gif'>");
											
			$.ajax({
				type: "POST",
				url: domain+"/modules/update_rating.php",
				data: "id="+id+"&act="+act,
				cache: false,
				async: false,
				success: function(result) {
				$('#'+loadinfo).fadeOut();
					
					// remove #ratelinks element to prevent another rate
					//$("#ratelinks").remove();
					// get rating after click
					//getRating();
				},
				error: function(result) {
					alert("some error occured, please try again later");
				}
			});
}
