//<![CDATA[

			var linkInContentClicked = false;

			function scaleAR() {
			/**
			 * scale width to keep aspect ratio,
			 * keep full height
			 */
				$('img.bg').css({
					width: '100%',
					height: '100%'
				});
				var wW = $('img.bg').width();
				var wH = $('img.bg').height();
				var iW = 1680;
				var iH = 868;
				var iAR = iW/iH;
				var wAR = wW/wH;
				if (wAR > iAR) { // window wider than image
					wH = Math.ceil(wW * iH/iW);
					$('img.bg').css({
						left: '50%',
						top: '50%',
						marginTop: '-' + (Math.ceil(wH/2)) + 'px',
						marginLeft: '-' + (Math.ceil(wW/2)) + 'px',
						height: wH + 'px',
						width: wW + 'px'
					});
				} else { // image wider than window
					wW = Math.ceil(wH * iW/iH);
					$('img.bg').css({
						left: '50%',
						top: '50%',
						marginTop: '-' + (Math.ceil(wH/2)) + 'px',
						marginLeft: '-' + (Math.ceil(wW/2)) + 'px',
						height: wH + 'px',
						width: wW + 'px'
					});
				}
			}

			$(function() {
				$('.close-me a').click(function () { // this button is only available in an 'open' element
					$('.open .hoekje, .open .info-container').fadeOut(200, function() {
						$('.open').addClass('closed').removeClass('open');
					}); 
					return(false);
				});

				$('.scroll-me a').click(function () { // do not close on click on links in content area
					linkInContentClicked = true;
				});

				$('.jScrollPaneDrag').click(function () { // do not close on drag
					linkInContentClicked = true;
				});

				// hide/open info-frames
				$('div.button').click(function () {
						var curButton = this;
						if (!linkInContentClicked) {
							if ($(curButton).is('.closed')) {
								// close other 'open' elements
								if ($('.open').length > 0) {
									$('.open .hoekje, .open .info-container').fadeOut(200, function() {
										$('.open').addClass('closed').removeClass('open');
										// open this element's children
										$(curButton).children('.hoekje, .info-container').fadeIn(500, function() {
											$(curButton).addClass('open').removeClass('closed');
										});
									}); 
								} else {
									// open this element's children
									$(curButton).children('.hoekje, .info-container').fadeIn(500, function() {
										$(curButton).addClass('open').removeClass('closed');
									});
								}
							} else {
								// close
								$('.open .hoekje, .open .info-container').fadeOut(200, function() {
									$('.open').addClass('closed').removeClass('open');
								}); 
							}
						} else {
							linkInContentClicked = false;
						}
				});

				// scrollpanes
				$('#pane1').jScrollPane({
					showArrows: false,
					topCapHeight: 10,
					scrollBarWidth: 200
				
				});
				$('#pane2').jScrollPane({
					showArrows: false,
					topCapHeight: 10,
					scrollBarWidth: 100
				});
				$('#pane3').jScrollPane({
					showArrows: false,
					topCapHeight: 10,
					scrollBarWidth: 100
				});

				// visibility/display usage switch
				$('.closed .info-container, .closed .hoekje').css({
					display: 'none',
					visibility: 'visible'
				});

				scaleAR();
				$(window).bind('resize', (scaleAR));
			});
//]]>