/*
ALL SCRIPTING IN THIS DOCUMENT WAS WRITTEN BY NICK ANNIS FOR THE ENGINES AND ENERGY CONVERSION LAB (CSU)
	-last revised 1/13/09
	
AVAILABLE FUNCTIONS:
-constructor				: essentially unnecessary, requires string argument that is the string equivalent
							  of its variable name
	getScreenHeight			: returns the available height of the browser screen
	getScreenWidth			: returns the available width of the browser screen
	getWindowXPos			: returns the x-coordinate of the top left corner of the window's view
	getWindowYPos			: returns the y-coordinate of the top left corner of the window's view
	getElementWidth			: returns the width of an element passed in as an argument, returns 0 if it cannot
							  calculate a width
	getElementHeight		: returns the height of an element passed in as an argument, retuns 0 if it cannot
							  calculate a height

*/

function tools(name){
	this.name = name;
	window[this.name] = this;
}

	tools.prototype.getScreenHeight = function(){
		var height;
		if (self.innerHeight){
			height = self.innerHeight;
		}
		else if (document.documentElement && document.documentElement.clientHeight){
			height = document.documentElement.clientHeight;
		}
		else if (document.body){
			height = document.body.clientHeight;
		}
		return height;
	}
	
	tools.prototype.getScreenWidth = function(){
		var width;
		if (self.innerHeight){
			width = self.innerWidth-18;
		}
		else if (document.documentElement && document.documentElement.clientHeight){
			width = document.documentElement.clientWidth;
		}
		else if (document.body){
			width = document.body.clientWidth;
		}
		return width;
	}
	
	tools.prototype.getWindowXPos = function(){
		var x = 0;
		if(window.pageXOffset){
			x = window.pageXOffset;
		}
		else if(document.documentElement.scrollLeft){
			x = document.documentElement.scrollLeft;
		}
		else if(document.body.scrollLeft){
			x = document.body.scrollLeft;
		}
		return x;
	}
	
	tools.prototype.getWindowYPos = function(){
		var y = 0;
		if(window.pageYOffset){
			y = window.pageYOffset;
		}
		else if(document.documentElement.scrollTop){
			y = document.documentElement.scrollTop;
		}
		else if(document.body.scrollTop){
			y = document.body.scrollTop;
		}
		return y;
	}
	
	tools.prototype.getElementWidth = function(element){
		var x = 0;
		if(element.offsetWidth){
			x = element.offsetWidth;
		}
		else if(element.clientWidth){
			x = element.clientWidth;
		}
		return x;
	}
	
	tools.prototype.getElementHeight = function(element){
		var y = 0;
		if(element.offsetHeight){
			y = element.offsetHeight;
		}
		else if(element.clientHeight){
			y = element.clientHeight;
		}
		return y;
	}