function showPic(foto) {
x=10;
y=10;
width=400;
height=298;
if(window.screen){
 per_ancho=(width/800)*100;//porcentaje screen-ancho
 per_alto=(height/width)*100;//porcentaje de ancho-alto
 win_ancho=(screen.width*per_ancho)/100;//ancho de la ventana
 win_alto=(win_ancho*per_alto)/100;//alto de la ventana
 x=(screen.width-win_ancho)/2;//centra x
 y=(screen.height-win_alto)/2;//centra y
 y=y-40;
 if (y<0) {
  y=0;
  }
 }
 s="showpic2.html?pic="+foto;
w=window.open(s,"picshow","width="+width+",height="+height+",left="+x+",top="+y+",resizable=0,status=1,toolbar=0,scrollbars=0");
if (window.screen) {
 w.focus();
 }
}


function rnd(wat) {
 return Math.floor(wat * Math.random());
}

var nextSmallBol = "";
var nextBigBol = "";

function startBollen() {
 nextSmallBol = bollen[0];
 nextBigBol = bollen[1];
 setInterval("changeBollen()", 7000);
}

function changeBollen() {
 var simg = new Image();
 var bimg = new Image();

 var smallfoto = bollen[rnd(7)];
 var bigfoto = bollen[rnd(7)];

 if (smallfoto == nextSmallBol) smallfoto = bollen[rnd(7)];
 if (bigfoto == nextBigBol) bigfoto = bollen[rnd(7)];

 if (bigfoto == smallfoto) bigfoto = bollen[rnd(7)];

 nextBigBol = bigfoto;
 nextSmallBol = smallfoto;

 simg.src = "assets/images/bollen/klein/"+smallfoto;
 bimg.src = "assets/images/bollen/groot/"+bigfoto;

 bimg.onload = setBigBol;
 simg.onload = setSmallBol;
}

function setBigBol() {
 document.getElementById("bigbol").src = "assets/images/bollen/groot/"+nextBigBol;
}

function setSmallBol() {
 document.getElementById("smallbol").src = "assets/images/bollen/klein/"+nextSmallBol;
}
