function swapImage(target, imageName){
	
	//var path = "http://www.pietr.nl/sp/images/";
	var path = "/images/";
	document.getElementById(target).src = path + imageName; 
	

}




var newwin;

function launchwin(winurl,winname,winfeatures)
{
//This launches a new window and then
//focuses it if window.focus() is supported.
newwin = window.open(winurl,winname,winfeatures);
if(javascript_version > 1.0)
{
//delay a bit here because IE4 encounters errors
//when trying to focus a recently opened window
setTimeout('newwin.focus();',250);
}
}
	


function goPage(url) { 
  	window.location = url;
}


function validateMail(adress){
	if(adress == "")  return "E-mail"; 
	else if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(adress))){
		return false;
	}	
	else{
		return true;
	}
}


function contactForm(){
	var errors = new Array();
	var path = document.forms[0];
	
	if(path.name.value == "")	 		errors.push("naam"); 		
	if(path.subject.value == "")			errors.push("onderwerp"); 	
	if(path.email.value == "")			errors.push("email"); 	
	if(!validateMail(path.email.value))	errors.push("ongeldige email"); 	
	if(path.message.value == "")			errors.push("bericht"); 

	
	if(errors.length > 0){
		var message = "Formulier kon niet worden verzonden.\nDe volgende informatie ontbreekt nog:\n";
		for(var i = 0; i<errors.length; i++){
			message = message + "- " + errors[i] + "\n";
		}
	   alert(message);
	}
	else{
		path.submit();
	} 
}



