function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function collapseall() {
	document.all.info.style.display='none';
	document.all.fotos.style.display='none';
	document.all.wedstrijden.style.display='none';
	document.all.ruiterkamp.style.display='none';
	document.all.weblinks.style.display='none';
	document.all.guestbook.style.display='none';
	document.all.gekop.style.display='none';
}

function expandinfo() {
	document.all.info.style.display='block';
	document.all.fotos.style.display='none';
	document.all.wedstrijden.style.display='none';
	document.all.ruiterkamp.style.display='none';
	document.all.weblinks.style.display='none';
	document.all.guestbook.style.display='none';
	document.all.gekop.style.display='none';
}
function expandfotos() {
	document.all.fotos.style.display='block';
	document.all.info.style.display='none';
	document.all.wedstrijden.style.display='none';
	document.all.ruiterkamp.style.display='none';
	document.all.weblinks.style.display='none';
	document.all.guestbook.style.display='none';
	document.all.gekop.style.display='none';
}
function expandwedstrijden() {
	document.all.wedstrijden.style.display='block';
	document.all.info.style.display='none';
	document.all.fotos.style.display='none';
	document.all.ruiterkamp.style.display='none';
	document.all.weblinks.style.display='none';
	document.all.guestbook.style.display='none';
	document.all.gekop.style.display='none';
}
function expandruiterkamp() {
	document.all.ruiterkamp.style.display='block';
	document.all.info.style.display='none';
	document.all.fotos.style.display='none';
	document.all.wedstrijden.style.display='none';
	document.all.weblinks.style.display='none';
	document.all.guestbook.style.display='none';
	document.all.gekop.style.display='none';
}
function expandlinks() {
	document.all.weblinks.style.display='block';
	document.all.info.style.display='none';
	document.all.fotos.style.display='none';
	document.all.wedstrijden.style.display='none';
	document.all.ruiterkamp.style.display='none';
	document.all.guestbook.style.display='none';
	document.all.gekop.style.display='none';
}
function expandguestbook() {
	document.all.guestbook.style.display='block';
	document.all.info.style.display='none';
	document.all.fotos.style.display='none';
	document.all.wedstrijden.style.display='none';
	document.all.ruiterkamp.style.display='none';
	document.all.weblinks.style.display='none';
	document.all.gekop.style.display='none';
}
function expandgekop() {
	document.all.gekop.style.display='block';
	document.all.info.style.display='none';
	document.all.fotos.style.display='none';
	document.all.wedstrijden.style.display='none';
	document.all.ruiterkamp.style.display='none';
	document.all.weblinks.style.display='none';
	document.all.guestbook.style.display='none';
}
function showhoeven() {
	document.all.hoeven.style.display='block';
}
function hidehoeven() {
	document.all.hoeven.style.display='none';
}

function openPlattegrond() {
  var height=450;
  var width=750;
  var left=(screen.width-width)/2;
  var top=(screen.height-height)/2;
  var mywindow=window.open("/info/plattegrond.php","requestwindow","alwaysRaised, dependent, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+width+",height="+height+",top="+top+",left="+left+",");
}

function openDirectMail() {
  var height=450;
  var width=750;
  var left=(screen.width-width)/2;
  var top=(screen.height-height)/2;
  var mywindow=window.open("/directmail/index.php","requestwindow","alwaysRaised, dependent, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+width+",height="+height+",top="+top+",left="+left+",");
}

function isEmailAddress (string) {
  var addressPattern = 
    /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
  return addressPattern.test(string);
}

function isMobile (string) {
  var addressPattern = 
    /^06(-{0,1})[1-9][0-9]{7}$/;
  return addressPattern.test(string);
}

function isTel (string) {
  var addressPattern = 
  /^([0]\d{2}(-|\s)[1-9]\d{6})|([0]\d{3}(-|\s)[1-9]\d{5})|([0]\d{9})$/;
  return addressPattern.test(string);
}

function isPostcode (obj) {
  string = obj.value;
  var addressPattern = /^\d{4}\s[A-Za-z]{2}$/;
  if(addressPattern.test(string)){
	return true;
  }
  addressPattern = /^\d{4}[A-Za-z]{2}$/;
  if(addressPattern.test(string)){
	obj.value = string.substr(0,4) + ' ' + string.substr(4,2);
	return true;
  }
  return false;
}

function isNum (string) {
  var addressPattern =  /^\d+$/;
  return addressPattern.test(string);
}

function submitmail() {
  var submitdata = true
  var errorstr = ""
  
  errorstr = "De volgende gegevens ontbreken of zijn niet compleet:\n";
     
  if (document.contactformulier.naam.value.length==0)
     {
       errorstr = errorstr + "\n" + "  - Naam";
       submitdata = false;
     }

  if (document.contactformulier.onderwerp.value.length==0)
     {
       errorstr = errorstr + "\n" + "  - Onderwerp";
       submitdata = false;
     }

  if (!isEmailAddress(document.contactformulier.email.value))
     {
       errorstr = errorstr + "\n" + "  - E-mailadres niet juist";
       submitdata = false;
     }

  if (document.contactformulier.bericht.value.length==0)
     {
       errorstr = errorstr + "\n" + "  - Bericht veld";
       submitdata = false;
     }

  if (submitdata==true)
   {   
     document.contactformulier.submit();
   }
   else
   {
     alert(errorstr);
   }
}

function submitgastenboek() {
  var submitdata = true
  var errorstr = ""
  
  errorstr = "De volgende gegevens ontbreken of zijn niet compleet:\n";    
     
  if (document.gastenboek.naam.value.length==0)
     {
       errorstr = errorstr + "\n" + "  - Jouw naam";
       submitdata = false;
     }
     
  if (!isEmailAddress(document.gastenboek.email.value))
     {
       errorstr = errorstr + "\n" + "  - E-mailadres is verplicht";
       submitdata = false;
     }
     
  if (document.gastenboek.bericht.value.length==0)
     {
       errorstr = errorstr + "\n" + "  - Bericht";
       submitdata = false;
     }
       
  if (submitdata==true)
   {
     document.gastenboek.submit();
   }
   else
   {
     alert(errorstr);
   }
}

function submitnieuwsbrief() {
  var submitdata = true
  var errorstr = ""
  
  errorstr = "De volgende gegevens ontbreken of zijn niet compleet:\n";    
     
  if (document.nieuwsbrief.voornaam.value.length==0)
     {
       errorstr = errorstr + "\n" + "  - Voornaam";
       submitdata = false;
     }

  if (document.nieuwsbrief.achternaam.value.length==0)
     {
       errorstr = errorstr + "\n" + "  - Achternaam";
       submitdata = false;
     }
     
  if (!isEmailAddress(document.nieuwsbrief.email.value))
     {
       errorstr = errorstr + "\n" + "  - E-mailadres niet juist";
       submitdata = false;
     }
     
       
  if (submitdata==true)
   {
     document.nieuwsbrief.submit();
   }
   else
   {
     alert(errorstr);
   }
}

function submitecard() {
  var submitdata = true
  var errorstr = ""
  
  errorstr = "De volgende gegevens ontbreken of zijn niet compleet:\n";    
     
  if (document.ecard.zender.value.length==0)
     {
       errorstr = errorstr + "\n" + "  - Naam van de zender";
       submitdata = false;
     }
     
  if (!isEmailAddress(document.ecard.zender_email.value))
     {
       errorstr = errorstr + "\n" + "  - E-mailadres van de zender niet juist";
       submitdata = false;
     }
     
  if (document.ecard.ontvanger.value.length==0)
     {
       errorstr = errorstr + "\n" + "  - Naam van de ontvanger";
       submitdata = false;
     }
     
  if (!isEmailAddress(document.ecard.ontvanger_email.value))
     {
       errorstr = errorstr + "\n" + "  - E-mailadres ontvanger niet juist";
       submitdata = false;
     }
     
  if (document.ecard.bericht.value.length==0)
     {
       errorstr = errorstr + "\n" + "  - Bericht";
       submitdata = false;
     }
       
  if (submitdata==true)
   {
     document.ecard.validateclickecard.value = "validated";
     document.ecard.submit();
   }
   else
   {
     alert(errorstr);
   }
}


function vulin() {
	document.gastenboek.validateclick.value = "validated";
}

function vulinnb() {
	document.nieuwsbrief.validateclicknb.value = "validated";
}

function playSound() {
document.all['BGSOUND_ID'].src='/_resources/sounds/hinnik.mp3';
 {
  self.document.hinnik.play()
 }
}


