MyTool = function(){};
MyTool.getBrowserWidth = function(){
	if(window.innerWidth){
		return window.innerWidth;
	}
	else if(document.documentElement && document.documentElement.clientWidth != 0){
		return document.documentElement.clientWidth;
	}
	else if(document.body){
		return document.body.clientWidth;
	}
	return 0;
};
MyTool.getBrowserHeight = function(){
	if(window.innerHeight){
		return window.innerHeight;
	}
	else if(document.documentElement && document.documentElement.clientHeight != 0){
		return document.documentElement.clientHeight;
	}
	else if(document.body){
		return document.body.clientHeight;
	}
	return 0;
};

MyPage = function(){
	this.header = null;
	this.body = null;
	this.footer = null;
	this.root = "";
	this.success = false;
};
MyPage.prototype.setHeader = function(str){
	this.header = document.getElementById(str);
};
MyPage.prototype.setBody = function(str){
	this.body = document.getElementById(str);
};
MyPage.prototype.setFooter = function(str){
	this.footer = document.getElementById(str);
};
MyPage.prototype.setRoot = function(arg){
	this.root = arg;
};
MyPage.prototype.resetLayout = function(){
	if(!this.success){ return; }
	this.header.style.position = "absolute";
	this.header.style.height = "143px";
	this.header.style.width = "100%";
	this.header.style.overflow = "hidden";

	this.body.style.position = "absolute";
	this.body.style.top = "143px";
	this.body.style.height = (MyTool.getBrowserHeight() - 143 - 70) + "px";
	this.body.style.width = "100%";
	this.body.style.overflowY = "scroll";

	this.footer.style.position = "absolute";
	this.footer.style.top = (MyTool.getBrowserHeight() - 70) + "px";
	this.footer.style.width = "100%";
	this.footer.style.height = "70px";
	this.footer.style.overflow = "hidden";
};
MyPage.prototype.loadCommonParts = function(){
	var self = this;
	var flg = false;
	var tmp1,tmp2;
	var req = new Ajax.Request(this.root+"header.html",{
			asynchronous:false,
			onSuccess:function(httpObj){
				tmp1 = httpObj.responseText;
				flg = true;
			},
			onFailure:function(httpObj){
				flg = false;
			}
		});
	if(!flg){ return; }
	req = new Ajax.Request(this.root+"footer.html",{
			asynchronous:false,
			onSuccess:function(httpObj){
				tmp2 = httpObj.responseText;
				flg = true;
			},
			onFailure:function(httpObj){
				flg = false;
			}
		});
	if(flg){
		self.header.innerHTML = tmp1.replace(/\{\$docroot\}/g,this.root);
		self.footer.innerHTML = tmp2;
		this.success = true;
	}
};

MyScript = function(){
	this.list_onload = new Array();
	this.list_onresize = new Array();
};
MyScript.prototype.push_onload = function(fnc){
	this.list_onload.push(fnc);
};
MyScript.prototype.push_onresize = function(fnc){
	this.list_onresize.push(fnc);
};
MyScript.prototype.onload = function(){
	for(var i = 0; i < this.list_onload.length; i++){
		this.list_onload[i]();
	}
};
MyScript.prototype.onresize = function(){
	for(var i = 0; i < this.list_onresize.length; i++){
		this.list_onresize[i]();
	}
};

var obj_mypage = new MyPage();
var obj_myscript = new MyScript();
onload = function(){
	obj_myscript.onload();
};
onresize = function(){
	obj_myscript.onresize();
};
