// <[CDATA[
		   
// a few functions for small js fx.
// rmk - 2006



// rollover function (replace one image with someone else)
function swapPic(itemId,imgName) {
	var itemId = itemId;
	var imgName = imgName;
	document.getElementById(itemId).src = imgName;
}


function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}
	
	
function setFooter() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
		var contentHeight = document.getElementById('content').offsetHeight;
		var footerElement = document.getElementById('footer');
		var footerHeight  = footerElement.offsetHeight;
		if (windowHeight - (contentHeight + footerHeight) >= 0) {
			footerElement.style.position = 'relative';
			footerElement.style.top = (windowHeight - (contentHeight + footerHeight)) + 'px';
			}
		else {
			footerElement.style.position = 'static';
			}
		}
	}
}
		

function flipImgCaption(num,imgPath) {
	var targetDiv = document.getElementById("picCaption");
    targetDiv.innerHTML = picCaptionTab[num];
	swapPic("theBigImg",imgPath);
}


function showHideMore(elId) {
	obj = document.getElementById(elId);
	if(obj.style.display != 'block')
	{
	obj.style.display = 'block';
	}
	else 
	{
	obj.style.display = 'none';
	}
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}


function showInfo (infoName, source) {
	// <img src="http://www.tokyooffice.jp/shared/images/pic.gif" alt=""/>
	//var source = document.getElementById(source);
	var picToShow = '<img src=\"http://www.tokyooffice.jp/shared/images/info-'+infoName+'.gif\" alt=\"'+infoName+'\"/>';
	var targetDiv = document.getElementById("infoContainer");
	targetDiv.innerHTML = picToShow;
	targetDiv.style.display = 'block';
	var newX = findPosX(source);
	var newY = findPosY(source);
	newY -= 32;
	targetDiv.style.top = newY + 'px';
	targetDiv.style.left = newX + 'px';
	
}

function hideInfo () {
	var targetDiv = document.getElementById("infoContainer");
	targetDiv.style.display = 'none';
}

function onOff () {
	if (showBtn == false)
	{
		document.getElementById("btnHideShow").src = "http://www.tokyooffice.jp/shared/images/btn-motto-kakusu-off.gif";
		showBtn = true;
	}
	else {
		document.getElementById("btnHideShow").src = "http://www.tokyooffice.jp/shared/images/btn-motto-miru-off.gif";
		showBtn = false;
	}
}

function checkAll(checkname, exby) {
  for (i = 0; i < checkname.length; i++)
  checkname[i].checked = exby.checked? true:false
}
