function Output(id,page)
{
       $.ajax({
	   url:"/tools/review.asp?id="+id +"&page="+page,
	   beforeSend:function(){
	      $("#reviewlist").html("<img src=/skin/loading.gif>") 
	   },
	   success:function(result){
	      $("#reviewlist").html(result);
		  //var Output = new Output(id,page);
	   }   
	   })
}

$(document).ready(function(){
//下载心情
loadmood($("#id").val());

   $("#submit").click(function(){
      if(!$("#keyword").val())
	  {
	     alert("关键字不能为空！");
	     $("#keyword")[0].focus();//DOM对象
	     return false;
	  }
   });
  //loading the movie review
  Output($("#id").val(),1);

     $("#btnSubmit").click(function(){
	//nickname check
	  if(!$("#nickname").val().match(/^[\w\u4e00-\u9fa5\-]{0,20}$/))
	  {
			   alert("昵称必须0~20个中文、字母、下划线或者减号");
			   $("#nickname")[0].focus();
		return false;
	  }
	  //content check
	  if(!$("#content").val())
	  {
	       alert("总要说点什么吧，^-^");
		   $("#content")[0].focus();
		   return false;
	  }
	  
	  //checkcode check
	  if(!$("#checkcode").val())
	  {
	       alert("验证码不为空!");
		   $("#checkcode").focus();
		   return false;
	  }

     $.get("/tools/reviewpost.asp?id=" + encodeURI($("#id").val()) +"&nickname="+encodeURI($("#nickname").val()) +
  "&moviename="+encodeURI($("#moviename").val()) +"&content="+encodeURI($("#content").val()) + "&action=save&checkcode="+$("#checkcode").val(),function(data){
    var obj =  new Object();
	obj = eval(data);
    if(obj.isOk == 1)
	{
	    alert(obj.info);
		$("#postReview")[0].reset();
		//重载评论
 　　　Output($("#id").val(),1);
	}
	else if(obj.isOk == -1)
	{
	   alert(obj.info);
	   $("#checkcode").focus();
	}
	else
	{
	   alert(obj.info);
	}

  }
)

	});
   
 }); 