/* SET ALL component-heading BACKGROUND IMAGES */
function setComponentHeadings(mediaUrl) {
	divs=document.getElementsByTagName('div');
	for( var i = 0; i < divs.length; ++i ) {
	  if (divs[i].className == 'component-heading') {
	    divs[i].style.backgroundImage="url('" + mediaUrl + "/img/headings/"+divs[i].id+".png')";
	    divs[i].title=divs[i].id;
	  }
	}
}


/* newsletter-form 

submitButton = document.getElementById('newsletter-submit-button');

function deactivateButton(btn) {
	btn=document.getElementById(btn);
	// style
	btn.className ="link-inactive";
	// onclick
	btn.onclick="";
	//alert('deactivated button: ' +btn);
}

function activateButton(btn) {
	btn=document.getElementById(btn);
	// style
	btn.className ="link-active";
	// onclick
	btn.onclick= new Function ("submitForm('newsletter-form');")
	//alert('activated button: ' +btn);

}


function submitNewsletter(theForm){
	theForm = document.getElementById(theForm);
	if(validateNewsletter(theForm)) { return (true);}
	return (false);
}

*/

function validateNewsletter(theForm) {
	//alert('in here');
	if(!theForm.naam.value) {
		//deactivateButton('newsletter-submit-button');
		alert('please enter your name');
		theForm.naam.focus();
		return (false);
	}
	var x = theForm.email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(x)) {
		//deactivateButton('newsletter-submit-button');
		alert('please enter a valid email address');
		theForm.naam.focus();
		return (false);
	}
	//alert('very nice');
	//activateButton('newsletter-submit-button');
	return (true);
}

function submitForm(form_id) {
	theForm = document.getElementById(form_id);
	if (validateNewsletter(theForm)) {
		theForm.submit();
	}
}

