// JavaScript Document
$(function(){

    $("a[rel='external']").click(function(){
		$(this).attr('target', '_blank');
	});
	
	// Start 
	$(".foto a.plaatje, .foto a.vergroot").click(function(e){
		e.preventDefault();
		
		// Huidige foto en prettyfien 
		var currentUrl = $(this).attr('href');
		var fotoset = [currentUrl];
		
		// Do AJAX call		
		$.ajax({
			url			: "/groep/images/"+$(this).data('artnr'),
			dataType	: "json",
			timeout		: 800,
			success		: function(morefotos){
				$(this).prettyPhoto();
				if(typeof(morefotos) !== 'undefined'){
					fotoset = $.merge(fotoset, morefotos);
				}
				$.prettyPhoto.open(fotoset);
			},
			error		: function(jqXHR, textStatus, errorThrown){
				$(this).prettyPhoto();
				$.prettyPhoto.open(fotoset);
			}
		});
		
		return false;
	});
	
	$(".quickLink input").click(function(){
		$(this).select();
	});
	
	$(".rollover").hide();
	
	$(".footer button").hover(function(){ $(".rollover").show(); }, function(){ $(".rollover").hide(); });
	
});
