var isIE = false;
/*@cc_on
isIE = true;
@*/
function getAbsPos(tag) {
	var r = new Object();
	r.x = 0;
	r.y = 0;
	for ( ; tag!=null; tag=tag.offsetParent ) {
		r.x += tag.offsetLeft;
		r.y += tag.offsetTop;
	}
	return r;
}
/* これは、最後には削除 */
function showmenu(id) {
	var off = document.getElementById(id+"_off");
	var on = document.getElementById(id+"_on");
	if (on && on.style.display!='block') {
		if ( off ) {
			var pos = getAbsPos(off);
			if ( isIE ) {
				on.style.left = pos.x + 1 + "px";
				on.style.top = pos.y + 1 + "px";
			} else {
				on.style.left = pos.x + "px";
				on.style.top = pos.y + "px";
			}
		}
		on.style.display = 'block';
	}
	return false;
}
/* これは、最後には削除 */
function hidemenu(id) {
	var on = document.getElementById(id+"_on");
	if (on && on.style.display!='none') {
		on.style.display = 'none';
	}
	return false;
}
function changeimg(id,img) {
	var on = document.getElementById(id);
	if (on) on.src = img;
	return false;
}
function alignBottom(id1, id2) {
	var t1 = document.getElementById(id1);
	var t2 = document.getElementById(id2);
	if (t1 && t2) {
		var p1 = getAbsPos(t1);
		var p2 = getAbsPos(t2);
		var h1 = t1.clientHeight;
		var h2 = t2.clientHeight;
		var b1 = p1.y + h1;
		var b2 = p2.y + h2;
/*
		var testtag = document.createElement("div");
		testtag.style.border = "1px solid red";
		testtag.style.position = "absolute"
		testtag.style.width = t1.clientWidth+"px";
		testtag.style.height = h1+"px";
		testtag.style.left = p1.x+"px";
		testtag.style.top = p1.y+"px";
		document.body.appendChild(testtag);
		testtag = document.createElement("div");
		testtag.style.border = "1px solid green";
		testtag.style.position = "absolute"
		testtag.style.width = t2.clientWidth+"px";
		testtag.style.height = h2+"px";
		testtag.style.left = p2.x+"px";
		testtag.style.top = p2.y+"px";
		document.body.appendChild(testtag);
*/
//		alert(' id1='+id1+' p1='+p1.y+' h1='+h1+' style1='+t1.style.height+' b1='+b1+' id2='+id2+' p2='+p2.y+' h2='+h2+' style2='+t2.style.height+' b2='+b2);
		if ( b1>b2 ) {
			t2.style.height = (h2+b1-b2) + "px";
		} else if ( b1<b2 ) {
			t1.style.height = (h1+b2-b1) + "px";
		}
/*
		p1 = getAbsPos(t1);
		p2 = getAbsPos(t2);
		h1 = t1.clientHeight;
		h2 = t2.clientHeight;
		b1 = p1.y + h1;
		b2 = p2.y + h2;
		testtag = document.createElement("div");
		testtag.style.border = "1px solid red";
		testtag.style.position = "absolute"
		testtag.style.width = t1.clientWidth+"px";
		testtag.style.height = h1+"px";
		testtag.style.left = p1.x+"px";
		testtag.style.top = p1.y+"px";
		document.body.appendChild(testtag);
		testtag = document.createElement("div");
		testtag.style.border = "1px solid green";
		testtag.style.position = "absolute"
		testtag.style.width = t2.clientWidth+"px";
		testtag.style.height = h2+"px";
		testtag.style.left = p2.x+"px";
		testtag.style.top = p2.y+"px";
		document.body.appendChild(testtag);
*/
	}
}
function MaxDocumentHeight() {
	var h = 0;
	if (document.body) {
		if (document.body.offsetHeight && h<document.body.offsetHeight) h = document.body.offsetHeight;
		if (document.body.clientHeight && h<document.body.clientHeight) h = document.body.clientHeight;
	}
	return h;
}
function CheckFrame() {
	var h = MaxDocumentHeight();
	if ( h>0 ) {
		if (window.parent) {
			if (window.parent.AlignFrame) window.parent.AlignFrame(h);
		}
		window.clearInterval(CheckFrameInterval);
	}
}
