// JavaScript Document
var openImageWindow=null;
function openimage(naam) {
	
	openImageWindow=window.open("showimage.php?pic="+naam,"openImageWindow","width=500, height=500, resize=yes, scrollbar=yes");
	openImageWindow.focus();
}
function getElementLeft(Elem) {

		var elem;
		if(document.getElementById) {
			var elem = document.getElementById(Elem);
		} else if (document.all){
			var elem = document.all[Elem];
		}
		xPos = elem.offsetLeft;
		tempEl = elem.offsetParent;
  		while (tempEl != null) {
  			xPos += tempEl.offsetLeft;
	  		tempEl = tempEl.offsetParent;
  		}
		return xPos;

}


function getElementTop(Elem) {

		if(document.getElementById) {	
			var elem = document.getElementById(Elem);
		} else if (document.all) {
			var elem = document.all[Elem];
		}
		yPos = elem.offsetTop;
		tempEl = elem.offsetParent;
		while (tempEl != null) {
  			yPos += tempEl.offsetTop;
	  		tempEl = tempEl.offsetParent;
  		}
		return yPos;

}

function show_contactdiv() {
	var divX=getElementLeft('container')+325;
	var divY=154;//getElementTop('container');
	document.getElementById('contactpopup').style.left=divX+"px";	
	document.getElementById('contactpopup').style.top=divY+"px";
	document.getElementById('contactpopup').style.display="block";
}

function sluit_contactdiv() {
	document.getElementById('contactpopup').style.display="none";
}

/*function check_contactdiv(f){
	if ((f.naam.value == "") || (f.naam.value <= 0))
		{
		alert("Graag uw naam invullen");
		f.naam.value = "";
		f.naam.focus();
		return (false);
		}
	if ((f.telefoon.value == "") || (f.telefoon.value <= 0))
		{
		alert("graag uw telefoonnummer invullen");
		f.telefoon.value = "";
		f.telefoon.focus();
		return (false);
		}
  if ((f.email.value == "") || (f.email.value <= 0))
		{
		alert("graag een e-mail adres invullen");
		f.email.value = "";
		f.email.focus();
		return (false);
		}
	return true;
}*/

function isGoedeEmail(str){
  	var validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
    
    if (str.search(validRegExp) == -1) 
   {
      return false;
    }else return true; 
}

function isGoedeTelefoon(str){
  	var validRegExp = /[0-9]/i;
    
    if (str.search(validRegExp) == -1 || str.length<10 || str.length>15) 
   {
      return false;
    } else  return true; 
}



function check_contactdiv(deform){

	var naam=deform.naam.value;
	
	var telefoon=deform.telefoon.value;
	var email=deform.email.value;
	
  if (naam == "" || naam <= 0 || naam.indexOf('http')>=0  || naam.indexOf('www.')>=0)
  {
    alert("Graag uw naam invullen");
    deform.naam.value = "";
    deform.naam.focus();
    return false;
  }
  if (!isGoedeTelefoon(telefoon))
  {
    alert("graag uw telefoonnummer invullen\nminstens bestaand uit 10 cijfers");
    deform.telefoon.value = "";
    deform.telefoon.focus();
    return false;
  }
  if (!isGoedeEmail(email))
  {
    alert("graag een geldig e-mail adres invullen");
    deform.email.value = "";
    deform.email.focus();
    return false;
  }
  /*if ((deform.soortevenement.value == "") || (deform.soortevenement.value <= 0))
  {
    alert("graag het soort evenement aangeven");
    deform.soortevenement.value = "";
    deform.soortevenement.focus();
    return (false);
  }*/
  return true;
}

