	//EXTERNAL LINKS
	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;	


	// DELAY FUNCTION
	$.fn.delay = function(time, callback){
		// Empty function:
		jQuery.fx.step.delay = function(){};
		// Return meaningless animation, (will be added to queue)
		return this.animate({delay:1}, time, callback);
	}

	//$(window).load(function() {
	//$(function(){
	$(document).ready(function(){

		// LETTERING.JS
		//$(".buitenhekplus").lettering();
		//$(".buitenhekplus").lettering('words');

		$("#Controller").jFlow({
				controller: ".jFlowControl", // must be class, use . sign
				slideWrapper : "#jFlowSlider", // must be id, use # sign
				slides: "#Slides",  // the div where all your sliding divs are nested in
				selectedWrapper: "jFlowSelected",  // just pure text, no sign
				width: "548px",  // this is the width for the content-slider
				height: "180px",  // this is the height for the content-slider
				duration: 200,  // time in miliseconds to transition one slide
				prev: ".jFlowPrev", // must be class, use . sign
				next: ".jFlowNext", // must be class, use . sign
				auto: true	
		});

		// VALIDATE AGENDA AANMELDFORM
		$("#agenda_aanmelden").validate({
			rules: {
				email: {
					required: true,
					email: true
				},
				organisatie: {
					required: true,
					minlength: 2
				},			
				voornaam: {
					required: true,
					minlength: 2
				},
				achternaam: {
					required: true,
					minlength: 2
				},
				telefoon: {
					required: true,
					minlength: 10
				},
				adres: {
					required: true,
					minlength: 4
				},
				postcode: {
					required: true,
					minlength: 4
				},
				plaats: {
					required: true,
					minlength: 2
				},
				personen: {
					required: true,
					minlength: 1
				}	
			},
			messages: {
				email: "Vul aub een geldig e-mailadres in",
				organisatie: "Vul aub uw organisatie in",
				voornaam: "Vul aub uw voornaam in",
				achternaam: "Vul aub uw achternaam in",
				telefoon: "Vul aub uw telefoonnummer in",
				adres: "Vul aub uw adres in",
				postcode: "Vul aub uw postcode in",
				plaats: "Vul aub uw plaats in",
				personen: "Vul aub het aantal personen in"
			}		
		})

		// VALIDATE VACATURE AANMELDFORM
		$("#VacatureForm").validate({
			rules: {
				functie: {
					required: true,
					minlength: 2
				},					
				organisatie: {
					required: true,
					minlength: 2
				},
				omschrijving: {
					required: true,
					minlength: 10
				},					
				contactpersoon: {
					required: true,
					minlength: 2
				},
				adres: {
					required: true,
					minlength: 4
				},
				postcode: {
					required: true,
					minlength: 4
				},
				plaats: {
					required: true,
					minlength: 2
				},
				email: {
					required: true,
					email: true
				},
				telefoon: {
					required: true,
					minlength: 10
				}				
			},
			messages: {
				functie: "Vul aub de functie in",
				organisatie: "Vul aub uw organisatie in",
				omschrijving: "Vul aub de omschrijving in",
				contactpersoon: "Vul aub de contactpersoon in",
				telefoon: "Vul aub uw telefoonnummer in",
				email: "Vul aub een geldig e-mailadres in",		
				adres: "Vul aub uw adres in",
				postcode: "Vul aub uw postcode in",
				plaats: "Vul aub uw plaats in"
			}		
		})

		// VALIDATE bestelFORM
		$("#bestelling_afronden").validate({
			rules: {
				email: {
					required: true,
					email: true
				},
				organisatie: {
					required: true,
					minlength: 2
				},			
				voornaam: {
					required: true,
					minlength: 2
				},
				achternaam: {
					required: true,
					minlength: 2
				},
				adres: {
					required: true,
					minlength: 4
				},
				postcode: {
					required: true,
					minlength: 4
				},
				plaats: {
					required: true,
					minlength: 2
				},
				aantal: {
					required: true,
					minlength: 1
				}	
			},
			messages: {
				email: "Vul aub een geldig e-mailadres in",
				organisatie: "Vul aub uw organisatie in",
				voornaam: "Vul aub uw voornaam in",
				achternaam: "Vul aub uw achternaam in",
				adres: "Vul aub uw adres in",
				postcode: "Vul aub uw postcode in",
				plaats: "Vul aub uw plaats in",
				aantal: "Vul aub het aantal aantal in"
			}		
		})

		// VALIDATE NIEUWSBRIEFFORM
		$("#Nieuwsbrief").validate({
			rules: {
				voornaam: {
					required: true,
					minlength: 2
				},	
				achternaam: {
					required: true,
					minlength: 2
				},					
				abbo_email: {
					required: true,
					email: true
				}
			},
			messages: {
				voornaam: "Vul aub uw voornaam in",
				achternaam: "Vul aub uw achternaam in",
				abbo_email: "Vul aub een geldig e-mailadres in"	
			}
		});
		
		// VALIDATE NIEUWSBRIEFFORM
		$("#AbboService").validate({
			rules: {
				naam: {
					required: true,
					minlength: 2
				},					
				emailadres: {
					required: true,
					email: true
				}
			},
			messages: {
				naam: "Vul aub uw naam in",
				emailadres: "Vul aub een geldig e-mailadres in"	
			}
		});		
		
		// VALIDATE REACTIEFORM
		$("#ReactieForm").validate({
			rules: {
				naam: {
					required: true,
					minlength: 2
				},
				bericht: {
					required: true,
					minlength: 2
				},
				email: {
					required: true,
					email: true
				}
			},
			messages: {
				naam: "Vul aub uw naam in",
				email: "Vul aub een geldig e-mailadres in",
				bericht: "Vul aub uw reactie in"	
			}
		});
		
		$("#ContactForm").validate({
			rules: {
				email: {
					required: true,
					email: true
				},
				naam: {
					required: true,
					minlength: 2
				},
				telefoon: {
					required: true,
					minlength: 4
				}
			},
			messages: {
				email: "Vul aub een geldig e-mailadres in",
				naam: "Vul aub uw naam in",
				telefoon: "Vul aub uw telefoonnummer in"
			}
		});			


		$("#Brochure").validate({
			rules: {
				voornaam: {
					required: true,
					minlength: 2
				},
				achternaam: {
					required: true,
					minlength: 2
				},				
				organisatie: {
					required: true,
					minlength: 3
				},
				adres: {
					required: true,
					minlength: 3
				},
				postcode: {
					required: true,
					minlength: 4
				},
				plaats: {
					required: true,
					minlength: 2
				}				
			},
			messages: {
				voornaam: "Vul aub uw voornaam in",
				achternaam: "Vul aub uw achternaam in",
				organisatie: "Vul aub uw organisatie in",
				adres: "Vul aub uw adres in",
				postcode: "Vul aub uw postcode in",
				plaats: "Vul aub uw plaats in"
			}
		});	

		// remove enter 2 submit
		$("#ReactieForm").bind("keypress", function(e) {
			  if (e.keyCode == 13) return false;
		});
		$("#Nieuwsbrief").bind("keypress", function(e) {
			  if (e.keyCode == 13) return false;
		});
		$("#bestelling_afronden").bind("keypress", function(e) {
			  if (e.keyCode == 13) return false;
		});
		$("#agenda_aanmelden").bind("keypress", function(e) {
			  if (e.keyCode == 13) return false;
		});
		$("#VacatureForm").bind("keypress", function(e) {
			  if (e.keyCode == 13) return false;
		});				
				
	});
