var CommentHelper={	articleID:0,	url:"/BeCool/ASPXDLL/CommentAjaxHelper.aspx",	pars:"",	divid:"divAjaxComment",		//初始化对应文章ID，必须最先调用	init:function(hiddenField)	{		this.articleID=hdArticleID.value;			},	submit:function()	{			if(this.ckeckTextNull($('hdarticleID'),'没找到评论对象，不能进行评论，请和管理员联系。'))return;            if(this.ckeckTextNull($('txtUserName'),'姓名不能为空。'))return;            if(this.ckeckTextNull($('txtContent'),'内容不能为空。'))return;            if(this.ckeckTextNull($('checkcode'),'验证码不能为空。'))return;			document.getElementById('commentMsg').innerHTML='正在提交数据,请稍候.....';			this.pars="method=InsertComment&content="+$('txtContent').value+"&username="+$('txtUserName').value+"&checkcode="+$('checkcode').value+"&articleID="+encodeURI(this.articleID);			var myAjax = new Ajax.Request(				this.url, 				{					method: 'get', 						parameters: this.pars, 						onFailure: function(request){$(this.divid).innerHTML="访问服务器错误";},						onSuccess: this.callBackComment//onComplete				});			//alert(this.url);	},	getHotList:function()	{		this.pars="method=GetHotList&articleID="+encodeURI(this.articleID);		//alert(this.pars);		var myAjax = new Ajax.Request(			this.url,{				method: 'get', 				parameters: this.pars, 				onFailure: function(request){$(this.divid).innerHTML="访问服务器错误";},				onSuccess: this.BeCoolCallBack//onComplete			});		},	getPostForm:function()	 {		this.pars="method=GetPostForm&articleID="+this.articleID;			var myAjax2 = new Ajax.Request(				this.url, 				{					method: 'get', 						parameters: this.pars, 						onFailure: function(request){$(this.divid).innerHTML="访问服务器错误";},						onSuccess: this.BeCoolCallBack//onComplete				});		},	linkToMore:function()	{			window.open('/Template/default/comment.html');			this.pars="method=getAllList&articleID="+this.articleID;			var myAjax = new Ajax.Request(				this.url, 				{					method: 'get', 						parameters: this.pars, 						onFailure: function(request){$(this.divid).innerHTML="访问服务器错误";},						onSuccess: this.BeCoolCallBack//onComplete				});		},	up:function(commentId)	{				this.pars="method=up&commentId="+commentId;		var myAjax = new Ajax.Request(				this.url, 				{					method: 'get', 						parameters: this.pars, 						onFailure: function(request){$(this.divid).innerHTML="访问服务器错误";},						onSuccess: this.BeCoolCallBack//onComplete				});		},	Quote:function(commentId)	{		this.pars="method=quote&commentId="+commentId;		var myAjax = new Ajax.Request(				this.url, 				{					method: 'get', 						parameters: this.pars, 						onFailure: function(request){$(this.divid).innerHTML="访问服务器错误";},						onSuccess: this.BeCoolCallBack//onComplete				});			},	//盖楼回复	quoteSubmit:function(commentId)	{		this.pars="method=quoteSubmit&commentId="+commentId;		var myAjax = new Ajax.Request(				this.url, 				{					method: 'get', 						parameters: this.pars, 						onFailure: function(request){$(this.divid).innerHTML="访问服务器错误";},						onSuccess: this.BeCoolCallBack//onComplete				});		},	 ckeckTextNull:function(obj,tip)    {            if(obj)            {                if(obj.value=='')                {                    if(obj.type!='hidden') obj.focus();                         alert(tip);                    return true;                }            }    },	BeCoolCallBack:function(response)	   {		   return function(httpRequest){		   $(divid).innerHTML=response.responseText;		  // alert(response.responseText);		   };	   },	callBackComment:function(response)        {			alert(response.responseText);			var type=response.responseText;            //type = httpRequest.responseText;            document.getElementById('commentMsg').innerHTML=''			            if(type=='checkcode')            {              alert("验证码输入错误，请重新输入。");              this.refresh();               return;            }                        if(type=='no')            {              alert("发表评论失败。");  return;            }            alert("发表评论成功。");             $('txtContent').value='';			 this.refresh();           this.getHotList();        },		refresh:function() 		{				var url=document.all("ValidateCodeImage").src;//"/CMS/CheckCode.aspx?id=";				var n=url.indexOf('?');				if(n>0)url=url.substring(0,n); 				var r=Math.random()*1000; 				url=url+"?temp="+r;				//alert(url)				document.all("ValidateCodeImage").src=url;				document.all("checkcode").value=""; 				document.all("checkcode").focus();				return false;			}};
