function init(){
	externalLinks();
	if($('#start').length){
		$('#start').change(function(){
			if($(this).val().length){
				$('#eind').load('/inc/get.ajax.php', {"start": $(this).val()}, function(response){
					if(response.length){ // only show second pulldown if we get some results
						$('#loc').fadeIn(150);
					}
				});
			} else {
				$('#loc').fadeOut(150);
			}
		});
	}
	resizeBG();
	
	// Size Background image
	$(window).resize(function(){resizeBG()});

}

function resizeBG() {
	if ($(window).height() > $('#content').height()) {
	 	$('#bg img').height($(window).height());
		$('#bg img').width($('#bg img').height()/7*10);
	} else {
	 	$('#bg img').height($('#content').height());
		$('#bg img').width($('#bg img').height()/7*10);
	}
	
	$('#bg').height(($(window).height() > $('#content').height() ? $(window).height() : $('#content').height()));
	$('#bg').width(($(window).width() > $('#content').width() ? $(window).width() : $('#content').width()));

	if ($.browser.msie && parseInt($.browser.version) <= 6){
		$('#bg img').css('position', 'absolute');
	}
}

function showPopup(image){
	$('#bg_popup').show().fadeTo(150,0.8);
	$('#photo_popup').html('');
	switch(image){
		case "1":
			$('#photo_popup').html('<a href="javascript:hidePopup();"><span style="position: absolute; float:right; width: 60px;">sluiten</span><br><img src=\"images/kaart_small.jpg\" width=\"460\" height=\"270\" alt=\"Kaart\"></a>')
			break;
	}
	
	$('#photo_popup').show();
	// center popup
	$('#photo_popup').css('left', ($(document).width()/2-$('#photo_popup').width()/2) + 'px');
	$('#photo_popup').css('top', "100px");
	$('#bg_popup').click(hidePopup);
	$('#photo_popup').click(hidePopup);
}

function hidePopup() {
	$('#bg_popup').fadeTo(150, 0, function(){$(this).hide()});
	$('#photo_popup').hide();
}