
	oldImage = 1;

	function showImage(afbeelding, obj, sClass) {
		
		normalClass = 'thumbnail';
		hoverClass = 'thumbnail-selected';
			
		if (sClass != '' ) {
			normalClass = 'pthumbnail';
			hoverClass = 'pthumbnail-selected';
		}
		
		if (window['oldImage']) {
			document.getElementById('photobooth' + oldImage).style.display = 'none';
			document.getElementById('thumb' + oldImage).className = normalClass;
		}
	
		document.getElementById('photobooth' + afbeelding).style.display = 'block';
		document.getElementById('thumb' + afbeelding).className = hoverClass;
		oldImage = parseFloat(afbeelding);
		
	}
	
	function scrollNextImage(sClass) {
	
		normalClass = 'thumbnail';
		hoverClass = 'thumbnail-selected';
			
		if (sClass != '' ) {
			normalClass = 'pthumbnail';
			hoverClass = 'pthumbnail-selected';
		}
		
		nextImage = parseFloat(oldImage) + 1;

		if (document.getElementById('photobooth' + nextImage) != null) {
		
			document.getElementById('photobooth' + oldImage).style.display = 'none';
			document.getElementById('photobooth' + nextImage).style.display = 'block';
			
			document.getElementById('thumb' + oldImage).className = normalClass;
			document.getElementById('thumb' + nextImage).className = hoverClass;
			
			oldImage = nextImage;
		}
		
	}
	
	function scrollPreviousImage(sClass) {
	
		normalClass = 'thumbnail';
		hoverClass = 'thumbnail-selected';
			
		if (sClass != '' ) {
			normalClass = 'pthumbnail';
			hoverClass = 'pthumbnail-selected';
		}
		
		previousImage = parseFloat(oldImage) - 1;
		
		if (document.getElementById('photobooth' + previousImage) != null) {
		
			document.getElementById('photobooth' + oldImage).style.display = 'none';
			document.getElementById('photobooth' + previousImage).style.display = 'block';
			
			document.getElementById('thumb' + oldImage).className = normalClass;
			document.getElementById('thumb' + previousImage).className = hoverClass;
			
			oldImage = previousImage;
		}

	}
	
	function displayHarmonica(harmonicaId) {
	
		harmonicaObject = document.getElementById('harmonica' + harmonicaId);
		harmonicaPijl = document.getElementById('harmonicapijl' + harmonicaId);
		
		if (harmonicaObject.style.display == 'none') {
			harmonicaObject.style.display = 'block';
			harmonicaPijl.src = '/img/pijlbeneden.gif';
		} else {
			harmonicaObject.style.display = 'none';
			harmonicaPijl.src = '/img/pijlrechts.gif';
		}
	
	}
	
	function displayHotelHarmonica(harmonicaId) {
	
		harmonicaObject = document.getElementById('hotel-harmonica' + harmonicaId);
		harmonicaSpacer = document.getElementById('hotel-spacer' + harmonicaId);
		harmonicaPijl = document.getElementById('hotel-harmonicapijl' + harmonicaId);
		
		if (harmonicaObject.style.display == 'none') {
			harmonicaObject.style.display = 'block';
			harmonicaSpacer.style.display = 'none';
			harmonicaPijl.src = '/img/pijlbeneden.gif';
		} else {
			harmonicaObject.style.display = 'none';
			harmonicaSpacer.style.display = 'block';
			harmonicaPijl.src = '/img/pijlrechts.gif';
		}
	
	}
	
	function loadScrollHover(obj) {
		
		
			document.getElementById('maple' + obj).firstChild.style.color = '#000';
		
		document.getElementById('href' + obj).style.color = '#000';
		
		scrollCS = document.getElementById('scrollCS' + obj);
		scrollCS.oColor = scrollCS.style.backgroundColor;
		scrollCS.oClass = scrollCS.className;
		
		scrollCS.style.backgroundImage = "url(/img/pijl_rechts_hover.gif)";
		scrollCS.style.backgroundColor = '#c38e41';
		
	}
	
	function removeScrollHover(obj) {
		
		
			document.getElementById('maple' + obj).firstChild.style.color = '#fff';
		
		document.getElementById('href' + obj).style.color = '#fff';
		
		scrollCS = document.getElementById('scrollCS' + obj);
		
		if (scrollCS.oClass == 'scrollitemLight') {
			scrollCS.style.backgroundImage = "url(/img/pijl_licht.jpg)";
			scrollCS.style.backgroundColor = '#bb822b';
		} else {
			scrollCS.style.backgroundImage = "url(/img/pijl_donker.jpg)";
			scrollCS.style.backgroundColor = '#b37312';
		}
	
	}
	
	function verwijderHotel(hotel) {
		document.getElementsByName('kassa-id')[0].value = hotel;
		document.forms['kassa-form'].submit();
	}
	
	function verwijderArtikel(articleId) {
	
		doXmlRequest("/xml/verwijder_product.php?articleid=" + articleId, function() {

			

			eval(globalXmlData);
			
			//returnAmount = parseFloat(returnArr[0]);// parseFloat(globalXmlData);
			returnAmount = parseFloat(totaal);

			if (countProducts == 0) {
				
				if (document.getElementById('productReserveFee')) {
					var c = document.getElementById('productReserveFee');
					var p = c.parentNode;
					p.removeChild(c);
				}
			}

			document.getElementById('totalAmount').innerHTML = '&nbsp;&euro;&nbsp;' + returnAmount.toFixed(2);
			//= '&nbsp;&euro;&nbsp;' + globalVars['totaal'].toFixed(2);
			
			//cnode = document.getElementById('product' + articleId);
			//pnode = document.getElementById('product' + articleId).parentNode;
			cnode = document.getElementById('lblproduct' + articleId);
			pnode = document.getElementById('lblproduct' + articleId).parentNode;
			
			pnode.removeChild(cnode);

		});
	
		
	}
	
	function init() {
		
		if (document.getElementById('scrollphoto')) {
			
			oldObject = 1;
		}
		
		if (document.getElementById('promotiebalk')) {
		
		
		
		}
		
	}

	function recalculateSuppAll(obj) {
		
		/*update: 6 juni 2008, de sup. allin tickets zijn op*/
		
		postVars = 'supAll=' + obj.value;

		doXmlRequest('xml/supplement.php', function() {
			singleCalculate();
			

		}, 'POST', postVars);

	}

	function recalculateDaytickets(obj, day) {
		
		postVars = 'dayTickets=' + obj.value;
		postVars += '&day=' + day;

		doXmlRequest('xml/daytickets.php', function() {
			
			singleCalculate();

		}, 'POST', postVars);

	}
	
	function recalculateProduct(obj, productKey) {
		
		postVars = 'product_aantal=' + obj.value;
		postVars += '&productkey=' + productKey;

		doXmlRequest('xml/product.php', function() {
		
			singleCalculate();			

		}, 'POST', postVars);

	}
	
	function singleCalculate() {
	
		doXmlRequest('/xml/calculate.php', function() {
		
			eval(globalXmlData);
		

			/*update: 6 juni 2008, de sup. allin tickets zijn op*/
			selObj = document.getElementsByName('ticketsSuppAll')[0];
			oValue = selObj.value;
			selObj.options.length = 0;

			for (i = 0; i < (globalVars['totaalTickets3d']  + 1); i++) {
				v = i + 0;
				x = new Option(v, v);
				selObj.options[i] =  x;
				if (oValue == v ) {
					selObj.selectedIndex = i;
				}
			}

			for (i in globalVars['producten']) {

				if (document.getElementById('totalproduct' + i)) {
					document.getElementById('totalproduct' + i).innerHTML = '&nbsp;&euro;&nbsp;' + globalVars['producten'][i].toFixed(2);
				}
			}

			/*
			if (oValue < globalVars['kamers']) {
				oValue = globalVars['kamers'];
			}*/
			
			for (i in prijzenArray) {
				document.getElementById('total' + i).innerHTML = '&nbsp;&euro;&nbsp;' + prijzenArray[i].toFixed(2);
			}

			c = 0;
			
			
			document.getElementById('totalAmount').innerHTML = '&nbsp;&euro;&nbsp;' + globalVars['totaal'].toFixed(2);
			document.getElementById('suppAllPrice').innerHTML = '&nbsp;&euro;&nbsp;' + globalVars['supAllPrijs'].toFixed(2);
			if (document.getElementById('lblDayTickets1')) {
				document.getElementById('lblDayTickets1').innerHTML = '&nbsp;&euro;&nbsp;' + globalVars['dayTickets'].toFixed(2);
			}

		});
	
	}


	function recalculateAll(sKey) {


		postVars = 'key=' + sKey;

		temp = document.getElementById('tempVar' + sKey).value;
		parts = temp.split(';');
		rooms = parts[0].split(',');
		roomArray = Array();

		for (i = 0; i < rooms.length; i++) {
			if (document.getElementsByName('hotel' + rooms[i])[0]) {
				postVars += '&room' + rooms[i] + '='  + document.getElementsByName('hotel' + rooms[i])[0].value;
			}
		}

		postVars += '&tickets3d='  + document.getElementsByName('tickets' + sKey)[0].value;
		postVars += '&arrival='  + document.getElementsByName('arrival' + sKey)[0].value;
		postVars += '&departure='  + document.getElementsByName('departure' + sKey)[0].value;
	

		doXmlRequest('/xml/calculate.php', function() {
			
			eval(globalXmlData);
			
			for (i in prijzenArray) {
				document.getElementById('total' + i).innerHTML = '&nbsp;&euro;&nbsp;' + prijzenArray[i].toFixed(2);
			}

		
			selObj = document.getElementsByName('ticketsSuppAll')[0];
			
			oValue = selObj.value;
			selObj.options.length = 0;

			//supplement tickets afhandeling, deze mogen nooit een hogere waarde hebben
			//als de 3day tickets
			for (i = 0; i < (globalVars['totaalTickets3d'] + 1); i++) {
				
				v = i + 0;
				x = new Option(v, v);
				selObj.options[i] =  x;
				if (oValue == v ) {
					selObj.selectedIndex = i;
				}
			}
		
			

			//selObj = document.getElementsByName('selDaytickets1')[0];
			//oValue = selObj.value;
			/*selObj.options.length = 0;


			for (i = 0; i < (30); i++) {
				
				v = i + 0;
				x = new Option(v, v);
				selObj.options[i] =  x;
				if (oValue == v ) {
					selObj.selectedIndex = i;
				}
			}*/

			

			selObj = document.getElementsByName('tickets'+ sKey)[0];
			oValue = selObj.value;
			selObj.options.length = 0;

			if (oValue < globalVars['kamers']) {
				oValue = globalVars['kamers'];
			}
			
			c = 0;
		
			globalVars['kamers'] > 0 ? ticketsMax = (globalVars['kamers'] + 20) : ticketsMax = 1;
			for (i = globalVars['kamers']; i < ticketsMax; i++) {
				
				x = new Option(i, i);
				selObj.options[c] =  x;
				if (oValue == i ) {
					selObj.selectedIndex = c;
				}

				c++;

			}
			
			
			for (i in globalVars['producten']) {
				continue;
				//selObj = document.getElementsByName('product' + i)[0];

				if (typeof document.getElementsByName('product' + i)[0] == 'undefined') {
					continue;
				}

				selObj = document.getElementsByName('product' + i)[0];
				oValue = selObj.value;
				selObj.options.length = 0;

				c = 0;
				xmax = 20;

				if (globalVars['kamers'] == 0) {
					xmax = 1;
				}

				xmin = 1;

				for (i = xmin; i < (globalVars['kamers'] + xmax); i++) {
					
					x = new Option(i, i);
					selObj.options[c] =  x;
					if (oValue == i ) {
						selObj.selectedIndex = c;
					}

					c++;

				}
				
			}
			
			
			
			document.getElementById('total' + sKey).innerHTML = '&nbsp;&euro;&nbsp;' + globalVars['tickets3d'].toFixed(2);
			document.getElementById('subtotal' + sKey).innerHTML = '&nbsp;&euro;&nbsp;' + globalVars['subtotaal'].toFixed(2);
			document.getElementById('subtotaalExtra' + sKey).innerHTML =  globalVars['extradagen'] + ' extra nights &euro; ' + globalVars['extradagen_prijs'].toFixed(2);
			document.getElementById('totalAmount').innerHTML = '&nbsp;&euro;&nbsp;' + globalVars['totaal'].toFixed(2);
			//update: 6 juni 2008, de sup. allin tickets zijn op
			//document.getElementById('suppAllPrice').innerHTML = '&nbsp;&euro;&nbsp;' + globalVars['supAllPrijs'].toFixed(2);
			//document.getElementById('lblDayTickets1').innerHTML = '&nbsp;&euro;&nbsp;' + globalVars['dayTickets'].toFixed(2);


		}, 'POST',postVars);

	}




	function highlightHarmonica(harmonicaId, bool) {
	
		
		
		if (bool) {
		
			obj = document.getElementById('xid' + harmonicaId);
			obj.oClass = obj.className;
						
			document.getElementById('xid' + harmonicaId).style.backgroundImage = 'url(/img/hh-pijl-select.gif)';
			document.getElementById('xid' + harmonicaId).style.backgroundColor = '#c6a973';
			document.getElementById('xid' + harmonicaId).style.color = '#000';
			document.getElementById('t' + harmonicaId).style.color = '#000';
			document.getElementById('href' + harmonicaId).style.color = '#000';
			
		} else {
			
			document.getElementById('t' + harmonicaId).style.color = '#fff';
			document.getElementById('href' + harmonicaId).style.color = '#fff';
			
			if (obj.oClass == 'scrollitemLight') {
				obj.style.backgroundImage = "url(/img/hh-pijl-licht.gif)";
				obj.style.backgroundColor = '#ac8035';
			} else {
				obj.style.backgroundImage = "url(/img/hh-pijl-donker.gif)";
				obj.style.backgroundColor = '#a27224';
			}
		
		}
				
	}

	function preSubmit(form) {

		required = Array(
			
			'gender', 
			'achternaam', 
			'initials',
			'straat', 
			'huisnr',
			'postcode', 
			'plaats', 
			'land', 
			'phone',
			'email'

		);

		doContinue = true;

		for (i in required) {
			
			if (typeof document.getElementsByName(required[i])[0] != 'undefined') {
				obj = document.getElementById('lbl_' + required[i]);
				val = document.getElementsByName(required[i])[0].value;
				obj.style.color = '#fff';
	
				if (val == '') {
					doContinue = false;
					obj.style.backgroundColor = '#c06325';
					obj.style.color = '#fff';
				}
			}

		}

		re = new RegExp("[a-zA-Z0-9\.-_]+?(@[a-zA-Z0-9-_]+?)\\.{1}", 'gi');
		e = document.getElementsByName('email')[0].value;
		m = e.match(re);

		if (m == null) {
			document.getElementById('lbl_email').style.color = '#fff';
			doContinue = false;
		}

		number_fields = Array('huisnr', 'phone');

		for (i in number_fields) {
			
			
				obj = document.getElementById('lbl_' + number_fields[i]);
				val = document.getElementsByName(number_fields[i])[0].value;
	
				re = new RegExp("[0-9\\+\\(\\)\\-]+?", "gi");
				m = val.match(re);
	
				if (m == null) {
					obj.style.backgroundColor = '#c06325';
					obj.style.color = '#fff';
					doContinue = false;
				}
			
		}

		if (!doContinue) {
			alert('Not all the required fields are filled.' + "\nRequired fields are marked with *");
		}


		return doContinue;

	}


	function checkForm(form) {

		required = Array(
		
			'achternaam',
			'telefoon',
			'email'

		);

		doContinue = true;

		for (i in required) {

			obj = document.getElementById('lbl_' + required[i]);
			val = document.getElementsByName(required[i])[0].value;
			obj.style.color = '#fff';

			if (val == '') {
				doContinue = false;
				obj.style.color = '#ff0000';
			}

		}

		re = new RegExp("[a-zA-Z0-9\.-_]+?(@[a-zA-Z0-9-_]+?)\\.{1}", 'gi');
		e = document.getElementsByName('email')[0].value;
		m = e.match(re);

		if (m == null) {
			document.getElementById('lbl_email').style.color = '#ff0000';
			doContinue = false;
		}

		number_fields = Array('telefoon');

		for (i in number_fields) {
			
			obj = document.getElementById('lbl_' + number_fields[i]);
			val = document.getElementsByName(number_fields[i])[0].value;

			re = new RegExp("[0-9\\+\\(\\)\\-]+?", "gi");
			m = val.match(re);

			if (m == null) {
				obj.style.color = '#ff0000';
				doContinue = false;
			}

		}

		if (!doContinue) {
			alert('Not all the required fields are filled.' + "\nRequired fields are marked with *");
		}


		return doContinue;

	}

	function totals(f) {

		doXmlRequest('/xml/totals.php', function() {
			total = parseFloat(globalXmlData);	

			if (isNaN(total)) {
				return false;
			}

			if (total > 0) {
				f.submit();
			}
		});
		
		return false;

	}
