var YRN;
if(!YRN){
	YRN={};
}
YRN.Page=function(){
	var page=this.GetPageSize();
	this.pageWidth=page.pageWidth;
	this.pageHeight=page.pageHeight;
	this.windowWidth=page.windowWidth;
	this.windowHeight=page.windowHeight;	
	
	var objScroll=this.GetPageScroll();
	this.yScroll=objScroll["y"];
	this.xScroll=objScroll["x"];
}

YRN.Page.prototype.GetPageScroll=GetPageScroll;
YRN.Page.prototype.GetPageSize=GetPageSize;
YRN.Page.prototype.pageHeight=0;
YRN.Page.prototype.pageWidth=0;
YRN.Page.prototype.windowHeight=0;
YRN.Page.prototype.windowWidth=0;

function GetPageScroll(){
	var yScroll, xScroll;
	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
		xScroll=  self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
		xScroll=document.documentElement.scrollLeft;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
		xScroll = document.body.scrollLeft;
	}
	var obj=new Object();
	obj["x"]=xScroll;
	obj["y"]=yScroll;
	return obj;
}

function GetPageSize(){	
	var xScroll, yScroll;	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight && document.body.offsetHeight){ 
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else {
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}
	var obj=new Object();
	obj.pageWidth=pageWidth;
	obj.pageHeight=pageHeight;
	obj.windowWidth=windowWidth;
	obj.windowHeight=windowHeight;
	return obj;
}