function checkFooter() {

		windowheight = window.innerHeight;
		pageheight = document.getElementById("pagewrapper").offsetHeight;
		footerheight = document.getElementById("footerwrapper").offsetHeight;

		if (!windowheight) { 
			windowheight = document.documentElement.clientHeight;
		}

		if (!windowheight || windowheight == 0) { 
			windowheight = document.body.clientHeight;
			pageheight = document.getElementById("pagewrapper").offsetHeight;
		}

		difference = windowheight - pageheight;

		if(difference > 0) {
			pageheight = pageheight - footerheight;
			document.getElementById('pagewrapper').style.height = pageheight + difference + "px";
		} else if (difference < 0) {
			pageheight = pageheight - footerheight;
			if((pageheight + difference) > 650) {
				document.getElementById('pagewrapper').style.height = pageheight + difference + "px";
			}
		}

}


// STORE REQUIRED ACTIONS IN VARIABLE //

var W3CDOM = (document.getElementsByTagName);

function init() {

	// IF ACTIONS ARE NOT SUPPORTED STOP SCRIPT //
	if (!W3CDOM) return;

	var menu = document.getElementById('menu');

	if(menu) {

		var ptags = menu.getElementsByTagName('p');

		for (var i=0;i<ptags.length;i++) {

			if(ptags[i].className == "nav") {

				ptags[i].onmouseover = mousegoesover;
				ptags[i].onmouseout = mousegoesout;

			}

		}

	}

}


function mousegoesover() {
	this.className = "over";
	this.style.cursor = "pointer";
}

function mousegoesout() {
	this.className = "nav";
}




	function addEvent(obj,type,func) {
		if (obj.addEventListener) { obj.addEventListener(type,func,false); return true; }
		if (obj.attachEvent) { return obj.attachEvent("on"+type,func); }
		return false;
	}

	function removeEvent(obj,type,func) {
		if (obj.removeEventListener) { obj.removeEventListener(type,func,false); return true; }
		if (obj.detachEvent) { return obj.detachEvent("on"+type,func); }
		return false;
	}

	function findEvent(e) {
		if (!e) var e = window.event;
		return e;
	}
			
	function findTarget(e) {
		if (e.target) t = e.target;
		else if (e.srcElement) t = e.srcElement;
		while (t.nodeType != 1) {
			t = t.parentNode;
		}
		return t;
	}

	function findPos(obj) {
		var x = y = 0;
		if (obj.offsetParent) {
			x = obj.offsetLeft;
			y = obj.offsetTop;
			while (obj = obj.offsetParent) {
				x += obj.offsetLeft
				y += obj.offsetTop
			}
		}
		return [x,y];
	}

	function findViewportSize() {
		var x = y = 0;
		if (self.innerHeight) { // if !ie
			x = self.innerWidth;
			y = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // if ie6 strict
			x = document.documentElement.clientWidth;
			y = document.documentElement.clientHeight;
		} else if (document.body) { // all other ie
			x = document.body.clientWidth;
			y = document.body.clientHeight;
		}
		return [x,y];
	}

	function findPageSize() {
		var x = y = 0;
		var test1 = document.body.scrollHeight;
		var test2 = document.body.offsetHeight
		if (test1 > test2) { // if !ie mac
			x = document.body.scrollWidth;
			y = document.body.scrollHeight;
		} else { // if ie mac
			x = document.body.offsetWidth;
			y = document.body.offsetHeight;
		}
		return [x,y];
	}

	function findPageOffset() {
		var x = y = 0;
		if (self.pageYOffset) { // if !ie 
			x = self.pageXOffset;
			y = self.pageYOffset;
		} else if (document.documentElement && document.documentElement.scrollTop) { // if ie6 strict
			x = document.documentElement.scrollLeft;
			y = document.documentElement.scrollTop;
		} else if (document.body) { // all other ie
			x = document.body.scrollLeft;
			y = document.body.scrollTop;
		}
		return [x,y];
	}

	function findMousePos(e)
	{
		var x = y = 0;
		if (e.pageX || e.pageY) {
			x = e.pageX;
			y = e.pageY;
		} else if (e.clientX || e.clientY) 	{
			x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
			y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
		}
		return [x,y];
	}

	function vector() {
		this.x = 0; this.y = 0; this.z = 0;
	}

	function addClass(object,classname) {
		object.className += " "+classname;
	}

	function checkClass(object,classname) {
		classes = object.className.split(' ');
		var i;
		for (i=0;i<classes.length;i++) {
			if (classes[i] == classname) return true;
		}
		return false;
	}

	function removeClass(object,classname)
	{
		classes = object.className.split(' ');
		var i; var newclass = "";
		for (i=0;i<classes.length;i++) {
			if (classes[i] != classname) newclass += " "+classes[i];
		}
		object.className = newclass;
	}
