function $(elem) {
	return document.getElementById(elem);
}

function screenPropertys() {
	var width = 0;
	var height = 0;

	if (window.innerWidth){
		width = window.innerWidth;
		height = window.innerHeight;
	} else {
		width =  document.body.clientWidth;
		height =  document.body.clientHeight;
	}

	// settings of main div
	var mainDiv = $("main");
	var mainLeft = (width - 1000) / 2;
	mainDiv.style.left = (mainLeft > 12 ? mainLeft : 0) + "px";
	// End setting of mainDiv
}

function swapDivs() {
	$("content_bijdrage_body").style.display = "none";
	$("content_bijdrage_form").style.display = "block";
}

function charsLeft(txt) {
	var charsLeft = $("charsLeft");
	charsLeft.innerHTML = parseInt(200 - txt.value.length, 10);
}

function checkForm (formname)
{
	var form = document.forms[0];
	var message = "";
	//START
	
	for (var i = 0; i < form.childNodes.length; i++) {
		var node = form.childNodes[i];
		//alert(node.tagName)
		if (node.tagName == "INPUT" || node.tagName == "SELECT") {
			if (node.value == "") {
				node.style.background = "#ABCDEF";
				message = "don't leave any fields blank";
			}
		}
	}
	
	if (message != "") {
		alert(message);
		return false;
	} else {
		form.submit();
	}
	
}
