// JavaScript Document
$(document).ready(function(){										 
	$('#headerLeftImage').cycle( { 
		random:1,
		delay: 2000,
		timeout: 8000 
	});
	$("#banner1").cycle({ 
		random:1,
		delay: 4000,		
		timeout: 8000
	});
	$("#banner2").cycle({ 
		random:1,
		delay: 6000,
		timeout: 8000
	});
	$("#banner3").cycle({ 
		random:1,
		delay: 8000,
		timeout: 8000
	});
	
	if ($('#contentLeft').length > 0) {
		height = $('#contentLeft').height();
		$('#contentRight').css('height',height);
	}
});

function filterNewsYear(huidige_maand) {
		window.location.href= '/index.php?module=nieuws&filter_jaar='+document.getElementById('filter_jaar').value+'&filter_maand='+huidige_maand;
}

function filterNewsMonth(huidig_jaar) {
		window.location.href= '/index.php?module=nieuws&filter_jaar='+huidig_jaar+'&filter_maand='+document.getElementById('filter_maand').value;
}


function checkForm(theForm) {
	if (theForm.naam.value=="") { 
		alert("Geen naam opgegeven.");
		theForm.naam.focus();
		return (false);
	} // if
		

	var checkOK = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXY@.-_0123456789";
	var checkStr = theForm.email.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++) {
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length) {
			allValid = false;
			break;
		} // if
	} // for

	if (checkStr.indexOf("@")<3) allValid = false;
	if (checkStr.length-3<checkStr.lastIndexOf(".")) allValid = false;
	if (checkStr.lastIndexOf(".")<checkStr.indexOf("@")) allValid = false;
	if (!allValid) { 
		alert("Geen geldig e-mail adres opgegeven.");
		theForm.email.focus();
		return (false);
	} // if
	
	return (true);
} // checkForm

function checkForm2 (theForm) {
	var checkOK = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXY@.-_0123456789";
	var checkStr = theForm.email.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++) {
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length) {
			allValid = false;
			break;
		} // if
	} // for

	if (checkStr.indexOf("@")<3) allValid = false;
	if (checkStr.length-3<checkStr.lastIndexOf(".")) allValid = false;
	if (checkStr.lastIndexOf(".")<checkStr.indexOf("@")) allValid = false;
	if (!allValid) { 
		alert("Geen geldig e-mail adres opgegeven.");
		theForm.email.focus();
		return (false);
	} // if
	
	return (true);
} // checkForm2

function doSubmit() {
	obj = document.getElementById('nieuwsbrief_submit');
	obj.click();
} // doSubmit

