$(document).ready(function() {

 	$(".ratingblock ul li a").click(function(event){
   
	var link = $(this).attr('href');
	
	$.post("ajax/rating.php",  { link:link }, function(data)
	{
		// alert(data.message);
		
		$("#ratingblock_"+data.id).hide();

		if(data.status=='error') { alert(data.message); }
		else 
		{
			$("#ratingblock_"+data.id).fadeIn("slow").html(data.message);;
			// $("#ratingblock_"+data.id).html(data.message);
		}

		
	}, 'json');
	
	
	});	

	// table row hover	
	$("table.detail tr").mouseover(function(){
	
	rowclass = $(this).attr('class');
	if(rowclass=='') 
	$(this).addClass('active');
	
	})
	
	.mouseout(function(){
	$(this).removeClass('active');
	});

	// tooltip
	/* CONFIG */		
		xOffset = 10;
		yOffset = 20;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	$(".tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		$("body").append("<p id='tooltip'>"+ this.t +"</p>");
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$(".tooltip").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			

	
});

