function RecomButton(args){this.p1=args.p1;this.btnUseful=new Array();var elm=document.getElementById(args.elm);var a=elm.getElementsByTagName("a");for(var i=0;i<a.length;i++){if(a[i].className=="btnUseful"){a[i].onmousedown=RecomButton.createDelegate(this,this.onMouseDown);this.btnUseful.push(a[i]);}}}RecomButton.createDelegate=function(instance,method){return function(){return method.apply(instance,arguments);}};RecomButton.prototype.onMouseDown=function(e){for(var i=0;i<this.btnUseful.length;i++){this.btnUseful[i].onmousedown="";var strong=this.btnUseful[i].parentNode.getElementsByTagName("strong");for(var j=0;j<strong.length;j++){if(strong[j].className=="agree"){strong[i].style.display="none";}}var img=document.createElement("img");img.className="RecomButtonActivity";img.src="http://i.yimg.jp/images/finance/common/image/loading.gif";this.btnUseful[i].parentNode.replaceChild(img,this.btnUseful[i].parentNode.lastChild);}var req;if(window.XMLHttpRequest){req=new XMLHttpRequest();}else if(window.ActiveXObject){try{req=new ActiveXObject("Msxml2.XMLHTTP");}catch(err){try{req=new ActiveXObject("Microsoft.XMLHTTP");}catch(err){}}}req.open("get","/action?name=yfnRecomButtonAction&p1="+this.p1,true);req.onreadystatechange=RecomButton.createDelegate(this,function(){if(req.readyState==4&&req.status==200){setTimeout(RecomButton.createDelegate(this,function(){var obj=eval("("+req.responseText+")");if(obj.ResultSet){for(i=0;i<this.btnUseful.length;i++){var strong=this.btnUseful[i].parentNode.getElementsByTagName("strong");for(var j=0;j<strong.length;j++){if(strong[j].className=="agree"){strong[i].firstChild.nodeValue=obj.ResultSet.TotalRecommendedScore;strong[i].style.display="inline";}}var img=this.btnUseful[i].parentNode.getElementsByTagName("img");for(var j=0;j<img.length;j++){if(img[j].className=="RecomButtonActivity"){this.btnUseful[i].parentNode.replaceChild(document.createTextNode("人"),img[j]);}}var em=document.createElement("em");em.className="btnUseful";em.appendChild(document.createTextNode(this.btnUseful[i].firstChild.nodeValue));this.btnUseful[i].parentNode.replaceChild(em,this.btnUseful[i]);}}}),500);}});req.send("");};

