window.addEventListener('load', iWindow);
/*
 * テキストエリア拡大表示(iPhone用)
 *
 * 	１．フッタに<div id="hide"></div>を記述(hideは任意)
 * 	２．cssに以下の記述
#hide {
	display: none;
	background: #000;
	width: 100%;
	height: 100%;
	opacity: 0.4;
	position: absolute;
	top: 0;
	left: 0;
}
 * 	３．この.jsを呼ぶ
 */
function iWindow() {
	var obj = document.body.getElementsByTagName('textarea');
	var hw = document.getElementById('hide');
	var h = '';
	var t = '';
	hw.onclick = hide;
	for(var i = 0; i < obj.length; i++) {
		var h = '';
		obj[i].onfocus = function (){
			h = this.style.height;
			this.style.minWidth = '95%';
			this.style.height = '1000px';
			this.style.position = 'relative';
			this.style.zIndex = '1';
			t = this.offsetTop;

			var dh = window.innerHeight|document.body.clientHeight;

			hw.style.height = dh+'px';
			hw.style.display = 'block';
		}
		obj[i].onblur = hide;
	}

	function hide(){
		if(window.scrollY > t) {
			window.scrollBy(0, t)
		}
		hw.style.display = 'none';
		this.style.minWidth = '0px';
		this.style.height = h;
	}
}
