$(document).ready(function(){
	
	$(".read_testimonial").click(function(){
		var testimonial_id=$(this).attr('name');
		
		//get testimonial author
		var testimonial_author=$.ajax({
			type: "POST",
			url: "index.php/ajax_scripts/ajax_testimonials/get_testimonial_author/",
			data: "testimonial_id="+testimonial_id,
			async: false,
			complete: function(msg){}
		}).responseText;
		
		//get testimonial content
		var testimonial_content=$.ajax({
			type: "POST",
			url: "index.php/ajax_scripts/ajax_testimonials/get_testimonial_content/",
			data: "testimonial_id="+testimonial_id,
			async: false,
			complete: function(msg){}
		}).responseText;
		
		
		//Display popup for register restaurant
		$(".background_popup").css({  
			"opacity": "0.7"  
		});  
		$(".background_popup").fadeIn("slow");  
		$("#read_testimonial_dialog").fadeIn("slow");
		
		$("#read_testimonial_author").html(testimonial_author);
		$("#read_testimonial_content").html(testimonial_content);
		
		//request data for centering  
		var windowWidth = document.documentElement.clientWidth;  
		var windowHeight = document.documentElement.clientHeight;  
		var popupHeight = $("#read_testimonial_dialog").height();  
		var popupWidth = $("#read_testimonial_dialog").width();  
		//centering  
		$("#read_testimonial_dialog").css({
			"position": "absolute",  
			"top": windowHeight/2-popupHeight/2,  
			"left": windowWidth/2-popupWidth/2  
		});  
		//only need force for IE6  
	   
		$(".background_popup").css({  
			"height": windowHeight  
		});
	
	});
})

