
this.show_anchor = function(){
	this.sa_start = function(){
		var div_anchor	= document.getElementById("show_anchor");
		if(div_anchor){
			var div_parts	= document.getElementById("Center");
			if(div_parts){
				var parents = /(((&gt;){1,2}|＞)(1000|[1-9]{1}[0-9]{0,2}))/g;
				var pText = document.getElementsByClassName("text");
				for(i=0; i<pText.length; i++){
					var strText = pText[i].innerHTML;
					strText = strText.replace(parents, '<a href="#" onmouseover="sa_show($4)" onmouseout="sa_hide();" onclick="return false;">$1</a>');
					pText[i].innerHTML = strText;
				}
			}
		}
	};
	sa_start();
};

function sa_show(no){
	document.getElementById("show_anchor_type_no").innerHTML = no;
	if(typeof Ajax != 'undefined'){
		typeName = document.getElementById("show_anchor_type_name").innerHTML;
		typeId   = document.getElementById("show_anchor_type_id").innerHTML;
		typeNo   = document.getElementById("show_anchor_type_no").innerHTML;
		
		new Ajax.Request(
			'./?m=pc&a=page_h_show_anchor', {
				method: "get",
				parameters: 'type=' + typeName + '&id=' + typeId + '&no=' + typeNo,
				onComplete: sa_show_success
			}
		);
			
		var pValue = document.getElementById("show_anchor_value");
		pValue.innerHTML      = "読み込み中...";
		pValue.style.left     = (mouse_x + 10) + 'px';
		pValue.style.top      = (mouse_y -  5) + 'px';
		pValue.style.display  = 'block';
	}
}

function sa_show_success(obj){
	var pValue = document.getElementById("show_anchor_value");
	pValue.innerHTML      = obj.responseText;
}

function sa_hide(){
	var pValue = document.getElementById("show_anchor_value");
	pValue.style.display = "none";
}

var mouse_x = 0, mouse_y = 0;
this.get_mouseposition = function(){
	this.set_mouseposition = function(event){
		mouse_x = Event.pointerX(event);
		mouse_y = Event.pointerY(event);
	}
	
	Event.observe(window.document, "mousemove", set_mouseposition, false);
}

if (window.attachEvent){
	window.attachEvent('onload', show_anchor);
	window.attachEvent('onload', get_mouseposition);
} else {
	window.addEventListener('load', show_anchor, false);
	window.addEventListener('load', get_mouseposition, false);
}


function vote(type, no, stat){
	if(typeof Ajax != 'undefined'){
		new Ajax.Request(
			'./?m=pc&a=page_h_vote_button', {
				method: "get",
				parameters: 'type=' + type + '&no=' + no + '&stat=' + stat,
				onComplete: vote_success
			}
		);
	}
	return false;
}

function vote_success(obj){
	alert(obj.responseText)	;
	location.reload();
}
