
  function isEmpty(oText) {

    s = oText.value;
    if (s.length==0) return true;
    for (var i=0; i<s.length; i++) {
      bIsSpace          = (s.charAt(i) == ' ');
      bIsNewline        = (s.charAt(i).charCodeAt(0) == 10);
      bIsCarriageReturn = (s.charAt(i).charCodeAt(0) == 13);
      if ((!bIsSpace) && (!bIsNewline) && (!bIsCarriageReturn)) return false;
    }
    oText.value = '';
    return true;

  }


  function isEmail(oText) {

  	s = oText.value;
  	var email=/^[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*@[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*\.([A-Za-z]){2,4}$/i;
  	return(email.test(s));

  }


  function isInteger(oText) {

  	s = oText.value;
  	var integer=/(^-?\d\d*$)/;
  	return(integer.test(s));

  }


  function getEmail(s1, s2, s3, sClass) {

    sEmail = s1 + '@' + s2 + '.' + s3;
    document.write('<a class="' + sClass + '" href="mailto:' + sEmail + '">' + sEmail + '</a>');

  }


  function showElement(sId) {

    var o = document.getElementById(sId);
    o.style.display = '';
    return true;

  }


  function hideElement(sId) {

    var o = document.getElementById(sId);
    o.style.display = 'none';
    return true;

  }


  function openImage(sName, iWidth, iHeight) {

    var sProperties = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no';
    var iLeft       = (screen.availWidth - iWidth) / 2;
    var iTop        = (screen.availHeight - iHeight) / 2;
    var sProperties = 'height=' + iHeight + ',width=' + iWidth + ',top=' + iTop + ',left=' + iLeft + ',' + sProperties;
    var sUrl        = 'index.php?section=common&module=image&name=' + sName + '&width=' + iWidth + '&height=' + iHeight;
    var oWin        = window.open(sUrl, 'image', sProperties);
    oWin.focus();

  }


  // =====================
  // Opens slideshow popup
  // =====================

  function openSlideShow(sFolder) {
    
    var sProperties = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=auto,resizable=no';
    var iWidth      = 520;
    var iHeight     = 570;
    var iLeft       = (screen.availWidth - iWidth) / 2;
    var iTop        = (screen.availHeight - iHeight) / 2;
    var sProperties = 'height=' + iHeight + ',width=' + iWidth + ',top=' + iTop + ',left=' + iLeft + ',' + sProperties;
    var sUrl        = 'index.php?section=common&module=slideshow&folder=' + sFolder;
    var oWin        = window.open(sUrl, 'slideshow', sProperties);
    oWin.focus();
    
  }
  
  
  // ================================
  // Validates the contact form input
  // ================================

  function validateContact() {

    with (document.form_contact) {
      if (isEmpty(naam)) {
        alert('Vul s.v.p. uw naam in.')
        naam.focus();
        return false;
      } else if (isEmpty(email)) {
        alert('Vul s.v.p. uw e-mail adres in.')
        email.focus();
        return false;
      } else if (!isEmail(email)) {
        alert('Vul s.v.p. een geldig e-mail adres in.')
        email.focus();
        return false;
      } else if (isEmpty(bericht)) {
        alert('Vul s.v.p. uw bericht in.')
        bericht.focus();
        return false;
      }
      return true;
    } 
  
  }