// 画像差し替え
function imgC(obj)
{
	var fpath = obj.src;
	if( fpath.match(/_on/) ){
		obj.src = fpath.replace(/_on/,'');
	}else{
		if( fpath.match(/png/) ){
			obj.src = fpath.replace(/.png/,'_on.png');
		}
		if( fpath.match(/jpg/) ){
			obj.src = fpath.replace(/.jpg/,'_on.jpg');
		}
		if( fpath.match(/gif/) ){
			obj.src = fpath.replace(/.gif/,'_on.gif');
		}
	}
}

var eventTimer;	//タイマー変数
var restScroll=0;	//スクロール残量

function Scroll(base,move){

	//移動元(base)要素＆オブジェクトを取得
	var obj_base  = getElemPosition(base);

	//移動先(move)要素＆オブジェクトを取得
	var elem_move = document.getElementById(move);
	var obj_move  = getElemPosition(elem_move);

	restScroll = obj_move.y-obj_base.y;
	eventTimer = setInterval(setScrollPosition,10);
}
//スクロール処理をする
function setScrollPosition() {

	var moveValue=0;

	//スクロール残量が80以上の場合、スクロール量を変える
	//Math.abs()では値の絶対値を取得
	if(Math.abs(restScroll)>80){
		moveValue = (restScroll>0)?80:-80;
	}else{
		moveValue = Math.round(restScroll/4);
	}
	//スクロールを処理
	parent.scrollBy(0,moveValue);

	//スクロール残量を計算して、残りが無ければタイマー解除
	restScroll = (restScroll>0)?restScroll-moveValue:restScroll-moveValue;

	if(moveValue==0){
		clearInterval(eventTimer);
		restScroll=0;
	}
}

//要素の位置を取得し、オブジェクトとして返す
function getElemPosition(elem) {
	var obj = new Object();
	obj.x = elem.offsetLeft;
	obj.y = elem.offsetTop;

	//親要素を取得して位置情報を修正する
	while(elem.offsetParent) {
		elem = elem.offsetParent;
		obj.x += elem.offsetLeft;
		obj.y += elem.offsetTop;
	}
	return obj;
}

function openZoom1(url) {
window.open(url,"printpage","menubar=yes,scrollbars=yes,width=660,height=600,resizable=yes");
}



function tPagePrint(){
	if((navigator.platform == "Mac68k" || navigator.platform == "MacPPC") && navigator.appName == "Microsoft Internet Explorer"){
		alert('ご利用のコンピュータでは、このボタンはお使いになれません。\nこのページを印刷するには、画面左上の「ファイル」メニューから\n「プリント...」もしくは「印刷...」をお選び下さい。')
	}
	else{
		print();
	}
}




function toggleLayerVisibility1(inputData) {
var objID=document.getElementById( "layer_" + inputData );
var buttonID=document.getElementById( "button_" + inputData );
if(objID.className=='close') {
objID.style.display='block';
objID.className='open';
buttonID.src='common/images/mainasu.gif';
}else{
objID.style.display='none';
objID.className='close';
buttonID.src='common/images/purasu.gif';
}
}

function toggleLayerVisibility2(inputData) {
var objID=document.getElementById( "layer_2_" + inputData );
var buttonID=document.getElementById( "button_2_" + inputData );
if(objID.className=='close') {
objID.style.display='block';
objID.className='open';
buttonID.src='common/images/right_yougo_on.gif';
}else{
objID.style.display='none';
objID.className='close';
buttonID.src='common/images/right_yougo.gif';
}
}

function toggleLayerVisibility3(inputData) {
var objID=document.getElementById( "layer_3_" + inputData );
var buttonID=document.getElementById( "button_3_" + inputData );
if(objID.className=='close') {
objID.style.display='block';
objID.className='open';
buttonID.src='common/images/right_kiji_on.gif';
}else{
objID.style.display='none';
objID.className='close';
buttonID.src='common/images/right_kiji.gif';
}
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}




function yabook(){
	window.open('http://bookmarks.yahoo.co.jp/bookmarklet/showpopup?t='+encodeURIComponent(document.title)+'&u='+encodeURIComponent(location.href)+'&ei=UTF-8','_blank','width=550,height=480,left=100,top=50,scrollbars=1,resizable=1',0);
}




var otherReleaseId = "";
function showOtherRelease(id,msg){
	// ID
	if ( id == null && otherReleaseId == "" ) {
		return;
	}
	else if ( id == null && otherReleaseId != "" ) {
		id = otherReleaseId;
	}
	else if ( id != "" ) {
		otherReleaseId = id;
	}
	// MSG
	if ( msg != null ) {
		$("otherBox").innerHTML = msg;
	}
	if ( id != "" ) {
		var pos = Position.cumulativeOffset($(id));
		new Element.setStyle("otherBox", { left:pos[0]+"px", top:(pos[1]+Element.getHeight(id))+"px", visibility:"visible" });
	} else {
		new Element.setStyle("otherBox", { visibility:"visible" });
	}
}

function hideOtherRelease(){
	new Element.setStyle("otherBox", { visibility:"hidden" });
//	Element.hide("otherBox");
}

var otherRelease2Id = "";
function showOtherRelease2(id,msg){
	// ID
	if ( id == null && otherRelease2Id == "" ) {
		return;
	}
	else if ( id == null && otherRelease2Id != "" ) {
		id = otherRelease2Id;
	}
	else if ( id != "" ) {
		otherRelease2Id = id;
	}

	// MSG
	if ( msg != null ) {
		$("otherBox").innerHTML = msg;
		otherReleaseId = "otherBox";
	}

	if ( id != "" ) {
		var pos = Position.cumulativeOffset($(id));
		if (Prototype.Browser.IE) {
			new Element.setStyle("otherBox", { left:(pos[0]+20)+"px", top:(pos[1]-5+Element.getHeight(id))+"px", visibility:"visible" });
		} else {
			new Element.setStyle("otherBox", { left:(pos[0]+20)+"px", top:(pos[1]-2+Element.getHeight(id))+"px", visibility:"visible" });
		}
	} else {
		new Element.setStyle("otherBox", { visibility:"visible" });
	}
}

function hideOtherRelease2(){
	new Element.setStyle("otherBox", { visibility:"hidden" });
//	Element.hide("otherBox2");
}



