﻿// JScript File
function submitform()
{
  document.aspnetForm.submit();
}

function setmessage(message) {
    document.validatemessage = message;
}

function openradwindow(windowname,url) {
    var oManager = GetRadWindowManager();
    var oWnd = oManager.GetWindowByName(windowname);
    oWnd.SetUrl(url);
    oWnd.Show();
}

function closeradwindows() {
    alert('jo');
    var oManager = GetRadWindowManager();
    oManager.CloseAll();
}

function GetRadWindowFromItself()
{
    var oWindow = null;
    if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
    else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;//IE (and Moz az well)
    return oWindow;
}


function CloseRadWindowFromItself()
{
    GetRadWindowFromItself().Close();
}

function RefreshParentPageFromRadWindow()
{
    GetRadWindowFromItself().BrowserWindow.location.reload();
}

function Juice_validateForm() { //v4.0
  if (document.validatemessage==undefined) 
    document.validatemessage = 'Er zijn problemen gevonden, vult u de gekleurde velden a.u.b. correct in.';
  var kleur = 'DDDDDD';
  if (document.veldkleur!=undefined)
    kleur = document.veldkleur;
  var i,p,q,nm,test,num,min,max,errors='',args=Juice_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) {MM_findObj(nm).style.background=kleur; MM_findObj(nm).value='geen geldig e-mail adres'; errors+='- '+nm+' bevat geen geldig e-mail adres.\n';}
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') {MM_findObj(nm).style.background=kleur; errors += '- '+nm+' is niet ingevuld.\n';} }
  } if (errors) {
    if (document.validatemessage!='niettonen')
       alert(document.validatemessage);
      }
  document.validatemessage = 'Er zijn problemen gevonden, vult u de gekleurde velden a.u.b. correct in.';
  document.MM_returnValue = (errors == '');
}

function Juice_SelecteerVeld(veld) {
    veld.style.background='FFFFFF';
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers2() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers2.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'':(v=='hide')?'none':v; }
    obj.display=v; }
}

///////////////////////
//Van oude website:
///////////////////////

function personenupdate2(aantal) {
    if (aantal<=100 && aantal>0) {
    tekst='<br><TABLE><TR ALIGN="LEFT" VALIGN="TOP"><TD></TD><TD>Geslacht</TD><TD>Initialen</TD><TD>Tussenvoegsels</TD><TD>Achternaam</TD></TR>';
    for (i=1; i<=aantal; i++) {
      tekst = tekst + '<TR ALIGN="LEFT" VALIGN="TOP"><TD>' + i + ':</TD><TD><select name="geslacht' + i + '" style="width:85px;"><option value="man">Man</option><option value="vrouw">Vrouw</option></select></TD><TD valign="top"><input type="text" SIZE="4" name="initialen' + i + '" value="" onActivate="Juice_SelecteerVeld(this);" style="width:65px;"></TD><TD valign="top"><input type="text" SIZE="4" name="tussenv' + i + '" value=""  style="width:85px;"></TD><TD valign="top"><input type="text" SIZE="16" name="achternaam' + i + '" value="" onActivate="Juice_SelecteerVeld(this);">';
      if (i==1) {tekst=tekst + ' *'}
      tekst = tekst + '</TD></TR>';
	}
	tekst = tekst + '</TABLE><br>- Gegevens invullen zoals vermeld in het paspoort<br>- Wij gaan ervan uit dat de eerst ingevulde naam de contactpersoon is';
    personentabel.innerHTML=tekst;
	}
	else {alert('Aantal reizigers moet een getal zijn tussen 1 en 100!');}
}

function checkpostcode(txt) {
  if (txt.length==4) {
       document.getElementById('postcodeletters').focus();
	}
}

function checkpostcode2(txt) {
  if (txt.length==2) {
       document.getElementById('woonplaats').focus();
	}
}

function selectland() {
   document.getElementById('anderland').innerHTML = '';
   if (document.getElementById('land').options[document.getElementById('land').selectedIndex].value=='Nederland') {
     document.getElementById('telland').value = '+31';
     document.getElementById('faxland').value = '+31';
	 }
   else if (document.getElementById('land').options[document.getElementById('land').selectedIndex].value=='België') {
     document.getElementById('telland').value = '+32';
     document.getElementById('faxland').value = '+32';
	 }
   else {
     document.getElementById('anderland').innerHTML = '<input type=""anderland2"" name=""anderland2"" value="vul hier het land in">';
     document.getElementById('anderland2').focus();
     }
}

function checkbrochures() {
  alert('jo');
}

function openwindow(url,name,width,height) {
	window.open(url,name,'width=' + width + ',height=' + height + ',screenX=' + ((screen.width/2)-width/2) + ',left=' + ((screen.width/2)-width/2) + ',screenY=' + ((screen.height/2)-height/2) + ',top=' + ((screen.height/2)-height/2) + ',scrollbars=no,resizable=no')
}

function personenupdate(aantal) {
    if (aantal<=100) {
    tekst='<TABLE><TR ALIGN="LEFT" VALIGN="TOP"><TD ></TD><TD >Aanhef</TD><TD >Initialen</TD><TD >Tussenvoegsels</TD><TD >Achternaam</TD><TD >Geboortedatum</TD></TR>';
    for (i=1; i<=aantal; i++) {
      tekst = tekst + '<TR ALIGN="LEFT" VALIGN="TOP"><TD >' + i + ':</TD><TD ><input type="text" SIZE="4" name="aanhef' + i + '" value=""></TD><TD ><input type="text" SIZE="4" name="initialen' + i + '" value="" ></TD><TD ><input type="text" SIZE="4" name="tussenv' + i + '" value="" ></TD><TD ><input type="text" SIZE="16" name="achternaam' + i + '" value="" ></TD><TD ><input type="text" SIZE="8" name="geboortedatum' + i + '" value="" ></TD></TR>';
	}
	tekst = tekst + '</TABLE>';
    jo.innerHTML=tekst;
	}
	else {alert('U mag niet meer dan maximaal 100 medereizigers opgeven!');}
}

function bestemmingupdate() {
	tekst = bestemmingen.innerHTML;
    tekst = tekst + initbestemming.innerHTML;
    bestemmingen.innerHTML=tekst;
}

function checkvervoer(idnr) {
   if (idnr==3) {
    vervoerextra.innerHTML = '* Vooral van toepassing wanneer grote afstanden overbrugd dienen te worden of afgelegen gebieden worden bezocht.'; }
   else {
    vervoerextra.innerHTML = '';}
}

function checkreden(idnr) {
   if (idnr==4) {
     redenextra.innerHTML =  '<table width="100%"><tr><td width="125">Vul hier uw reden in:</td><td><input type="text" name="redenextrawaarde"></td></tr></table>';}
   else {
     redenextra.innerHTML = '';}
}

var std_change_bg_color = '#EEEEEE';

function Juice_SetBGcolorOfObject(o, color) {
    if (color!='')
        o.style.background=color;
    else
        o.style.background=std_change_bg_color;
}

function FlipEasyPopup(page) {
  window.open(page, 'FlipEasy', 'resizable=1,toolbar=0,location=0,directories=0,menubar=0,scrollbars=1,fullscreen=0,width=1024,height=700');
}

function CheckForm() {
    Juice_validateForm('land', '', 'R', 'telefoonnr', '', 'R', 'adres', '', 'R', 'huisnummer', '', 'R', 'postcode', '', 'R', 'postcodeletters', '', 'R', 'woonplaats', '', 'R', 'initialen1', '', 'R', 'achternaam1', '', 'R');
    if (document.MM_returnValue)
        submitform();
}