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($HID,$HPage,$HT){
	$H.ajax({
		url:"/Comment.aspx?action=ajax_getcomment&id="+$HID+"&btype="+$HT+"&page="+$HPage+"&time"+new Date().toString(),
		type:'GET',
		success:function(){
			$H('#comment').html(arguments[0]);
		}
	});
}
//增加到本地收藏
function SendFav(type,id){	
		if (type==''||id=='')
		{
			alert('出错！');
			return false;
		}
		$H.ajax({
		url:"/Comment.aspx?action=ajax_fav&type="+type+"&Hid="+id+"&time="+new Date().toString(),
		type:'GET',
		success:function(){
			alert(arguments[0]);
		}
	});
}
function SendComment(){	
		var $HCommentParentID	=arguments[0];
		var $HCommentUser		=$H('#CommentUser').val();
		var $HCommentText		=$H('#CommentText').val();
		var $HCommentValidate	=$H('#CommentValidate').val();
		var $HMid		=$H('#Mid').val();
		var $HCid		=$H('#Cid').val();
		var $HMtype		=$H('#Mtype').val();
		if ($H.trim($HCommentUser)=='')
		{
			alert('请您填写联系或昵称！');
			$H('#CommentUser').focus();
			return false;
		}
		if ($H.trim($HCommentValidate)=='')
		{
			alert('请您填写验证码！');
			$H('#CommentValidate').focus();
			return false;
		}		
		if ($H.trim($HCommentText)=='')
		{
			alert('请您填写回复内容！');
			$H('#CommentText').focus();
			return false;
		}
		if ($HCommentText.length<5||$HCommentText.length>200)
		{
			alert('内容必须在5-200字之间！');		
			return false;
		}
		StopButton('CommentSubmit',10);
	$H.ajax({
		url:"/Comment.aspx?action=ajax_sendcomment&bid="+$HMid+"&Cid="+$HCid+"&btype="+$HMtype+"&commentparentid="+$HCommentParentID+"&commentuser="+escape($HCommentUser)+"&commenttext="+escape($HCommentText)+"&commentvalidate="+escape($HCommentValidate)+"&time="+new Date().toString(),
		type:'GET',
		success:function(){
			if (arguments[0]=='ERROR')
			{
				alert('验证码出错！');
			}else{
				//GetComment($HCommentParentID,1);
				GetComment($HMid,1,$HMtype);
				alert(arguments[0]);
				$H("#CommentText").val("");
					//验证成功时，刷新验证码图片
				$H("#CommentValidateImages").attr("src","/Comment.aspx?action=ajax_verifycode&s="+Math.random());
			}
			$H("#CommentValidate").val("");
		}
	});
//SetCookie("CommentUser",$HCommentUser,3);
}
