function showList(obj1,obj2){
	$("#load_img").hide();
	$.ajax({
		type: "POST",
		url : "/ajax_comment.php",
		data: 'w=expage&sku='+obj1+'&page='+obj2,
		error: function(msg){
				$("#load_img").hide();
			},
		success: function(data){
			$("#comment_body").html(data);
			$("#load_img").hide();
		}
	});
}
$(document).ready(function(){
	$("#add_comment").submit(function(){
		$('#comment_submit').hide();
		$('#load_img').show();
		$('#commentMsg').text('');
		var content= $('#comment_content').attr('value');
		var name= $('#comment_name').attr('value');
		var email= $('#comment_email').attr('value');
		var sku = $('#sku').attr('value');
		var rank=$("input[name='rank']:checked").attr('value')
		var pattern = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
		if(name.length<2){
			$('#commentMsg').text('Your name is too short!');
			$('#load_img').hide();
			$('#comment_name').select();
			$('#comment_submit').show();
			return false;
		}
		if(email.length<1){
			$('#commentMsg').text('Your email is empty!');
			$('#load_img').hide();
			$('#comment_email').select();
			$('#comment_submit').show();
			return false;
		}
		if(!pattern.test(email)){
			$('#load_img').hide();
			$('#commentMsg').text("Your Email is incorrect!");
			$('#comment_submit').show();
			$('#email').select();
			return false;
		}
		if(content.length<6){
			$('#commentMsg').text('Your comment is too short!');
			$('#load_img').hide();
			$('#comment_submit').show();
			return false;
		}
		$.ajax({
			type: "POST",
			url: "/ajax_comment.php",
			data: "w=comment&sku="+sku+"&content="+content+"&name="+name+"&email="+email+"&rank="+rank,
			error: function(msg){
				alert('your comment is wrong!');
			},
			success: function(data){
		    $('#comment_body').html(data);
			$('#comment_submit').show();
			$('#load_img').hide();
			$('#comment_content').attr('value','');
			$('#comment_email').attr('value','');
			$('#comment_name').attr('value','');
			commentNum=commentNum+1;
			$('#commentNum').text(commentNum);
			}
		}); 
	 return false;
	});

	$(".listPage").click(function(){
		page=$(this).text();
		ajax_page_post();
	});

	$("#listPageFirst").click(function(){
		page=1;
		ajax_page_post();
	});

	$("#listPageLast").click(function(){
		page=$(this).attr('page');
		ajax_page_post();
	});
	function ajax_page_post(){
		//$("#estop").show();
		$.ajax({
			type: "post",
			url : "/ajax_comment.php",
			data: 'w=expage&page='+page+'&sku='+sku,
			error: function(msg){
				alert('error');
			},
			success: function(data){
				$('#comment_body').html(data);
			}
		});
	}
});