//  --------------------------------------------  //
//  Website         :  www.discotheek-lasvegas.nl //
//  Design          :              Vincent Meens  //
//  Development     :              Mark Gloaguen  //
//  --------------------------------------------  //

function openWindow(url, venster, hoogte, breedte) {
  LeftPosition = (screen.width) ? (screen.width-breedte)/2 : 0;
  TopPosition = (screen.height) ? (screen.height-hoogte)/2 : 0;
  settings ='height='+hoogte+',width='+breedte+',top='+TopPosition+',left='+LeftPosition+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes'
  popup = window.open(url, venster, settings);
  popup.focus();
}

function showConfirmation(action){
  return confirm('Weet u dit zeker?');
}

function checkEmail(item){
  valid = new RegExp("^[a-z]+([.]?[a-z0-9_-]+)*[@]([a-z0-9_-]+[.])+([a-z]{2,4})$").exec(document.subform.elements[item].value);
  if(!valid) { 
     alert('Het e-mailadres is incorrect!');
     return false;
  }
  else{
    return true;
  }
}

function showAlert(item, name){
  if (document.subform.elements[item].value == ""){
    alert('Het veld \'' + name + '\' is leeg!');
    document.subform.elements[item].focus();
    return false;
  }
  else{
    return true;
  }
}

function addMember(){
  return(showAlert('email','E-mail') && checkEmail('email') && showConfirmation());
}

function startSearch(){
  return(showAlert('search_string','Zoekwoord'));
}