function WSWindowApi() {
	this.windowWidth = 0;
	this.windowHeight = 0;
	this.pageScrollY = 0;
	this.pageScrollX = 0;
	this.mouseX = 0;
	this.mouseY = 0;

	this.getWindowWidth = function() { 
		var retVal = 0;
		if(this.WIN32()) {		
			retVal = (this.NS4()||this.NS6())? window.innerWidth : (this.IE5()||this.IE4())? document.body.clientWidth : 0;
		} else if(this.MAC()) {
			retVal =  window.innerWidth;
		} else {
			retVal = 0;
		}
		return( retVal ); 

	}

	this.getWindowHeight = function() {
		if(this.WIN32()) {
			retVal = (this.NS4()||this.NS6())? window.innerHeight : (this.IE5()||this.IE4())? document.body.clientHeight : 0;
		} else if(this.MAC()) {
			retVal =  window.innerHeight;
		} else {
			retVal = 0;
		}
		return( retVal ); 
	}

	this.getWindowDims = function() {
		this.windowWidth = this.getWindowWidth;
		this.windowHeight = this.getWindowHeight;	
	}

	this.showWindowDims = function() {
		alert(this.windowWidth());
		alert(this.windowHeight());
	}

	this.getPageScrollY = function() {
		if(this.WIN32()) {
			if(this.NS4()||this.NS6()) return window.pageYOffset;
			if(this.IE5()||this.IE4()) return document.body.scrollTop;
		} else if(this.MAC()) {
			var h = 0;
			if(this.OPERA()) {
				h = window.pageYOffset;
				return h;			
			} else {
				h = window.pageYOffset || document.body.scrollTop ||  document.documentElement.scrollTop;
				return h;
			} 
		} else {
			return 0;
		}
	}

	this.getPageScrollX = function(){
		if(this.WIN32()) {
			if(this.NS4()||this.NS6()) return window.pageXOffset;
			if(this.IE5()||this.IE4()) return document.body.scrollLeft;
		} else if(this.MAC()) {
			var w = 0;
			if(this.OPERA()) {
				w = window.pageXOffset;
				return w;
			} else {
				w = window.pageXOffset || document.body.scrollLeft || document.documentElement.scrollLeft;    
				return w;
			} 
		} else {
			return 0;
		}
	}

	this.setPageScrollY = function(posY) {
		if(this.WIN32()) {
			if(this.NS4()||this.NS6()) { window.pageYOffset = posY; return; }
			if(this.IE5()||this.IE4()) { document.body.scrollTop = posY; return; }
		} else if(this.MAC()) {
			if(this.OPERA()) {
				window.pageXOffset = posY;
				return ;			
			} else {
				if(window.pageYOffset) {
					window.pageYOffset = posY;
				} else if(document.body.scrollTop) {
					document.body.scrollTop = posY;
				} else if(document.documentElement.scrollTop) {
					document.documentElement.scrollTop = posY;
				} else {
					return;
				}
			} 
		} else {
			return;
		}
	}

	this.setPageScrollX = function(posX){
		if(this.WIN32()) {
			if(this.NS4()||this.NS6()) { window.pageXOffset = posX; return; }
			if(this.IE5()||this.IE4()) { document.body.scrollLeft = posX; return; }
		} else if(this.MAC()) {		
			if(this.OPERA()) {
				window.pageXOffset = posX;
				return;
			} else {
				if(window.pageXOffset) {
					window.pageXOffset = posX;
				} else if(document.body.scrollLeft) {
					document.body.scrollLeft = posX;
				} else if(document.documentElement.scrollLeft) {
					document.documentElement.scrollLeft = posX;
				} else {
					return;
				}			
			} 
		} else {
			return;
		}
	}

	this.getWindowScroll = function() {
		this.pageScrollY = this.getPageScrollY;
		this.pageScrollX = this.getPageScrollX;
	}

	this.showWindowScroll = function() {
		alert(this.pageScrollY());
		alert(this.pageScrollX());
	}

	this.getMousePosition = function(evt) {    
		if(!evt) evt = window.event;    
		var pos = new Object();   
		pos.left = evt.clientX;    
		pos.top = evt.clientY;    
		var b = (window.document.compatMode && window.document.compatMode == "CSS1Compat") ?  window.document.documentElement : window.document.body || null;
		if (b) {        
			pos.scrollLeft = pos.left + b.scrollLeft;        
			pos.scrollTop = pos.top + b.scrollTop;    
		}  else if(this.NS4())  {      
			pos.scrollLeft = evt.pageX;        
			pos.scrollTop = evt.pageY;        
			pos.left = evt.pageX - window.pageXOffset;        
			pos.top = evt.pageY - window.pageYOffset;    
		}    
		this.mouseX = pos.left;
		this.mouseY = pos.top;

		delete pos;
	}

}

WSWindowApi.prototype = new WSBrowserIs();
