function bodyInit() {
	var inputs = document.getElementsByTagName("input");
	for (var i = 0; i < inputs.length; i++) {
		inputs[i].style.borderColor = "#C0C0C0";

		inputs[i].onmouseover = function() {
			this.style.borderColor = "#000000";
		}
		inputs[i].onmouseout = function() {
			this.style.borderColor = "#C0C0C0";
		}
		inputs[i].onmousedown = function() {
			this.style.borderColor = "#000000";
		}
		inputs[i].onmouseup = function() {
			this.style.borderColor = "#000000";
		}
	}

	var textareas = document.getElementsByTagName("textarea");
	for (var j = 0; j < textareas.length; j++) {
		textareas[j].style.borderColor = "#C0C0C0";

		textareas[j].onmouseover = function() {
			this.style.borderColor = "#000000";
		}
		textareas[j].onmouseout = function() {
			this.style.borderColor = "#C0C0C0";
		}
		textareas[j].onmousedown = function() {
			this.style.borderColor = "#000000";
		}
		textareas[j].onmouseup = function() {
			this.style.borderColor = "#000000";
		}
	}
}

function clearField(form_name, field_name) {
	document.forms[form_name].elements[field_name].value = "";
}

function setChannelBackgroundSimple(theCell, elementID, channelColor, textColor) {
	theCell.style.backgroundColor = channelColor;
	document.getElementById("navtext_" + elementID).style.color = textColor;
}

function getViewportWidth() {
	var viewportwidth;
	
	if (typeof window.innerWidth != 'undefined') {
		viewportwidth = window.innerWidth;
	} else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) {
		viewportwidth = document.documentElement.clientWidth;
	} else {
		viewportwidth = document.getElementsByTagName('body')[0].clientWidth
	}

	return viewportwidth;
}

function getViewportHeight() {
	var viewportheight;
	
	if (typeof window.innerHeight != 'undefined') {
		viewportheight = window.innerHeight;
	} else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientHeight != 'undefined' && document.documentElement.clientHeight != 0) {
		viewportheight = document.documentElement.clientHeight;
	} else {
		viewportheight = document.getElementsByTagName('body')[0].clientHeight
	}

	return viewportheight;
}

function getNormalizedClientHeight() {
	var iHeight = getViewportHeight();
	try {
		if (iHeight >= 1000) {
			return 900;
		} else if (iHeight >= 824) {
			return 724;
		} else if (iHeight >= 568) {
			return 468;
		} else {
			return 300;
		}
	} catch(e) {
		return 300;
	}
}

function getNormalizedClientWidth() {
	var iWidth = getViewportWidth();
	try {
		if (iWidth >= 1400) {
			return 1300;
		} else if (iWidth >= 1080) {
			return 980;
		} else if (iWidth >= 824) {
			return 724;
		} else {
			return 500;
		}
	} catch(e) {
		return 500;
	}
}

