//ページの位置を取得

function getScrollPosY() {
    if (typeof window.pageYOffset != 'undefined') {
        return window.pageYOffset;
    }
    else if (typeof document.documentElement.scrollTop != 'undefined' && document.documentElement.scrollTop > 0) {
        return document.documentElement.scrollTop;
    }
    else if (typeof document.body.scrollTop != 'undefined') {
        return document.body.scrollTop;
    }
    return 0;
}

//レイヤーの位置セット

function getPageH(){
	closeH=500;
	var scrollY = getScrollPosY();
	var nWidth = 502;//mainwakuの幅
  	if (window.innerHeight && window.scrollMaxY) {	
		closeH=window.innerHeight + window.scrollMaxY;//ページ全体の高さ
		windowYPOS=window.pageYOffset;//ウィンドウの高さ
		windowWPOS=window.innerWidth;//ウィンドウの幅
		document.getElementById("mainwaku").style.top = (windowYPOS + 60)+'px';
		document.getElementById("mainwaku").style.left = (windowWPOS/2 - nWidth/2)+'px';
		document.getElementById('closer').style.width =(windowWPOS-35)+ 'px';
		document.getElementById('closer').style.height =closeH+ 'px';
		//alert('firefox');
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		closeH=document.body.scrollHeight;//ページ全体の高さ
		windowYPOS=window.pageYOffset;//ウィンドウの高さ
		windowWPOS=window.innerWidth;//ウィンドウの幅
		document.getElementById("mainwaku").style.left = (window.innerWidth/2 - nWidth/2)+'px';	
		document.getElementById('closer').style.height =closeH+ 'px';
		document.getElementById('closer').style.width =(windowWPOS-20)+ 'px';
		document.getElementById("mainwaku").style.top = (windowYPOS + 60)+'px';
		//alert('safari');
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		closeH=document.body.offsetHeight;//ページ全体の高さ
		windowYPOS=window.document.body.clientHeight;//ウィンドウの高さ
		windowWPOS=window.document.body.clientWidth;//ウィンドウの幅
		document.getElementById('mainwaku').style.left =(windowWPOS/2 - nWidth/2)+'px';	
		document.getElementById('mainwaku').style.top =(60+scrollY)+'px'
		document.getElementById('closer').style.height =(closeH+30)+ 'px';
		document.getElementById('closer').style.width =(windowWPOS-20)+ 'px';
		//alert(ie);
  	}

}

