function popup(location,name,w,h) {
	var scrw=(screen.width/6)-(w/6);
	var scrh=(screen.height/6)-(h/6);
	window.open(location,name,('toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,copyhistory=0,left='+scrw+',top='+scrh+',width='+w+',height='+h));
}

function isInt(str)
{
  var strValidChars = "1234567890";
  var strChar;
  var bin = true;
  
  if(str.lenght==0)
    return false;
    
  for(i=0; i<str.length && bin==true; i++)
  {
    strChar = str.charAt(i);
    if(strValidChars.indexOf(strChar)==-1)
    {
      bin = false;
    }
  }
  return bin;
}

function addleden(frm)
{
  if(frm.form.gebruikeraan.value>0 && document.getElementById('numberPersons'))
  {
    number = prompt('Aantal personen die mee gaan','');
    if(number)
    {
      if(isInt(number))
      {
        document.getElementById('numberPersons').value = number;
        frm.form.submit();
      }
      else
      {
        alert("Aantal personen is geen nummer.");
      }
    }
    else
    {
      frm.form.gebruikeraan.value=0;
    }
  }
}

function Verplicht(formulierVeld,soort) {

if (soort == 1) { var verplichtVeld = Array("naam", "plaats", "organisator[]", "begindag", "beginmaand", "beginjaar", "einddag", "eindmaand", "eindjaar"); }
else if (soort == 2) { var verplichtVeld = Array("foto", "omschrijving"); }
else if (soort == 3) { var verplichtVeld = Array("omschrijving"); }
else if (soort == 4) { var verplichtVeld = Array("type", "naam", "omschrijving"); }
else if (soort == 5) { var verplichtVeld = Array("titel"); }
else if (soort == 6) { var verplichtVeld = Array("titel", "omschrijving"); }
else if (soort == 7) { var verplichtVeld = Array("name", "website", "text"); }
else if (soort == 8) { var verplichtVeld = Array("titel", "omschrijving", "naam", "email"); }
else if (soort == 9) { var verplichtVeld = Array("banner", "naam", "actief", "website"); }
else if (soort == 10) { var verplichtVeld = Array("naam", "actief", "website"); }
else if (soort == 11) { var verplichtVeld = Array("voornaam", "achternaam", "email"); }
else { var verplichtVeld = Array("omschrijvinggg"); }

var alertBoodschap = "Gelieve alle velden met een * in te vullen";
var alertLength = "alert";
var Boodschap = alertLength.length;
for (var i = 0; i < verplichtVeld.length; i++){var obj = formulierVeld.elements[verplichtVeld[i]];if (obj){switch(obj.type) {
case "select-one": if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == "") { alertLength += "-\n"; } break;
case "select-multiple": if (obj.selectedIndex == -1){ alertLength += " -\n"; } break;
case "text":case "textarea": if (obj.value == "" || obj.value == null){ alertLength += " - \n";} break;
default: if (obj.value == "" || obj.value == null){ alertLength += " - \n";}}}}
if (alertLength.length == Boodschap){ return true; } else { alert(alertBoodschap);return false; }
}