$(document).ready(function(){
						   
	//$('.fancybox').fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'zoomSpeedChange':100, 'overlayShow': true }); 

	$(".alert").animate({ height:'show', opacity:'show' }, 'slow');
	
	$('.blank').attr('target','_blank');
	
	// afgekeurd
	//$('.zoom').jqzoom({ zoomWidth: 194, zoomHeight: 184, title: false, xOffset: 30, yOffset: 135 });

	
	
	// CLICK THUMB SCHILDERIJ
	$('ul.thumbs a').click(function(){
									
		// active thumb
		$("ul.thumbs a").each(function(i){
			$(this).removeClass("active");
		});
		$(this).addClass("active");
		
		// active nav
		$("a.home").removeClass("active");
		$("a.werk").addClass("active");
		$("a.contact").removeClass("active");
		
		// ajax: load content
		var href = $(this).attr("href");
		$("#content").load(href + " #content div");
		return false;
	});
	
	
	
	// ZOOM SCHILDERIJ
	$('div.foto img').live("mouseover",function(){
		$('.detail').fadeIn(300);
		
		var si = $(this).offset();
		si.width = $(this).width();
		si.height = $(this).height();
		
		var bi = new Object();
		bi.width = $('.detail img').width();
		bi.height = $('.detail img').height();
		
		$(this).mousemove(function(e){
			si.x = (e.pageX-si.left)/si.width;
			si.y = (e.pageY-si.top)/si.height;
			
			if(si.x > 1){ si.x = 1; }
			if(si.y > 1){ si.y = 1; }
			
			bi.x = si.x * (194-bi.width);
			bi.y = si.y * (194-bi.height);
			
			$('.detail img').css({'left' : bi.x+'px', 'top' : bi.y+'px'});
			
		});
	});
	
	$('div.foto img').live("mouseout",function(){
		$('.detail').fadeOut(300);
	});
	
	
	
	// HSCROLL THUMBS #PAINTINGS
	var scroll_int;
	var scroll_dir;
	var scroll_pos = $('ul.thumbs').position();
	var scroll_holder = $('#paintings').width();
	var scroll_content = $('ul.thumbs').width();
	
	
	$('a.prev').bind("mouseenter",function(){
		scroll_dir = $(this).attr("class");
		scroll_int = setInterval(scrollTxt, 40);
	});
	
	$('a.next').bind("mouseenter",function(){
		scroll_dir = $(this).attr("class");
		scroll_int = setInterval(scrollTxt, 40);
	});
	
	$('a.prev').bind("mouseleave",function(){
		scroll_dir = "";
		clearTimeout(scroll_int);
	});
	
	$('a.next').bind("mouseleave",function(){
		scroll_dir = "";
		clearTimeout(scroll_int);
	});
	
	function scrollTxt()
	{
		if(scroll_dir=="next"){
			scroll_pos.left -= 5;
			$('ul.thumbs').css("left", scroll_pos.left+"px");
		}
		if(scroll_dir == "prev"){
			scroll_pos.left += 5;
			if(scroll_pos.left > 50){ scroll_pos.left = 50; }
			$('ul.thumbs').css("left", scroll_pos.left+"px");
		}
	}
	
	
});
