
	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 findObjectSize(obj) {
        x = obj.offsetWidth; y = obj.offsetHeight;
        return [x,y];
    }

	function findObjectPosition(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;
	}

	function imagescroll()
        {
                zimage = document.getElementById("scrollimage");

//              zimageheight = zimage.height;
//              zframeheight = 281;
                zimageheight = zimage.width;
                zframeheight = 360;

                if(zimageheight > zframeheight)
                {
                        zdifference = zimageheight - zframeheight;

                        zstartdelay = 20;
                        zmaxdelay = 30;

                        for(zi=0;zi<=zdifference;zi++)
                        {
                                zp = zi/zdifference;
                                zdelay = zstartdelay + zp * (zmaxdelay - zstartdelay);
                                setTimeout('imagescroll_setpos(\'scrollimage\','+zi+')',zi*zdelay);
                        }

                }
        }

        function imagescroll_setpos(zid,zpos)
        {
                document.getElementById(zid).style.left = "-"+zpos+"px"
        }

	function arrowFunc1() {
		document.getElementById("previous").src = "/images/previousover.gif";
	}

	function arrowFunc2() {
		document.getElementById("next").src = "/images/nextover.gif";
	}

	function arrowFunc3() {
		document.getElementById("previous").src = "/images/previous.gif";
	}

	function arrowFunc4() {
		document.getElementById("next").src = "/images/next.gif";
	}

function checkFooter() {

		windowwidth = window.innerWidth;
		pagewidth = document.getElementById("pagewrapper").offsetWidth;
		footerwidth = document.getElementById("footerwrapper").offsetWidth;

		if (!windowwidth) { 
			windowwidth = document.documentElement.clientWidth;
		}

		if (!windowwidth || windowwidth == 0) { 
			windowwidth = document.body.clientWidth;
			pagewidth = document.getElementById("pagewrapper").offsetWidth;
		}

		if(windowwidth > 790) {
			document.getElementById("pagewrapper").style.borderLeft = "10px solid #fff";
			document.getElementById("pagewrapper").style.borderRight = "10px solid #fff";
		} else if(windowwidth > 780) {
			document.getElementById("pagewrapper").style.borderLeft = "5px solid #fff";
			document.getElementById("pagewrapper").style.borderRight = "5px solid #fff";
		} else if(windowwidth < 780) {
			document.getElementById("pagewrapper").style.borderLeft = "0px solid #fff";
			document.getElementById("pagewrapper").style.borderRight = "0px solid #fff";
		}


}




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

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



// STORE REQUIRED ACTIONS IN VARIABLE //

var W3CDOM = (document.getElementsByTagName);

function bannerinit() {

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

	var slides1 = document.getElementById("banner");
	var slides2 = document.getElementById("banner2");

	slides2.innerHTML = slides1.innerHTML;

	var scrollbar = document.getElementById("bannerwrapper");
	maxwidth = scrollbar.offsetWidth;

	slides1width = slides1.offsetWidth;
	slides2width = slides2.offsetWidth;


	slides1.style.right = - 91 + "px";
	slides2.style.right = - (slides1width + 91)  + "px";

	move(- 91,- (slides1width + 91),slides1,slides2);

	function move(pos1,pos2,obj1,obj2) {

		val1 = pos1 + 1;
		val2 = pos2 + 1;

		if(val1 > maxwidth) {
			val1 = - (slides1width + 70);
		}

		if(val2 > maxwidth) {
			val2 = - (slides1width + 70);
		}

		obj1.style.right = val1 + "px";
		obj2.style.right = val2 + "px";

		setTimeout( function () { move(val1,val2,obj1,obj2) } ,40);

	}
}
