   function togglevis(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block')
          e.style.display = 'none';
       else
          e.style.display = 'block';
    }

function displayGallery(blnDir){

	var j = photos.length;

	switch (blnDir)
  	{
  	case -1: //top
		curpos = 0;
		break;
	case 0: //up
		curpos -= 3;
		if (curpos<0) curpos+=j;
		break;
	case 1: //down
		curpos = (curpos+3)%j;
		break;
	}

	var img1 = document.getElementById('galimg1')
	var img2 = document.getElementById('galimg2')
	var img3 = document.getElementById('galimg3')

	img1.setAttribute('src',photos[(curpos+0)%j]); img1.setAttribute('onclick','showPopup(this);');
	img2.setAttribute('src',photos[(curpos+1)%j]); img2.setAttribute('onclick','showPopup(this);');
	img3.setAttribute('src',photos[(curpos+2)%j]); img3.setAttribute('onclick','showPopup(this);');
}	

function showPopup(elm) {
	var str = elm.src
	str = str.replace("/240/", "/800/")
	window.open(str,'Brødrene Hansen','width=800,height=600,menubar=no,status=no')
}
var curpos
displayGallery(-1);
