var currentAspect = null;

$(document).ready(function() {
	$('#carousel').cycle({
		fx: 'fade'
	});
	
	/*
	 * Object page mouseover
	 */
	$('.photo-bar li img').each(function() {
		// Preload the image content
		$("<img>").attr("src", $(this).attr('alt'));
		$(this).mouseover(function() {
			aspect('image');
			$('#preview').attr('src', $(this).attr('alt'));
		});
	});
	
	$('#maps_link').click(function() {
		aspect('maps');
		return false;
	});
	$('#video_link').click(function() {
		if (currentAspect != 'video') {
			aspect('video');
			return false;
		} else {
			// If video is already opened, the button
			// will cause a direct open (in a new window)
			//window.open($(this).attr('href'));
			return false;
		}
	});
	
	// Load photo's by default
	aspect('image');
	
	$('a.printWindow').click(function() {		
		window.open($(this).attr('href'), 'Printversie', 'width=800,height=600,scrollbars=yes');
		return false;
	});
});

/*
 * Show a certain aspect
 * in object page
 */
function aspect(id) {
	if (currentAspect != id) {
		$('.previews .container').hide();
		$('#' + id + '-container').show();
		currentAspect = id;
	}
}

