
  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, sLabel, sClass) {

    sEmail = s1 + '@' + s2 + '.' + s3;
    sLabel = (sLabel == '') ? sEmail : sLabel;
    document.write('<a class="' + sClass + '" href="mailto:' + sEmail + '">' + sLabel + '</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 deletePhoto(sId) {

    if (confirm('Weet je zeker dat je deze foto wilt verwijderen?')) {
      document.form_main.id_main.value = sId;
      document.form_main.action_main.value = 'delete_photo';
      document.form_main.submit();
    }

  }


  function movePhotoUp(iPhotoIndex) {

    document.form_main.photo_index.value = iPhotoIndex;
    document.form_main.action_main.value = 'move_photo_up';
    document.form_main.submit();

  }


  function movePhotoDown(iPhotoIndex) {

    document.form_main.photo_index.value = iPhotoIndex;
    document.form_main.action_main.value = 'move_photo_down';
    document.form_main.submit();

  }

  function deleteVideo(sId) {

    if (confirm('Weet je zeker dat je deze video wilt verwijderen?')) {
      document.form_main.id_main.value = sId;
      document.form_main.action_main.value = 'delete_video';
      document.form_main.submit();
    }

  }

  function openVideoUpload() {

    var sProperties = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no';
    var iWidth      = 785;
    var iHeight     = 557;
    var iLeft       = (screen.availWidth - iWidth) / 2;
    var iTop        = (screen.availHeight - iHeight) / 2;
    var sProperties = 'height=' + iHeight + ',width=' + iWidth + ',top=' + iTop + ',left=' + iLeft + ',' + sProperties;
    var oWin        = window.open('index.php?section=common&module=mijnprofiel&sub=video&action_main=upload', 'video_upload', sProperties);
    oWin.focus();

  }

  function openVideo(sUrl) {

    var sProperties = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no';
    var iWidth      = 433;
    var iHeight     = 562;
    var iLeft       = (screen.availWidth - iWidth) / 2;
    var iTop        = (screen.availHeight - iHeight) / 2;
    var sProperties = 'height=' + iHeight + ',width=' + iWidth + ',top=' + iTop + ',left=' + iLeft + ',' + sProperties;
    var oWin        = window.open(sUrl, 'video', sProperties);
    oWin.focus();

  }

  function openShop(sUrl) {

    var sProperties = 'toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes';
    var iWidth      = screen.availWidth - 200;
    var iHeight     = screen.availHeight - 200;
    var iLeft       = (screen.availWidth - iWidth) / 2;
    var iTop        = (screen.availHeight - iHeight) / 2;
    var sProperties = 'height=' + iHeight + ',width=' + iWidth + ',top=' + iTop + ',left=' + iLeft + ',' + sProperties;
    var oWin        = window.open(sUrl, 'shop', sProperties);
    oWin.focus();

  }

  function openPrijsvraag() {

    var sProperties = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no';
    var iWidth      = 570;
    var iHeight     = 170;
    var iLeft       = (screen.availWidth - iWidth) / 2;
    var iTop        = (screen.availHeight - iHeight) / 2;
    var sProperties = 'height=' + iHeight + ',width=' + iWidth + ',top=' + iTop + ',left=' + iLeft + ',' + sProperties;
    var oWin        = window.open('prijsvraag/index.php', 'prijsvraag', sProperties);
    oWin.focus();

  }

  function openChat(sUrl) {

    var sProperties = 'toolbar=no,location=no,status=yes,menubar=no,scrollbars=no,resizable=yes';
    var iWidth      = screen.availWidth - 200;
    var iHeight     = screen.availHeight - 200;
    var iLeft       = (screen.availWidth - iWidth) / 2;
    var iTop        = (screen.availHeight - iHeight) / 2;
    var sProperties = 'height=' + iHeight + ',width=' + iWidth + ',top=' + iTop + ',left=' + iLeft + ',' + sProperties;
    var oWin        = window.open(sUrl, 'chat', sProperties);
    oWin.focus();

  }


  function moveVideoUp(iVideoIndex) {

    document.form_main.video_index.value = iVideoIndex;
    document.form_main.action_main.value = 'move_video_up';
    document.form_main.submit();

  }


  function moveVideoDown(iVideoIndex) {

    document.form_main.video_index.value = iVideoIndex;
    document.form_main.action_main.value = 'move_video_down';
    document.form_main.submit();

  }


  function deleteDemo(sId) {

    if (confirm('Weet je zeker dat je deze demo wilt verwijderen?')) {
      document.form_main.id_main.value = sId;
      document.form_main.action_main.value = 'delete_demo';
      document.form_main.submit();
    }

  }


  function moveDemoUp(iDemoIndex) {

    document.form_main.demo_index.value = iDemoIndex;
    document.form_main.action_main.value = 'move_demo_up';
    document.form_main.submit();

  }


  function moveDemoDown(iDemoIndex) {

    document.form_main.demo_index.value = iDemoIndex;
    document.form_main.action_main.value = 'move_demo_down';
    document.form_main.submit();

  }

  function openPopup(sUrl) {

    var sProperties = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes';
    var iWidth      = 640;
    var iHeight     = 480;
    var iLeft       = (screen.availWidth - iWidth) / 2;
    var iTop        = (screen.availHeight - iHeight) / 2;
    var sProperties = 'height=' + iHeight + ',width=' + iWidth + ',top=' + iTop + ',left=' + iLeft + ',' + sProperties;
    var oWin        = window.open(sUrl, 'popup', sProperties);
    oWin.focus();

  }


  function openDemo(sDemoId, bVote) {

    var sProperties = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no';
    var iWidth      = 285;
    var iHeight     = bVote ? 260 : 180;
    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        = bVote ? 'index.php?section=common&module=demo&demo_id=' + sDemoId : 'index.php?section=common&module=demo&sub=player&demo_id=' + sDemoId;
    var oWin        = window.open(sUrl, 'demo', sProperties);
    oWin.focus();

  }


  function deleteAccount() {

    if (confirm('Weet je zeker dat je je registratie wilt beëindigen?')) {
      document.form_main.action_main.value = 'delete_account';
      document.form_main.submit();
    }

  }


  function deleteProfiel() {

    if (confirm('Weet je zeker dat je je profiel wilt verwijderen?\nJe foto\'s en eventuele demo\'s worden niet verwijderd.')) {
      document.form_main.action_main.value = 'delete_profiel';
      document.form_main.submit();
    }

  }


  function deleteTopic(sTopicId) {

    if (confirm('Weet je zeker dat je deze topic wilt verwijderen?')) {
      document.dg_data_form.action_main.value = 'delete_topic';
      document.dg_data_form.id_main.value = sTopicId;
      document.dg_data_form.submit();
    }

  }


  function editPost(sPostId) {

    document.dg_topic_form.action_main.value = 'edit_post';
    document.dg_topic_form.id_main.value = sPostId;
    document.dg_topic_form.action = 'index.php?section=forum&module=editpost&post_id=' + sPostId;
    document.dg_topic_form.submit();

  }


  function deletePost(sPostId) {

    document.dg_topic_form.action_main.value = 'delete_post';
    document.dg_topic_form.id_main.value = sPostId;
    document.dg_topic_form.submit();

  }

  function editReactie(sReactieId) {

    document.form_reacties.action_reactie.value = 'edit_reactie';
    document.form_reacties.id_reactie.value = sReactieId;
    document.form_reacties.submit();

  }


  function deleteReactie(sReactieId) {

    document.form_reacties.action_reactie.value = 'delete_reactie';
    document.form_reacties.id_reactie.value = sReactieId;
    document.form_reacties.submit();

  }


  function addNieuws() {

    document.dg_nieuws_form.action_main.value = 'add_nieuws';
    document.dg_nieuws_form.action = 'index.php?section=nieuws&module=artikel';
    document.dg_nieuws_form.submit();

  }


  function editNieuws(sNieuwsId) {

    document.dg_nieuws_form.action_main.value = 'edit_nieuws';
    document.dg_nieuws_form.id_main.value = sNieuwsId;
    document.dg_nieuws_form.action = 'index.php?section=nieuws&module=artikel';
    document.dg_nieuws_form.submit();

  }


  function deleteNieuws(sNieuwsId) {

    document.dg_nieuws_form.action_main.value = 'delete_nieuws';
    document.dg_nieuws_form.id_main.value = sNieuwsId;
    document.dg_nieuws_form.action = 'index.php?section=nieuws';
    document.dg_nieuws_form.submit();

  }

  function highlight_menubutton(sKey, b) {

    var oImage = document.getElementById('menubutton_' + sKey);
    var sImageNew = b ? 'images/menubutton_' + sKey + '.gif' : 'images/menubutton_' + sKey + '_over.gif';
    oImage.src = sImageNew;

  }
  
  function toggleSafariMessage() {

    var oDiv = document.getElementById('safari_message');
    if(oDiv.style.display == 'none') {
      oDiv.style.display = '';
    } else {
      oDiv.style.display = 'none';
    }

  }
  
  function do_step(step_to_show) {
  
  	document.getElementById('step1').style.display = 'none';
  	document.getElementById('step2').style.display = 'none';  	
  	document.getElementById('step3').style.display = 'none';  	
  	document.getElementById(step_to_show).style.display = 'block';
  
  }