//if(window.attachEvent){
//	window.attachEvent("onload", ec_display);
//}else if(window.addEventListener){
//	window.addEventListener("load", ec_display, false);
//}else{
//	window.onload = ec_display
//}
//document.write('<div id="easy_comment"><img src="http://common.yumejiroh.com/images/loader.gif" /></div>')
ec_display()

function ec_display(){
	file_name = "comment96x96.gif"
	html = '<a href="javascript:ec_post(\'b.hatena.ne.jp\')" title="はてなブックマーク" rel="nofollow">'
	html += '<img src="http://common.yumejiroh.com/easy_comment/' + file_name + '" alt="はてなブックマーク" />'
	html += '</a>'
//	document.getElementById("easy_comment").innerHTML = html
	document.write(html)
}

function ec_post(service){
	var title = document.title
	var uri = document.URL
	var nodes = document.getElementsByTagName('meta')
	var description = "";
	for (var i = 0, I = nodes.length; i < I; i++) {
		if (nodes[i].name == "description"){
			description = nodes[i].content
		}
	}
	var form = document.createElement("form")
	form.method = "post"
	form.action = "http://wnjiroh.s20.coreserver.jp/media-cms/front.cgi?controller=easy_bookmark;action=jump"
	form.setAttribute("styles", "display:none;")
	var input_s = document.createElement("input")
	input_s.name = "service"
	input_s.type = "hidden"
	input_s.value = service
	form.appendChild(input_s)
	var input_t = document.createElement("input")
	input_t.name = "title"
	input_t.type = "hidden"
	input_t.value = title
	form.appendChild(input_t)
	var input_u = document.createElement("input")
	input_u.name = "uri"
	input_u.type = "hidden"
	input_u.value = uri
	form.appendChild(input_u)
	var input_c = document.createElement("input")
	input_c.name = "comment"
	input_c.type = "hidden"
	input_c.value = description
	form.appendChild(input_c)
	document.body.appendChild(form)
	
	window.open("about:blank", "EasyComment", "width=700, height=600, menubar=no, toolbar=no, location=no, status=no, resizable=yes, scrollbars=yes")
	form.target = "EasyComment"
	form.submit()
}