// -----------------------------------------------------------------
// Functions   : dynamicFunction.js
// Language    : JavaScript
// Description : Use this functions when you need DynamicHTML
// Auther      : Tomoyuki Tada
// -----------------------------------------------------------------
// Ver    Date    Description of modification
// --- ---------- --------------------------------------------------
// 1.0 24/01/2000 Original write
// -----------------------------------------------------------------
// Source: Webmonkey Code Library
// (http://www.hotwired.com/webmonkey/javascript/code_library/)
// -----------------------------------------------------------------


//Get object function
//Layer objectを返す
function getObject(id){
	if(document.getElementById){
		return document.getElementById(id).style;
	}
	else if(document.all){
		return document.all[id].style;
	}
	else if(document.layers){
		return document.layers[id];
	}
}

//write Object function
//指定したレイヤーにテキスト(HTML)を書き込む
function writeObject(id,value){
	if(document.getElementById) document.getElementById(id).innerHTML=value;
	if(document.all) document.all[id].innerHTML=value;
	else if(document.layers){
		var obj = document.layers[id];
		obj.document.open();
		obj.document.write(value);
		obj.document.close();
	}
}

//Window内の縦幅を返す
function getBodyHeight(){
	if(window.innerHeight){
		return window.innerHeight;
	}
	else if(document.getElementById){
		return document.body.offsetHeight;
	}
	else if(document.all){
		return document.body.clientHeight;
	}
}

//Window内の横幅を返す
function getBodyWidth(){
	if(window.innerWidth){
		return window.innerWidth;
	}
	else if(document.getElementById){
		return document.body.offsetWidth;
	}
	else if(document.all){
		return document.body.clientWidth;
	}
}

//現在のマウスX座標を取得
function getMouseX(e){
	if(document.all) return parseInt(document.body.scrollLeft+event.clientX);
	else if(document.layers||document.getElementById) return parseInt(e.pageX)
}

//現在のマウスY座標を取得
function getMouseY(e){
	if(document.all) return parseInt(document.body.scrollTop+event.clientY);
	else if(document.layers||document.getElementById) return parseInt(e.pageY);
}


//get offset Y function
//縦スクロール分を返す
function getOffsetY(){
	if(document.all){
		return document.body.scrollTop;
	}
	else{
		return pageYOffset;
	}
}

//get offset X function
//横スクロール分を返す
function getOffsetX(){
	if(document.all){
		return document.body.scrollLeft;
	}
	else{
		return pageXOffset;
	}
}
