function getViewportHeight(){
	var height=0;

	if (self.innerHeight)// all except IE
		height = self.innerHeight;
	else if (document.documentElement && document.documentElement.clientHeight) // IE 6 Strict Mode
		height = document.documentElement.clientHeight;
	else if (document.body) // other IE's
		height = document.body.clientHeight;
	return height;
}

function getViewportWidth(){
	var width=0;

	if (self.innerWidth)// all except IE
		width = self.innerWidth;
	else if (document.documentElement && document.documentElement.clientWidth) // IE 6 Strict Mode
		width = document.documentElement.clientWidth;
	else if (document.body) // other IE's
		width = document.body.clientWidth;
	return width;
}

function getElementHeight(id){
	return document.getElementById(id).offsetHeight;
}

function getElementWidth(id){
	return document.getElementById(id).offsetWidth;
}

function getElementYPos(id){
	var obj = document.getElementById(id);
	var curtop = 0;
	if (obj.offsetParent){
		while (obj.offsetParent){
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function setElementYPos(id, top){
	return document.getElementById(id).style.top = top + "px";
}

function setFooterPos(){
	minYPos = (getViewportHeight() - getElementHeight("footerBox"));
	footerPos = getElementYPos("footerBox");
	
	if(footerPos < minYPos)
		setElementYPos("footerBox", minYPos - footerPos);
}

function adjustHomeage(){
	if(getViewportWidth() < 977){
		setStyleByClass("ul", "pos_tablist", "margin-left", "0em");
		setStyleByClass("div", "pos_home", "padding-left", "0em");
		setStyleByClass("div", "pos_tabnavigatie", "padding-left", "0em");
		setStyleByClass("div", "pos_tekst", "width", "30em");
		setStyleByClass("div", "pos_tekst", "padding-left", "2.4em");
		setStyleByClass("div", "pos_home", "background-position", "-191px");
	}
	else {
		setStyleByClass("ul", "pos_tablist", "margin-left", (document.all) ? "11.1em" : "8.6em");
		setStyleByClass("div", "pos_home", "padding-left", (document.all) ? "10.4em" : "10em");
		setStyleByClass("div", "pos_tabnavigatie", "padding-left", "0em");
		setStyleByClass("div", "pos_tekst", "padding-left", "0.2em");
		setStyleByClass("div", "pos_tekst", "width", "35em");
		setStyleByClass("div", "pos_home", "background-position", "0px");
	}

	setStyleByClass("div", "pos_homebottom", "padding-top", "0em");
	setStyleByClass("div", "pos_homebottom", "padding-bottom", "0em");
	setStyleByClass("div", "pos_homebottom", "position", "relative");
	
	setFooterPos();
}

// setStyleByClass:
//  t - tagName
//  c - className
//  p - CSS property
//  v - CSS value
function setStyleByClass(t,c,p,v){
	var elements;
	if(t == '*') {
		// '*' not supported by IE/Win 5.5 and below
		elements = (document.all) ? document.all : document.getElementsByTagName('*');
	} else {
		elements = document.getElementsByTagName(t);
	}
	for(var i = 0; i < elements.length; i++){
		var node = elements.item(i);
		for(var j = 0; j < node.attributes.length; j++) {
			if(node.attributes.item(j).nodeName == 'class') {
				if(node.attributes.item(j).nodeValue.indexOf(c) != -1) {
					if(p.indexOf("-")!=-1)
						p = p.substr(0,p.indexOf("-")) + p.substr(p.indexOf("-")+1,1).toUpperCase() + p.substr(p.indexOf("-")+2,p.length);
					eval('node.style.' + p + " = '" +v + "'");
				}
			}
		}
	}
}