function lg(p){
	var url="quickturn.xrea.jp/ld/logo.gif";
	url = "ht"+"tp://"+url;
	var r='R='+escape(document.referrer);
	var p2="";
	if (document.URL != ""){
		p2 = 'P='+escape(document.URL);
	}else{
		p2 = 'P='+escape(p);
	};
	var imgurl = "<img src=\""+url+"?"+r+"&"+p2+"\" width=\"1\" height=\"1\">";
	document.write(imgurl);
};


function commenttree(doc){
	var plugin=doc;//document.getElementById('rightbody');
	var divs=plugin.childNodes;
	var commentarea;
	for(var i in divs){
		if(divs[i].className == 'plugin-recent_comments sidewrapper'){
			commentarea = divs[i];
		}
	}
//	var commentarea = doc;
	//document.getElementById('plugincommentlink');
	//var commentdiv = commentarea.getElementsByTagName('div');
	commentarea.style.fontWeight='normal';
	var commentdiv = commentarea.getElementsByTagName('div');
	var commentmain;
	var index;
	var author;

	var authors = new Array();
	var urls = new Array();
	var targets = new Array();
	var targeturl = new Array();
	var targethtml = new Array();

	index = 0;
	for (i=commentdiv.length-1;i>=0;i--){
		if (commentdiv[i].className == 'sidebody'){
			var linkurl = commentdiv[i].getElementsByTagName('a');
			if (linkurl.length>0){
				urls[index] = linkurl[0].href;
				targets[linkurl[0].href] = linkurl[0].innerHTML;
				author = commentdiv[i].innerHTML.match(/nbsp;\((.+?)\)$/);
				authors[index] = RegExp.$1;
				index++;
			}
		}else if (commentdiv[i].className == 'side'){
			commentmain = commentdiv[i];
		}
	}

	var replacehtml='';
	for (i in targets){
		targeturl.push(i);
		targethtml.push(targets[i]);
	}
	for (i=targeturl.length-1;i>=0;i--){
		replacehtml+='<div class="sidebody">';
		replacehtml+='<a href="'+targeturl[i]+'">'+targethtml[i]+'</a><br>';
		for (j=index-1;j>=0;j--){
			if (urls[j]==targeturl[i]){
				replacehtml+=' by ';
				replacehtml+=authors[j];
				if (authors[j]=='おく'){
					replacehtml+='ちん';
				}else if (!authors[j].match(/quickturn/)){
					replacehtml+='さん';
				}
				replacehtml+='<br>';
			}
		}
		replacehtml+='</div>';
	}
	commentmain.innerHTML=replacehtml;
};
