//$(document).ready(function ( ) {
(function ( ) {
	var $images	=	$(".thumb_foto img"),
	    $image	=	$("#foto_frame"),
	    current	=	0,
	    $next	=	$(".next"),
	    $prev	=	$(".prev"),
	    i, showImage, showPhotoTabs;
	
	showImage	=	function ( ) {
		$image.attr({"src": $($images[current]).attr("src")});
	};
	
	showPhotoTabs	=	function ( ) {
		if ($("#omschrijving").is(":visible")) {
			images[1].onclick();
		}
	};
	
	for (i = 0; i < $images.length; i++) {
		$($images[i]).attr({"index": i});
	}
	
	$images.click(function ( ) {
		current	=	+$(this).attr("index") || 0;
		showImage();
	});
	
	$prev.click(function ( ) {
		if (current > 0) {
			current	-=	1;
		} else {
			current	=	$images.length - 1;
		}
		showImage();
		showPhotoTabs();
		return false;
	});
	
	$next.click(function ( ) {
		if (current < $images.length - 1) {
			current	+=	1;
		} else {
			current	=	0;
		}
		showImage();
		showPhotoTabs();
		return false;
	});
}());

//var foto_divs	=	new Array();
//var foto_fotos	=	new Array();

//var image_frame	=	""

//var i_fotos	=	0;

//function Rollover_fotos(){

//	image_frame	=	document.getElementById("foto_frame");

//	var divs	=	document.getElementsByTagName("div");
//	
//	for(var i = 0; i < divs.length; i++){
//	
//		if(rollover = divs[i].getAttribute("rollover")){
//		
//			this.add(divs[i]);
//		
//		}
//	
//	}

//}

//Rollover_fotos.prototype.add	=	function(div){

//	foto_divs[i_fotos]			=	div;
//	foto_fotos[i_fotos]			=	document.getElementById("foto"+(i_fotos + 1))
//	
//	var div					=	i_fotos;
//	
//	foto_fotos[i_fotos].onclick		=	function(){ Rollover_fotos.prototype.click(div) }
//	
//	i_fotos++;
//	
//}

//Rollover_fotos.prototype.click	=	function(div){

//	image_frame.src	=	foto_fotos[div].src

//}

