if (document.observe) document.observe("dom:loaded", function() {
  
});


function nextTip() {
  alert('non use!');
}


function addClass(obj, cName) { if (obj&&cName&&!hasClass(obj, cName)) { obj.className += " "+cName; } }
function removeClass(obj, cName) { if (obj&&cName) { if (obj.className==obj.className.replace(" ","-")) { obj.className=obj.className.replace(cName, ""); } else { obj.className=obj.className.replace(" "+cName, ""); } } }
function hasClass(obj, cName) { if (obj&&cName) { if (obj.className == obj.className.replace(cName,"")) { return false; } return true; } }

function chkReistype(frm) {
  var type;
  for (i=0; i<frm.type.length; i++) {
    if (frm.type[i].checked) {
      type = frm.type[i].value;
    }
  }
  var retour_van = frm.naar2;
  var terugreis  = frm.tot_datum;
  if (hasClass(retour_van, 'validate')) {
    removeClass(retour_van, 'validate');
  }
  if (hasClass(terugreis, 'validate')) {
    removeClass(terugreis, 'validate');
  }
  if (type=='openjaw') {
    accordion_naar2.openAll();
    accordion_terugreis.openAll();
    addClass(retour_van, 'validate');
    addClass(terugreis, 'validate');
  } else if (type=='enkel') {
    accordion_naar2.closeAll();
    accordion_terugreis.closeAll();
  } else if (type=='retour') {
    accordion_naar2.closeAll();
    accordion_terugreis.openAll();
    addClass(terugreis, 'validate');
  }
}

function chkDate(frm) {
  var chkvan = frm.van_datum.value;
  var chktot = frm.tot_datum.value;
  var lengthvan, lengthtot;

  chkvan = chkvan.replace(/-/g,'');
  chktot = chktot.replace(/-/g,'');

  if (chkvan.length<=8&&chkvan.length>=6) {
    lengthvan = true;
  }
  if (chktot.length<=8&&chktot.length>=6) {
    lengthtot = true;
  }

  if ((chkvan&&(parseInt( chkvan )=="NaN"||!lengthvan))||(chktot&&(parseInt( chktot )=="NaN"||!lengthtot))) {
    if (chkvan&&(parseInt( chkvan )=="NaN"||!lengthvan)) {
      frm.van_datum.value='';
      alert('Er is geen geldige heenreis datum ingevoerd.');
    }
    if (chktot&&(parseInt( chktot )=="NaN"||!lengthtot)) {
      frm.tot_datum.value='';
      alert('Er is geen geldige terugreis datum ingevoerd.');
    }
    return;
  }
}




