function window_scroll(){
	var s={x:0,y:0,w:0,h:0};
	var d=document.documentElement,b=document.body;
	s.x=(d&&d.scrollLeft||b&&b.scrollLeft||0)-(d&&d.clientLeft||b&&b.clientLeft||0);
	s.y=(d&&d.scrollTop||b&&b.scrollTop||0)-(d&&d.clientTop||b&&b.clientTop||0);
	s.w=getDocumentWidth();
	s.h=getDocumentHeight();
	if(document.compatMode=='CSS1Compat'){
		s.w+=s.x;
		s.h+=s.y;
	}
	if(window.ActiveXObject){
		s.w+=2;
		s.h+=2;
	}
	return s;
}
function getDocumentWidth(){
	var dw=-1,bw=-1;
	if(document.compatMode||window.ActiveXObject){
		switch(document.compatMode) {
			case 'CSS1Compat':
				dw=document.documentElement.clientWidth;
				bw=document.body.offsetWidth+(document.body.style.marginLeft.length?parseInt(document.body.style.marginLeft):0)+(document.body.style.marginRight.length?parseInt(document.body.style.marginRight):0);
				break;
			default:
				bw=document.body.clientWidth;
				dw=document.body.scrollWidth;
				break;
		}
	}else{
		dw=document.documentElement.clientWidth;
		bw=document.body.offsetWidth;
	}
	return Math.max(dw,bw);
}
function getDocumentHeight(){
	var sh=-1,wh=-1,bh=-1;
	if((document.compatMode||window.ActiveXObject)&&navigator.userAgent.toLowerCase().indexOf('opera')==-1){
		switch(document.compatMode){
			case 'CSS1Compat':
				sh=((window.innerHeight&&window.scrollMaxY)?window.innerHeight+window.scrollMaxY:-1);
				wh=[document.documentElement.clientHeight,self.innerHeight||-1].sort(function(a,b){return(a-b);})[1];
				bh=document.body.offsetHeight+(document.body.style.marginTop.length?parseInt(document.body.style.marginTop):0)+(document.body.style.marginBottom.length?parseInt(document.body.style.marginBottom):0);
				break;
			default:
				sh=document.body.scrollHeight;
				bh=document.body.clientHeight;
		}
	}else{
		sh=document.documentElement.scrollHeight;
		wh=self.innerHeight;
		bh=document.documentElement.clientHeight;
	}
	var h=[sh,wh,bh].sort(function(a,b){return(a-b);});
	return h[2];
}

