// Algemene Scripts

/****************************
*		Init scripts		*
****************************/
	
	function init(){
		MM_preloadImages('images/loading.gif','images/NL/bols_acces.jpg','images/EN/bols_acces.jpg','images/verloop.jpg');
		//ageCheck();
		MM_preloadImages('images/top_menu/home_h.jpg','images/top_menu/faqs_h.jpg','images/top_menu/lucas_h.jpg','images/top_menu/nl_h.jpg','images/top_menu/en_h.jpg','images/top_menu/snon_h.jpg','images/top_menu/snoff_h.jpg','images/footer_menu/colofon_h.jpg','images/footer_menu/sitemap_h.jpg');
		muziekButton();
		checkCourse();
		if (document.getElementById("headapl"))
		{
			document.getElementById("headapl").style.display = "none";
		}
	}
	
	/* OUD tour positie
	function setTourPos(){
		var tourDiv = document.getElementById("tourPopup_container");
				
		if (tourDiv2)
		{
			var tourWidth = parseInt(tourDiv.style.width);
			var pageWidth = 975;
			if(document.all){
				availW = document.body.clientWidth;
			}else{
				availW = innerWidth;
			}
			if (availW > 996)
			{
				var tourRight = (((availW-pageWidth)/2) + 64) + "px";
				tourDiv.style.right = tourRight;
			}
		}
	}*/


	function getAgeCheck()
	{
		var objects = document.getElementsByTagName("object");
		var embeds = document.getElementsByTagName("embed");
		
		if (objects)
		{
			for (o=0; o < objects.length; o++)
			{
				objects[o].style.visibility = "hidden";
			}	
		}
		
		if (embeds)
		{
			for (e=0; e < embeds.length; e++)
			{
				embeds[e].style.visibility = "hidden";
			}	
		}
	
		
		var ageCheckGrey = document.getElementById("agecheckgrey");
		if (ageCheckGrey)
		{
			ageCheckGrey.style.height = document.body.scrollHeight;
			ageCheckGrey.style.display = "block";
		}
		
		var ageCheck = document.getElementById("agecheck");
		if (ageCheck)
		{
			ageCheck.style.display = "block";
		}
	}

	function leaveAgeCheck()
	{
		var objects = document.getElementsByTagName("object");
		var embeds = document.getElementsByTagName("embed");

		if (objects)
		{
			for (o=0; o < objects.length; o++)
			{
				objects[o].style.visibility = "visible";
			}	
		}
		
		if (embeds)
		{
			for (e=0; e < embeds.length; e++)
			{
				embeds[e].style.visibility = "visible";
			}	
		}

		var ageCheckGrey = document.getElementById("agecheckgrey");
		if (ageCheckGrey)
		{
			ageCheckGrey.style.display = "none";
		}
		
		var ageCheck = document.getElementById("agecheck");
		if (ageCheck)
		{
			ageCheck.style.display = "none";
		}

var ageCheck2 = document.getElementById("ageCheckContainer");
if (ageCheck2) {
    ageCheck2.style.display = "none";
}

var ageCheck3 = document.getElementById("ageCheckShadow");
if (ageCheck3) {
    ageCheck3.style.display = "none";
}        
	}

	function AgeOk(ref)
	{
		AgeCheckOk();
	}
	
	function AgeFault()
	{
	    document.getElementById("showErrorAge").style.display = 'block';
		//top.location.href = "about:home";
	}

/****************************************
*		Locatienet popup				*
****************************************/

function locatienet(x)
{
	var	link = "";
	
	if (x == "en")
	{
		link = "http://tools.locatienet.com/location/map.asp?config_id=8061&language=english&address=488154_5235906_Paulus%20Potterstraat_14_1071CZ_Amsterdam__NL_&zoom=2&markertext=House%20of%20Bols&background=http%3A//www.houseofbols.nl/images/lokatienet/background.jpg&bgcolor=%230D0D33&logo=http%3A//www.houseofbols.nl/images/logo.jpg&css=http%3A//www.houseofbols.nl/style/lokatienet.css";
		//link = "http://tools.locatienet.com/location/map.asp?config_id=8061&language=english&address=488168_5235910_Paulus%20Potterstraat_14_1071CZ_Amsterdam__NL_&zoom=2&markertext=House%20of%20Bols&background=http%3A//www.houseofbols.nl/images/lokatienet/background.jpg&logo=http%3A//www.houseofbols.nl/images/logo.jpg&css=http%3A//www.houseofbols.nl/style/lokatienet.css";
	}
	else
	{
		link = "http://tools.locatienet.com/location/map.asp?config_id=8061&language=dutch&address=488154_5235906_Paulus%20Potterstraat_14_1071CZ_Amsterdam__NL_&zoom=2&markertext=House%20of%20Bols&background=http%3A//www.houseofbols.nl/images/lokatienet/background.jpg&bgcolor=%230D0D33&logo=http%3A//www.houseofbols.nl/images/logo.jpg&css=http%3A//www.houseofbols.nl/style/lokatienet.css";
		//link = "http://tools.locatienet.com/location/map.asp?config_id=8061&language=dutch&address=488168_5235910_Paulus%20Potterstraat_14_1071CZ_Amsterdam__NL_&zoom=2&markertext=House%20of%20Bols&background=http%3A//www.houseofbols.nl/images/lokatienet/background.jpg&logo=http%3A//www.houseofbols.nl/images/logo.jpg&css=http%3A//www.houseofbols.nl/style/lokatienet.css";
	}
	
	window.open(link ,"routekaart","scrollbars=no,toolbar=no,width=650,height=450,resize=no,menubar=no,left=50,top=75");

}


/****************************************
*		Voorwaarden popup				*
****************************************/

	function voorwaarden()
	{
		voorwaardenPos();
		document.getElementById('frameVoorwaarden').src = "voorwaarden.asp";
	}
	
	function voorwaardenPos()
	{
		document.getElementById('frameVoorwaarden').style.top = document.body.scrollTop + 70;
	}

	function voorwaarden2()
	{
		voorwaardenPos();
		document.getElementById('frameVoorwaarden').src = "voorwaarden2.asp";
	}

/****************************************
*		Preload en IMG swap scripts		*
****************************************/

	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_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_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];}
	}

/****************************
*		Flash Menu Hook		*
****************************/

	var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
	
	function menutest2_DoFSCommand(command, args) {
		var menutest2Obj = isInternetExplorer ? document.all.menutest2 : document.menutest2;
		var oldHeight = "40px";
		var newHeight = "200px";
		
		if (command == "over")
		{
			document.getElementById("menu_container").style.height = newHeight;
			//hideSelects("hidden");
		}
		if (command == "uit")
		{
			document.getElementById("menu_container").style.height = oldHeight;
			//hideSelects("visible");
		}
	}
	if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
		document.write('<sc' + 'ript language=\"VBScript\"\>\n');
		document.write('On Error Resume Next\n');
		document.write('Sub menutest2_FSCommand(ByVal command, ByVal args)\n');
		document.write('	Call menutest2_DoFSCommand(command, args)\n');
		document.write('End Sub\n');
		document.write('</sc' + 'ript\>\n');
	}

/****************************
*		Muziek scripts		*
****************************/
	
	var IE =  navigator.appName.indexOf("Microsoft Internet");
	function muziekButton(){
		var strKnop
		if (top != window){
			if (parent.muziekframe.strStatus == "playing"){
				document.getElementById("muziekButtonSpan").innerHTML = "<a href=\"javascript:stopMuziek();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('soundoff','','images/top_menu/snoff_h.jpg',1)\"><img src=\"images/top_menu/snoff_a.jpg\" alt=\"Sound off\" name=\"soundoff\" width=\"61\" height=\"8\" border=\"0\"></a>";
			}
			else if (parent.muziekframe.strStatus == "stopped"){
				document.getElementById("muziekButtonSpan").innerHTML = "<a href=\"javascript:playMuziek();\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('soundoon','','images/top_menu/snon_h.jpg',1)\"><img src=\"images/top_menu/snon_a.jpg\" alt=\"Sound on\" name=\"soundon\" width=\"61\" height=\"8\" border=\"0\"></a>";
			}
		}
	}

	function playMuziek(){
		var movie = parent.muziekframe.muziek
			if(top != window){
	 			if (navigator.appName.indexOf("Microsoft Internet")!=-1){
					parent.muziekframe.muziek.GotoFrame(2);
				}
				else{
					parent.muziekframe.document.embeds['muziek'].GotoFrame(3);
				}
				parent.muziekframe.strStatus = "playing";
				muziekButton();
			}
	}
	
	function stopMuziek(){
			if(top != window){
	 			if (navigator.appName.indexOf("Microsoft Internet")!=-1){
	 				parent.muziekframe.muziek.GotoFrame(7);
				}
				else{
					parent.muziekframe.document.embeds['muziek'].GotoFrame(7);
				}
				parent.muziekframe.strStatus = "stopped";
				muziekButton();
			}
	}
	
	
/****************************
*		Hide selectboxen	*
****************************/


	function hideSelects(action) {
		if (action!='visible'){action='hidden';}
			if (navigator.appName.indexOf("MSIE")) {
				for (var S = 0; S < document.forms.length; S++){
					for (var R = 0; R < document.forms[S].length; R++) {
						if (document.forms[S].elements[R].options) {
						document.forms[S].elements[R].style.visibility = action;
					}
				}
			} 
		}
	}

/****************************
*		Frame detect		*
****************************/

	function detect(detectUrl)
	{
		if (self != top)
		{
			void(0);
		}
		else{
			document.write('<body><form name="redirectForm" action="index.asp" method="post"><input type="hidden" name="redirect" value="' + detectUrl + '"></form></body>');
			document.redirectForm.submit();
		}
	}

/****************************
*		Show/Hide Div		*
****************************/

	function showHideDiv(sHDId)
	{
		var div = document.getElementById(sHDId);
		var kop = document.getElementById(sHDId + "kop");
		if (div)
		{
			if (div.style.display == "none")
			{
				showHideAll('dagDiv', 'hide'); 
				div.style.display = "block";
				if (kop)
				{
					kop.className = "booking_cursus_bold";
				}
			}
			else
			{
				div.style.display = "none";
				if (kop)
				{
					kop.className = "booking_cursus_norm";
				}
			}
		}
	}
	
	function showHideAll(sHAClass, sHAType)
	{
		var divs = document.getElementsByTagName('div');
		
		for (x=0;x<divs.length;x++)
		{
			if (divs[x].className == sHAClass)
			{
				if (sHAType == "hide")
				{
					divs[x].style.display = "none";
				}
				else
				{
					divs[x].style.display = "block";
				}
			}
		}
		
		var koppen = document.getElementsByTagName('li');
		
		for (y=0;y<koppen.length;y++)
		{
			if (koppen[y].getAttribute('tid') == "dagKop")
			{
				if (sHAType == "hide")
				{
					koppen[y].className = "booking_cursus_norm";
				}
				else
				{
					koppen[x].className = "booking_cursus_bold";
				}
			}
		}
	
}

/****************************
*		Ajax Scrips			*
****************************/

	function setKorting()
	{
		var cForm = document.bookingForm;
		if (cForm)
		{
			var kortingsCode = cForm.kortingsCode;
			if (kortingsCode)
			{
				if (kortingsCode.value != "")
				{
					getKorting(kortingsCode.value);
				}
			}
		}
	}
	
	function calcKorting()
	{
		var cForm = document.bookingForm;
		if (cForm)
		{
			var tempKorting = cForm.tempKorting;
			if (tempKorting)
			{
				var kortingAantal = cForm.KortingAantal;
				var kortingType = cForm.KortingType;
				var tempSplit = tempKorting.value;
				tempSplit = tempSplit.split(";"); 
				kortingAantal.value = tempSplit[0];
				kortingType.value = tempSplit[1];

				var oldPrijs = cForm.tempPrijs;
				var newPrijs = (oldPrijs.value - ((oldPrijs.value/100)*kortingAantal.value)); 				
				cForm.tempPrijs.value = newPrijs;
				checkPrijs(); 
				
			}
		}
	}
	
	function checkCourse(){
		var cForm = document.bookingForm;
		if (cForm)
		{
			var cDiv = cForm.cid;
			var cDate = cForm.tempDate;
			if (cDiv){
				if(cDiv.options[cDiv.selectedIndex].value != "")
				{
					getCourse("leeg","leeg");
					getCourseCount("leeg", "leeg"); 
					getCourseApplicants("leeg"); 
					getCourseDate(cDiv.options[cDiv.selectedIndex].value, cDate.value);
				}
			}
		}
	}
	
	function checkAantal()
	{
		var cForm = document.bookingForm;
		if (cForm)
		{
			var cDiv = cForm.cid;
			if (cDiv)
			{
				getCourseApplicants("leeg"); 
				var datumVeld 	= cForm.date;
				if (datumVeld)
				{
					if (datumVeld.selectedIndex >= 0)
					{
						var korting 	= datumVeld.options[datumVeld.selectedIndex].getAttribute('korting');
						var aantal 		= datumVeld.options[datumVeld.selectedIndex].getAttribute('aantalpers');
						getCourse(cDiv.options[cDiv.selectedIndex].value, datumVeld.options[datumVeld.selectedIndex].value);
						getCourseCount(cDiv.options[cDiv.selectedIndex].value, aantal, korting); 
					}
				}
			}
		}
	}
	
	function checkPrijs()
	{
		var cForm = document.bookingForm;
		var aantal = parseFloat(cForm.aantal.value);
		var prijs = cForm.tempPrijs.value;
		
		prijs = prijs.replace(",",".");
		
		prijs = parseFloat(prijs);
		
		totaalPrijs = aantal * prijs;
		totaalPrijs = ConvertMoney(totaalPrijs);
		totaalPrijs = totaalPrijs.replace(",00",",-");
		document.getElementById("prijsTotaalSpan").innerHTML = "&euro; " + totaalPrijs;
		
	}
	
	function checkApplicants()
	{
		var cForm = document.bookingForm;
		
		if (cForm)
		{
			var cAantal = cForm.aantal;
			if(cAantal)
			{
				if (cAantal.options[cAantal.selectedIndex].value == 1)
				{
					document.getElementById("headapl").style.display = "none";
					document.getElementById("bookBut1").style.display = "block";
					document.getElementById("bookMeld1").style.display = "none";
					getCourseApplicants("leeg");
				}		
				else
				{
					document.getElementById("headapl").style.display = "block";
					document.getElementById("bookBut1").style.display = "none";
					document.getElementById("bookMeld1").style.display = "block";
					getCourseApplicants(cAantal.options[cAantal.selectedIndex].value);
				}
			}
		}
	}

	function showKalender()
	{
		var frm = document.getElementById("frameKalender");
		var div = document.getElementById("divKalender");
		
		if (frm && div)
		{
			frm.style.height = document.body.scrollHeight;
			frm.style.display = "block";
			div.style.top = document.body.scrollTop + 10;
			div.style.display = "block";
			getKalender('');
		}
	}
	
	function hideKalender()
	{
		var frm = document.getElementById("frameKalender");
		var div = document.getElementById("divKalender");
		
		if (frm && div)
		{
			div.style.display = "none";
			frm.style.display = "none";
		}
	}


/****************************
*	Formatnumber script		*
****************************/

	function checkNum(cNAantal, cNCurVeld)
	{
		if (cNCurVeld == "bday")
		{
			var str = document.bookingForm.bday.value;
			if (str.length == cNAantal)
			{
				document.bookingForm.bmonth.value = "";
				document.bookingForm.bmonth.focus();
			}
			
		}
		if (cNCurVeld == "bmonth")
		{
			var str = document.bookingForm.bmonth.value;
			if (str.length == cNAantal)
			{
				document.bookingForm.byear.value = "";
				document.bookingForm.byear.focus();
			}
			
		}
	}
	
	function isNumberKey(evt, key)
	{
		var charCode = (evt.which) ? evt.which : event.keyCode
		
		if (charCode > 31 && (charCode < 48 || charCode > 57) && ((charCode != 44 ) || (key.indexOf(",") > -1)) )
			return false;
		
		return true;
	}
	
	function ConvertMoney(strString)
	{
		strString = strString+'';
		blnResult = strString.replace(".",",");
		
		TempblnResult = "";
		blnResult2 = "";
		
		if (blnResult.length == 0)
			blnResult = "0";
		
		if 	(blnResult.indexOf(",") == -1)
		{
			blnResult += ",00";
		}
		else
		{
			if (blnResult.substring(blnResult.indexOf(",")+1,blnResult.length).length == 1)
				blnResult += "0";
		}
		
		TempblnResult = blnResult.substring(0,blnResult.indexOf(","));
		while(TempblnResult.length > 3)
		{
			blnResult2 += "." + TempblnResult.substring(TempblnResult.length-3, TempblnResult.length);
			TempblnResult = TempblnResult.substring(0, TempblnResult.length-3);
		}
		
		blnResult = TempblnResult + blnResult2 + blnResult.substring(blnResult.indexOf(","), blnResult.indexOf(",")+3);
		
		
		return blnResult;
	}
	
	function ConvertMoneyBack(strString)
	{
		strString = strString+'';
		strString = strString.replace(".","");
		strString = strString.replace(",",".");
		return strString-'';
	}
	
	
	function ConvertMoneyEditBack(strString)
	{
		strString = strString+'';
		strString = replaceAll(strString,".","");
		
		return strString;
	}
	
	function IsMoney(sText)
	{
		var ValidChars = "0123456789.,";
		var IsNumber=true;
		var Char;
		
		for (i = 0; i < sText.length && IsNumber == true; i++) 
		{ 
			Char = sText.charAt(i); 
			if (ValidChars.indexOf(Char) == -1) 
			{
				IsNumber = false;
			}
		}
		return IsNumber;
	}
	
	function replaceAll( str, from, to )
	{
	    var idx = str.indexOf( from );
	
	
	    while ( idx > -1 )
	    {
	        str = str.replace( from, to ); 
	        idx = str.indexOf( from );
	    }
	
	    return str;
	}


/****************************
*	Check Select Scripts	*
****************************/

	function checkSelectDiv(cSDId)
	{
		if (cSDId == "bus")
		{
			var cShow = document.getElementById("check1");
			var dShow = document.getElementById("divBusiness");
			var sShow = document.getElementById("business");
			var pShow = cShow.getAttribute("state");
			var cHide = document.getElementById("check2");
			var dHide = document.getElementById("divLeisure");
			var sHide = document.getElementById("leisure");
			var pHide = cHide.getAttribute("state");
		}
		else if (cSDId == "lei")
		{
			var cShow = document.getElementById("check2");
			var sShow = document.getElementById("divLeisure");
			var dShow = document.getElementById("divLeisure");
			var pShow = cShow.getAttribute("state");
			var cHide = document.getElementById("check1");
			var dHide = document.getElementById("divBusiness");
			var sHide = document.getElementById("divBusiness");
			var pHide = cHide.getAttribute("state");
		}
		
		if (cShow && sShow && pShow && cHide && sHide && pHide)
		{
			if (pShow == "true")
			{
				cShow.setAttribute("state","false");
				cShow.checked = false;
				sShow.selectedIndex = 0;
				dShow.style.display = "none";

				cHide.setAttribute("state","false");
				cHide.checked = false;
				sHide.selectedIndex = 0;
				dHide.style.display = "none";
			}
			else if (pShow == "false")
			{
				cShow.setAttribute("state","true");
				cShow.checked = true;
				sShow.selectedIndex = 0;
				dShow.style.display = "block";
				
				cHide.setAttribute("state","false");
				cHide.checked = false;
				sHide.selectedIndex = 0;
				dHide.style.display = "none";
			}
		}		
	}
	
/****************************
*	check Form scripts		*
****************************/

		function checkBookingBedrijfForm()
	{
		var bForm = document.bookingForm;
		
		if (bForm)
		{
			//ErrorValues aanmaken
				var ErrorValue 			= "";
				var CourseErrorValue 	= "";
				var HeadErrorValue 		= "";
				var VoorkeurErrorValue 	= "";
				var AgreeErrorValue		= "";
				var bANaamError 		= 0;
				var bAAchternaamError 	= 0;
				var bAEmailError 		= 0;
				var ErrorAplValue 		= "";
			
			//Hoofd cursust gegevens
				var bFirstname 		= bForm.voornaam;
				var bLastname		= bForm.achternaam;		
				var bEmail			= bForm.email;
				var bTel			= bForm.tel;
				var bStreet			= bForm.straat;
				var bNumber			= bForm.nummer;
				var bZipcode		= bForm.postcode;
				var bCity			= bForm.plaats;
				var bCountry		= bForm.land;
				var bCourseType		= bForm.coursetype;
				var bBusiness		= bForm.business;
				var bLeisure		= bForm.leisure;
				var bLevel			= bForm.level;
				var bCourseLang		= bForm.taal;
				var bAgree			= bForm.agree;
				var bBedrijfsnaam	= bForm.bedrijfsnaam;
				var bBTW			= bForm.btw;
				var bHoe			= bForm.hoebijbols;
				var bPersonen		= bForm.aantalpersonen;
				var bDatumDay			= bForm.datumday;
				var bDatumMonth			= bForm.datummonth;
				var bDatumYear			= bForm.datumyear;
				var bDuur			= bForm.duur;
				var bAantalpersonen			= bForm.aantalpersonen;
				var bVoorkeurbegintijd			= bForm.voorkeurbegintijd;
				var bVoorkeureindtijd			= bForm.voorkeureindtijd;

			//Formulier checken
				//Hoofd cursist
					//if (bBedrijfsnaam.value == "")
					//{
					//		HeadErrorValue += "- " + ErrorHeadBedrijfsnaam + "\n";
					//}

					//if (bBTW.value == "")
					//{
					//		HeadErrorValue += "- " + ErrorHeadBTW + "\n";
					//}

					if (bFirstname.value == "")
					{
							HeadErrorValue += "- " + ErrorHeadVoornaam + "\n";
					}
				
					if (bLastname.value == "")
					{
							HeadErrorValue += "- " + ErrorHeadAchternaam + "\n";
					}

				

					if (bEmail.value == "" || bEmail.value.indexOf("@") < 0 || bEmail.value.indexOf(".",bEmail.value.indexOf("@")) < 0)
					{
							HeadErrorValue += "- " + ErrorHeadEmail + "\n";
					}

					if (bTel.value == "")
					{
							HeadErrorValue += "- " + ErrorHeadTel2 + "\n";
					}

					if (bStreet.value == "")
					{
							HeadErrorValue += "- " + ErrorHeadStreet + "\n";
					}

					if (bNumber.value == "")
					{
							HeadErrorValue += "- " + ErrorHeadNumber + "\n";
					}
					
					if (bZipcode.value == "")
					{
							HeadErrorValue += "- " + ErrorHeadZipcode + "\n";
					}

					if (bCity.value == "")
					{
							HeadErrorValue += "- " + ErrorHeadCity + "\n";
					}

					if (bHoe.value == "")
					{
							HeadErrorValue += "- " + ErrorHeadHoeBijBols + "\n";
					}

					if (bAantalpersonen.value == "")
					{
							HeadErrorValue += "- " + ErrorAantalpersonen + "\n";
					}
					
					if (bVoorkeurbegintijd.value == "")
					{
							HeadErrorValue += "- " + ErrorVoorkeurbegintijd + "\n";
					}	
						if (bVoorkeureindtijd.value == "")
					{
							HeadErrorValue += "- " + ErrorVoorkeureindtijd + "\n";
					}	

					if (bDatumDay.value == "" || bDatumDay.value == 0 || bDatumDay.value > 31  || bDatumMonth.value == "" || bDatumMonth.value == 0 || bDatumMonth.value > 21 || bDatumYear.value == "" || bDatumYear.value.length < 4 )
					{
							HeadErrorValue += "- " + ErrorHeadDatum + "\n";
					}

					if (HeadErrorValue != "")
					{
						HeadErrorValue = ErrorHeadKop + ": \n" + HeadErrorValue ;
					}

				//Error Messages samenvoegen
					if (HeadErrorValue != "")
					{
						ErrorValue += "\n" + HeadErrorValue;
					}
					
					if (VoorkeurErrorValue != "")
					{
						ErrorValue += "\n" + VoorkeurErrorValue;
					}

				//Bij fout weergeven
					if (ErrorValue != "")
					{
						alert(ErrorValue);
					}
					else
					{
						bForm.submit();
					}
		}
		else
		{
		}
	}
	
	
	function checkFaqForm()
	{
		var bForm = document.faqForm;
		if (bForm)
		{
			var ErrorValue = "";
			if (bForm.naam.value == "")
			{
				ErrorValue += "- " + ErrorFaqNaam + "\n";
			}
			
			if (bForm.email.value == "")
			{
				ErrorValue += "- " + ErrorFaqEmail + "\n";
			}
		
			if (bForm.vraag.value == "")
			{
				ErrorValue += "- " + ErrorFaqVraag + "\n";
			}

		//Bij fout weergeven
			if (ErrorValue != "")
			{
				alert(ErrorValue);
			}
			else
			{
				bForm.submit();
			}
		}
	}
	
	function checkAkForm()
	{
		var bForm = document.akForm;
		if (bForm)
		{
			var ErrorValue 			= "";
			if (bForm.redenvanafkeuring.value == "")
			{
				ErrorValue += "1"
			}
			
			if (ErrorValue == "")
			{
				bForm.submit();
			}
		}
	}
	
	function checkBookingForm()
	{
		var bForm = document.bookingForm;
		
		if (bForm)
		{
			//ErrorValues aanmaken
				var ErrorValue 			= "";
				var CourseErrorValue 	= "";
				var HeadErrorValue 		= "";
				var VoorkeurErrorValue 	= "";
				var AgreeErrorValue		= "";
				var bANaamError 		= 0;
				var bAAchternaamError 	= 0;
				var bAEmailError 		= 0;
				var ErrorAplValue 		= "";
				
			//Cursus gegevens
				var bCid			= bForm.cid;
				var bAantal			= bForm.aantal;
				var bDate			= bForm.date;
			
			//Datum korting
				if (bDate)
				{
					if (bDate.selectedIndex >= 0)
					{
						var bKorting 		= bDate.options[bDate.selectedIndex].getAttribute('korting');
					}
				}
			
			//Hoofd cursust gegevens
				var bFirstname 		= bForm.voornaam;
				var bLastname		= bForm.achternaam;		
				var bEmail			= bForm.email;
				var bTel			= bForm.tel;
				var bStreet			= bForm.straat;
				var bNumber			= bForm.nummer;
				var bZipcode		= bForm.postcode;
				var bCity			= bForm.plaats;
				var bCountry		= bForm.land;
				var bCourseType		= bForm.coursetype;
				var bBusiness		= bForm.business;
				var bLeisure		= bForm.leisure;
				var bLevel			= bForm.level;
				var bCourseLang		= bForm.taal;
				var bAgree			= bForm.agree;
				
			//Formulier checken
				//Cursus
					if (bCid.options[bCid.selectedIndex].value == "")
					{
						CourseErrorValue += "- " + ErrorCursusId + "\n";
					}
		
					if (bDate)
					{
						if (bDate.selectedIndex == -1)
						{
							CourseErrorValue += "- " + ErrorCursusDatum + "\n";
						}
					}
					else
					{
							CourseErrorValue += "- " + ErrorCursusGeenDatum + "\n";
					}
	
					if (bAantal)
					{
						if (bAantal.selectedIndex == -1)
						{
							CourseErrorValue += "- " + ErrorCursusAantal + "\n";
						}
					}
					else
					{
							CourseErrorValue += "- " + ErrorCursusGeenAantal + "\n";
					}

				
					if (CourseErrorValue != "")
					{
						CourseErrorValue = ErrorCourseKop + ": \n" + CourseErrorValue;
					}
				
				//Hoofd cursist
					if (bFirstname.value == "")
					{
							HeadErrorValue += "- " + ErrorHeadVoornaam + "\n";
					}
				
					if (bLastname.value == "")
					{
							HeadErrorValue += "- " + ErrorHeadAchternaam + "\n";
					}

					if (bBirthDay.value == "" || bBirthDay.value == 0 || bBirthDay.value > 31  || bBirthMonth.value == "" || bBirthMonth.value == 0 || bBirthMonth.value > 21 || bBirthYear.value == "" || bBirthYear.value.length < 4 )
					{
							HeadErrorValue += "- " + ErrorHeadBirthday + "\n";
					}

					if (bEmail.value == "")
					{
							HeadErrorValue += "- " + ErrorHeadEmail + "\n";
					}

					if (bStreet.value == "")
					{
							HeadErrorValue += "- " + ErrorHeadStreet + "\n";
					}

					if (bNumber.value == "")
					{
							HeadErrorValue += "- " + ErrorHeadNumber + "\n";
					}
					
					if (bZipcode.value == "")
					{
							HeadErrorValue += "- " + ErrorHeadZipcode + "\n";
					}

					if (bCity.value == "")
					{
							HeadErrorValue += "- " + ErrorHeadCity + "\n";
					}

					if (bCountry.options[bCountry.selectedIndex].value == "")
					{
							HeadErrorValue += "- " + ErrorHeadCountry + "\n";
					}
					
					if (HeadErrorValue != "")
					{
						HeadErrorValue = ErrorHeadKop + ": \n" + HeadErrorValue ;
					}
				
				//Voorkeursinstellingen
				
					if (bCourseType[0].checked == false && bCourseType[1].checked == false)
					{
							VoorkeurErrorValue += "- " + ErrorVoorkeurType + "\n";
					}
					else if (bCourseType[0].checked == true && bBusiness.options[bBusiness.selectedIndex].value == "")
					{
							VoorkeurErrorValue += "- " + ErrorVoorkeurBusiness + "\n";
					}
					else if (bCourseType[1].checked == true && bLeisure.options[bLeisure.selectedIndex].value == "")
					{
							VoorkeurErrorValue += "- " + ErrorVoorkeurLeisure + "\n";
					}
					
					if (VoorkeurErrorValue != "")
					{
						VoorkeurErrorValue = ErrorVoorkeurKop + ": \n" + VoorkeurErrorValue ;
					}
				
				//Agree vinkje
					if (bAgree.checked == false)
					{
						AgreeErrorValue += "- " + ErrorAgree + "\n";
					}

					if (AgreeErrorValue != "")
					{
						AgreeErrorValue = ErrorAgreeKop + ": \n" + AgreeErrorValue ;
					}


				//Extra cursisten				
					if (bAantal)
					{
						var totaal = bAantal.options[bAantal.selectedIndex].value;
						totaal = totaal + 1;
						
						for (vI=2; vI < totaal; vI++)
						{
							var bANaamVeld = document.getElementById("aplVoornaam"+vI);
							if(bANaamVeld)
							{
								if (bANaamVeld.value == "")
								{
									bANaamError++;
								}
							}
							
							var bAAchternaamVeld = document.getElementById("aplAchternaam"+vI);
							if(bAAchternaamVeld)
							{
								if (bAAchternaamVeld.value == "")
								{
									bAAchternaamError++;
								}
							}

							var bAEmailVeld = document.getElementById("aplEmail"+vI);
							if(bAEmailVeld)
							{
								if (bAEmailVeld.value == "")
								{
									bAEmailError++;
								}
							}
						}
					}
					
					if (bANaamError != 0)
					{
						ErrorAplValue += "- " + ErrorAplNaamValue + "\n";
					}
					
					if (bAAchternaamError != 0)
					{
						ErrorAplValue += "- " + ErrorAplAchternaamValue + "\n";
					}
					
					if (bAEmailError != 0)
					{
						ErrorAplValue += "- " + ErrorAplEmailValue + "\n";
					}

					if (ErrorAplValue != "")
					{
						ErrorAplValue = ErrorAplKop + ": \n" + ErrorAplValue ;
					}
					
					

				//Error Messages samenvoegen
					if (CourseErrorValue != "")
					{
						ErrorValue += CourseErrorValue;
					}
					
					if (HeadErrorValue != "")
					{
						ErrorValue += "\n" + HeadErrorValue;
					}
					
					if (VoorkeurErrorValue != "")
					{
						ErrorValue += "\n" + VoorkeurErrorValue;
					}

					if (AgreeErrorValue != "")
					{
						ErrorValue += "\n" + AgreeErrorValue;
					}

					if (ErrorAplValue != "")
					{
						ErrorValue += "\n" + ErrorAplValue ;
					}
					
				//Bij fout weergeven
					if (ErrorValue != "")
					{
						alert(ErrorValue);
					}
					else
					{
						bForm.submit();
					}
		}
		else
		{
		}
	}
	
	function NieuwsbriefCheckForm() {
		
		var nbForm = document.nieuwsbriefForm;
		
		if (nbForm)
		{
		var nieuwsbriefEmail = nbForm.nieuwsbriefEmail ;
		
		if (nieuwsbriefEmail.value == "" || nieuwsbriefEmail.value.indexOf("@") < 0 || nieuwsbriefEmail.value.indexOf(".",nieuwsbriefEmail.value.indexOf("@")) < 0)		
			{
			alert("" + ErrorNieuwsbriefEmailValue + "")
			}
			
		else
			{
			nbForm .submit()
			}
		}
	}
