var Toppx = 0; //上端位置

var theScrollHeight;
if (typeof document.compatMode != 'undefined' &&
     document.compatMode != 'BackCompat') {
   theScrollHeight = document.documentElement.scrollHeight;
}
else if (typeof document.body != 'undefined') {
   theScrollHeight = document.body.scrollHeight;
}
if(theScrollHeight<100) theScrollHeight = 700;

document.getElementById("wrapper").style.height = theScrollHeight + "px";
	
function scall(){		
	var scrollPosTop;
	var scrollPosLeft;
	if (typeof window.pageYOffset != 'undefined') {
	   scrollPosTop = window.pageYOffset;
	   scrollPosLeft = window.pageXOffset;
	}
	else if (typeof document.compatMode != 'undefined' &&
	     document.compatMode != 'BackCompat') {
	   scrollPosTop = document.documentElement.scrollTop;
	   scrollPosLeft = document.documentElement.scrollLeft;
	}
	else if (typeof document.body != 'undefined') {
	   scrollPosTop = document.body.scrollTop;
	   scrollPosLeft = document.body.scrollLeft;
	}
	
	if(scrollPosTop+600>theScrollHeight) {  var maxTop = theScrollHeight - 600+10; document.getElementById("navigation").style.top = maxTop + "px";}
	else {	document.getElementById("navigation").style.top = scrollPosTop+Toppx + "px";}
}

window.onscroll=scall;
window.onresize=scall;
window.onload=scall;
