﻿numShowsBubbles = 3;
numImagesBubbles = 2;

currentShowBubbles = 0;
currentImageBubbles = 0;

imageInterval = window.setInterval("changeImage();", 3000);


function changeImage(){

	var imgid;

    currentShowBubbles++;
    currentImageBubbles++;

    if (currentShowBubbles > numShowsBubbles) {
       currentShowBubbles = 1;
    }

    if (currentImageBubbles > numImagesBubbles) {
       currentImageBubbles = 1;
    }
       
    if (currentShowBubbles == 2) {
       if (currentImageBubbles == 2) {
          imgid = '108';
       } else {
          imgid = '107';
       }
    } else if (currentShowBubbles == 3){
       if (currentImageBubbles == 2) {
          imgid = '109';
       } else {
          imgid = '110';
       }
    } else {
       if (currentImageBubbles == 2) {
          imgid = '105';
       } else {
          imgid = '106';
       }
    }

     $("#imageani" + currentShowBubbles).fadeOut("slow", function() {
          $("#imageani" + currentShowBubbles).css({'background-image': 'url(/__/frontend/handler/image.php?id=' + imgid + ')' },               
             $("#imageani" + currentShowBubbles).fadeIn("slow"))
      });
 
}

