function StopButton(){
	document.getElementById(arguments[0]).disabled=true;
	document.getElementById(arguments[0]).value="提交("+arguments[1]+")";
	if(--arguments[1]>0){
		window.setTimeout("StopButton('"+arguments[0]+"',"+arguments[1]+")",1000);
	}
	if(arguments[1]<=0){
		document.getElementById(arguments[0]).value='提交';
		document.getElementById(arguments[0]).disabled=false;
	}
}
function GetComment($ID,$Page){
	$.ajax({
		url:"Comment.php?action=ajax_getcomment&id="+$ID+"&page="+$Page+"&time"+new Date().toString(),
		type:'GET',
		success:function(){
			$('#comment').html(arguments[0]);
		}
	});
}
function SendComment(){	
		var $CommentParentID	=arguments[0];
		var $CommentTitle       =$('#CommentTitle').val(); 
		var $CommentUser		=$('#CommentUser').val();
		var $CommentText		=$('#CommentText').val();
		var $c_user             =$('#c_user').val();  
		if ($.trim($CommentTitle)=='')
		{
			alert('请您填写留言标题！');
			$('#CommentTitle').focus();
			return false;
		}
		if ($.trim($CommentUser)=='')
		{
			alert('请您填写昵称！');
			$('#CommentUser').focus();
			return false;
		}
		if ($.trim($CommentText)=='')
		{
			alert('请您填写回复内容！');
			$('#CommentText').focus();
			return false;
		}
		if ($CommentText.length<5||$CommentText.length>200)
		{
			alert('内容必须在5-200字之间！');		
			return false;
		}
		StopButton('CommentSubmit',10);
	$.ajax({
		url:"Comment.php?action=ajax_sendcomment&commentparentid="+$CommentParentID+"&CommentUser="+$CommentUser+"&CommentText="+$CommentText+"&CommentTitle="+$CommentTitle+"&c_user="+$c_user+"&time="+new Date().toString(),
		type:'GET',
		success:function(){
			
			GetComment($CommentParentID,1);
			//alert(arguments[0]);
			$("#CommentTitle").val("");
			$("#CommentText").val("");
		}
	});
//SetCookie("CommentUser",$CommentUser,3);
}
