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_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_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 showBranch(branch)
{
var objBranch = document.getElementById(branch).style;
	if(objBranch.display=="block")
		objBranch.display="none";
	else
		objBranch.display="block";
}

function YY_checkform() { //v4.71
//copyright (c)1998,2002 Yaromat.com
  var a=YY_checkform.arguments,oo=true,v='',s='',err=false,r,o,at,o1,t,i,j,ma,rx,cd,cm,cy,dte,at;
  for (i=1; i<a.length;i=i+4){
    if (a[i+1].charAt(0)=='#'){r=true; a[i+1]=a[i+1].substring(1);}else{r=false}
    o=MM_findObj(a[i].replace(/\[\d+\]/ig,""));
    o1=MM_findObj(a[i+1].replace(/\[\d+\]/ig,""));
    v=o.value;t=a[i+2];
    if (o.type=='text'||o.type=='password'||o.type=='hidden'){
      if (r&&v.length==0){err=true}
      if (v.length>0)
      if (t==1){ //fromto
        ma=a[i+1].split('_');if(isNaN(v)||v<ma[0]/1||v > ma[1]/1){err=true}
      } else if (t==2){
        rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-zA-Z]{2,4}$");if(!rx.test(v))err=true;
      } else if (t==3){ // date
        ma=a[i+1].split("#");at=v.match(ma[0]);
        if(at){
          cd=(at[ma[1]])?at[ma[1]]:1;cm=at[ma[2]]-1;cy=at[ma[3]];
          dte=new Date(cy,cm,cd);
          if(dte.getFullYear()!=cy||dte.getDate()!=cd||dte.getMonth()!=cm){err=true};
        }else{err=true}
      } else if (t==4){ // time
        ma=a[i+1].split("#");at=v.match(ma[0]);if(!at){err=true}
      } else if (t==5){ // check this 2
            if(o1.length)o1=o1[a[i+1].replace(/(.*\[)|(\].*)/ig,"")];
            if(!o1.checked){err=true}
      } else if (t==6){ // the same
            if(v!=MM_findObj(a[i+1]).value){err=true}
      }
    } else
    if (!o.type&&o.length>0&&o[0].type=='radio'){
          at = a[i].match(/(.*)\[(\d+)\].*/i);
          o2=(o.length>1)?o[at[2]]:o;
      if (t==1&&o2&&o2.checked&&o1&&o1.value.length/1==0){err=true}
      if (t==2){
        oo=false;
        for(j=0;j<o.length;j++){oo=oo||o[j].checked}
        if(!oo){s+='* '+a[i+3]+'\n'}
      }
    } else if (o.type=='checkbox'){
      if((t==1&&o.checked==false)||(t==2&&o.checked&&o1&&o1.value.length/1==0)){err=true}
    } else if (o.type=='select-one'||o.type=='select-multiple'){
      if(t==1&&o.selectedIndex/1==0){err=true}
    }else if (o.type=='textarea'){
      if(v.length<a[i+1]){err=true}
    }
    if (err){s+='* '+a[i+3]+'\n'; err=false}
  }
  if (s!=''){alert('De volgende velden zijn incompleet of incorrect:\t\t\t\t\t\n\n'+s)}
  document.MM_returnValue = (s=='');
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function sluiten()
{
	self.close()
}

function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
window.onload = externalLinks;

function CreateQuicktimeControl(DivID, CLSID, ObjectID, WIDTH, HEIGHT, SRC, AUTOSTART)
{
 	var d = document.getElementById(DivID);
  	d.innerHTML = 
   '<object classid=' + CLSID + ' id=' + ObjectID + ' width=' + WIDTH + ' height=' + HEIGHT +' CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab#version=7,0,4,0"><param name="SRC" value=' + SRC + '><PARAM NAME="controller" VALUE="TRUE"><PARAM NAME="type" VALUE="video/quicktime"><param name="autoStart" value=' + AUTOSTART + '><EMBED WIDTH=' + WIDTH + ' HEIGHT=' + HEIGHT + ' CONTROLLER="TRUE" TARGET="myself" SRC=' + SRC + ' type="video/quicktime" BGCOLOR="#000000" BORDER="0" PLUGINSPAGE="http://www.apple.com/quicktime/download/indext.html"></object>';
}

function CreateWindowsMediaControl(DivID, CLSID, ObjectID, WIDTH, HEIGHT, URL, AUTOSTART)
{
  var d = document.getElementById(DivID);
  d.innerHTML = 
    '<object classid=' + CLSID + ' id=' + ObjectID + ' width=' + WIDTH + ' height=' + HEIGHT +' type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"><param name="uiMode" value="None"><param name="DisplaySize" value="0"><param name="TransparentAtStart" value="false"><param name="ShowControls" value="True"><param name="ShowStatusBar" value="True"><param name="Mute" value="False"><PARAM name="Volume" value="600"><param name="FileName" value=' + URL + '><param name="autoStart" value=' + AUTOSTART + '><embed src=' + URL + ' width=' + WIDTH + ' height=' + HEIGHT +' type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" AutoStart=' + AUTOSTART + ' ShowStatusBar="1" ShowTracker="1" ShowControls="1" ShowAudioControls="1" ShowPositionControls="1" EnableTracker="1" Mute="0"></object>';
}

function clearText(thefield) {
        if (thefield.defaultValue == thefield.value)
                thefield.value = ""
        else thefield.value = thefield.defaultValue
} 

// SIFR

    var din = {
      src: '/swf/din.swf'
      ,ratios: [7, 1.32, 11, 1.31, 13, 1.24, 14, 1.25, 19, 1.23, 27, 1.2, 34, 1.19, 42, 1.18, 47, 1.17, 48, 1.18, 69, 1.17, 74, 1.16, 75, 1.17, 1.16]
    };
	
    sIFR.activate(din);

  sIFR.replace(din, {
      selector: 'h1'
      ,css: [
        '.sIFR-root { text-align: left; font-weight: bold; color:#e20075; text-transform:uppercase;}'
        ,'a { text-decoration: none; }'
        ,'a:link { color: #000000; }'
        ,'a:hover { color: #000000; }'
      ]
     ,selectable: true
     ,wmode: 'transparent'
 	 ,transparent: true	  
    });	
  
  sIFR.replace(din, {
      selector: 'h2'
      ,css: [
        '.sIFR-root { text-align: left; font-weight: normal; color:#FFFFFF; text-transform:uppercase;}'
        ,'a { text-decoration: none; }'
        ,'a:link { color: #FFFFFF; }'
        ,'a:hover { color: #FFFFFF; }'
      ]
     ,selectable: true
     ,wmode: 'transparent'
 	 ,transparent: true	  
    });
  
  sIFR.replace(din, {
      selector: 'h3'
      ,css: [
        '.sIFR-root { text-align: left; font-weight: normal; color:#e20075; text-transform:uppercase;}'
        ,'a { text-decoration: none; }'
        ,'a:link { color: #e20075; }'
        ,'a:hover { color: #e20075; }'
      ]
     ,selectable: true
     ,wmode: 'transparent'
 	 ,transparent: true	  
    });	  

sIFR.replace(din, {
  selector: 'h4',
  css: ['.sIFR-root { text-align: left; font-weight: normal; color:#FFFFFF; text-transform:uppercase;}'
  	  ,'a { text-decoration: none; }'
      ,'a:link { color: #FFFFFF; }'
      ,'a:hover { color: #FFFFFF; }'
  ]  
  ,filters: {
        DropShadow: {
           distance: 1
          ,color: '#000000'
          ,strength: 2
          ,alpha: .5
        }
      }
   ,wmode: 'transparent'
});
  
  sIFR.replace(din, {
    selector: '.Nav'
    ,css: [
        '.sIFR-root { text-align: left; font-weight: normal; letter-spacing: 0.5 ;}'
	  ,'a { text-decoration: none; }'
      ,'a:link { color: #FFFFFF; }'
      ,'a:hover { color: #000000; }'	  
    ]
     ,selectable: true
     ,wmode: 'transparent'
 	 ,transparent: true
  });
  
  sIFR.replace(din, {
    selector: '.NavActive'
    ,css: [
        '.sIFR-root { text-align: left; font-weight: normal; letter-spacing: 0.5 ;}'
	  ,'a { text-decoration: none; }'
      ,'a:link { color: #000000; }'
      ,'a:hover { color: #000000; }'	  
    ]
     ,selectable: true
     ,wmode: 'transparent'
 	 ,transparent: true
  }); 
 
$(function() { 
 
 $("#AanmeldForm").validate({	
		rules: {
			onderneming: {
				required: true,
				minlength: 4				
			},
			lid: {
				required: true				
			},
			naam: {
				required: true,
				minlength: 4
			},			
			adres: {
				required: true,
				minlength: 4
			},
			postcode: {
				required: true,
				minlength: 4
			},
			plaats: {
				required: true,
				minlength: 2
			},
			email: {
				required: true,
				email: true
			},
			personen: {
				required: true,
				minlength: 1
			},
			dinerkeuze_lid: {
      			required: "#eten_lid:checked"
    		},
			dinerkeuze_nietlid: {
      			required: "#eten_nietlid:checked"
    		},				
			rekeningnummer_lid: {
      			required: "#eten_lid:checked"
    		},
			rekeninghouder_lid: {
      			required: "#eten_lid:checked"
    		}			
		}
		//STANDAARD MESSAGES
		/*messages: {
			onderneming: "Vul aub uw voornaam in",
			naam: "Vul aub uw voornaam in",
			adres: "Vul aub uw adres in",
			postcode: "Vul aub uw postcode in",
			plaats: "Vul aub uw plaats in",
			email: "Vul aub uw emailadres in",
			personen: "Vul aub het aantal personen in"
		}	*/					
	});	
 
	// remove enter 2 submit
	$("form").bind("keypress", function(e) {
		  if (e.keyCode == 13) return false;
	});	 
	
}); 
