﻿
function BrowserWindow() {
	return true;
}
BrowserWindow.prototype.display = function() {
	alert("" + 
		"Width: " + this.getWidth() + "\n" + 
		"Height: " + this.getHeight() + "\n" + 
		"ScrollX: " + this.getScrollX() + "\n" + 
		"ScrollY: " + this.getScrollY() + "\n" + 
		"");
	return true;
}
BrowserWindow.prototype.getHeight = function() {
	var height = null;
	
	if(window.innerHeight != null) { height = window.innerHeight; } 
	else if(document.documentElement.clientHeight != null) { height = document.documentElement.clientHeight;	} 
	else if(document.body.clientHeight != null) { height = document.body.clientHeight; }	
	
	return (height==null) ? 0 : height;
}
BrowserWindow.prototype.getScrollX = function() {
	var scrollX = null;
	if(window.scrollX != null) { scrollX = window.scrollX; } 
	else if(window.pageYOffset != null) { scrollX = window.pageXOffset; } 
	else if((document.body) && (document.body.scrollLeft)) { scrollX = document.body.scrollLeft; } 
	else if((document.documentElement) && (document.documentElement.scrollLeft != null)) {
		scrollX = document.documentElement.scrollLeft;
	}
	return (scrollX==null) ? 0 : scrollX;
}
BrowserWindow.prototype.getScrollY = function() {
	var scrollY = null;
	if(window.scrollY != null) { scrollY = window.scrollY; } 
	else if(window.pageYOffset != null) { scrollY = window.pageYOffset; } 
	else if((document.body) && (document.body.scrollTop)) { scrollY = document.body.scrollTop; } 
	else if((document.documentElement) && (document.documentElement.scrollTop != null)) {
		scrollY = document.documentElement.scrollTop;
	}
	return (scrollY==null) ? 0 : scrollY;
}
BrowserWindow.prototype.getWidth = function() {
	var width = null;

	if(window.innerWidth != null) { width = window.innerWidth; } 
	else if(document.documentElement.clientWidth != null) { width = document.documentElement.clientWidth;	} 
	else if(document.body.clientWidth != null) { width = document.body.clientWidth; }	
	
	return (width==null) ? 0 : width;
}

function Browser() {
	this.window = new BrowserWindow();
	
	return true;
}

