var _Padding=172,_scrollMax,_bnr,_bnrTop,_prevPos=0;
function init() {
	_bnr = document.getElementById('bnr2');
	if (screen.width > 600){	
	_bnrTop = _bnr.offsetTop;
	_scrollMax = document.getElementById('content').offsetHeight+_bnrTop-_bnr.offsetHeight-_Padding;
	scrollBnr();
	}
}
function scrollBnr() {
	if (screen.width > 600 ){	
	if (_scrollMax > _bnrTop && _prevPos != pos()) {
		_prevPos = pos();
		if (pos() < _scrollMax && pos() > _bnrTop) { 
			_bnr.style.top = pos() + 'px';
		}
		else if (pos() < _scrollMax) {
		 _bnr.style.top = _bnrTop + 'px';
	    }
		else {
		 _bnr.style.top = _scrollMax + 'px';
		}
	}

	_scrollMax = document.getElementById('content').offsetHeight+_bnrTop-_bnr.offsetHeight-_Padding;
	setTimeout('scrollBnr();',10);

	}
}
function pos() {
	 if (window.innerHeight){
	  return window.pageYOffset;
	 }
	 else if (document.documentElement && document.documentElement.scrollTop){
	  return document.documentElement.scrollTop;
	 }
	 else if (document.body) {
	  return document.body.scrollTop;
	 }
}
window.onload = init;
