var Pic = new Array();
Pic[0]='immagini/velocita.jpg';
Pic[1]='immagini/continuita.jpg';
Pic[2]='immagini/flessibilita.jpg';
Pic[3]='immagini/globalita.jpg';

var currPageID = Math.floor(Math.random() * Pic.length);
var nextPageID = currPageID;


function slideShow() {

  document.getElementById('slideText_'+currPageID).style.display = 'none';
  document.getElementById('squarePage_'+currPageID).src = 'immagini/page.gif';

  currPageID = nextPageID;

  transition = "progid:DXImageTransform.Microsoft.Fade(duration=2)";
  if ((navigator.appName != "Netscape") && (navigator.appName != "Opera")) {
    document.getElementById('mainImage').style.filter = transition;
    document.getElementById('mainImage').filters[0].Apply();
  }

  document.getElementById('mainImage').style.background = 'url("'+Pic[currPageID]+'")';

  if ((navigator.appName != "Netscape") && (navigator.appName != "Opera")) {
    document.getElementById('mainImage').filters[0].Play();
  }

  document.getElementById('slideText_'+currPageID).style.display = '';
  document.getElementById('squarePage_'+currPageID).src = 'immagini/page_red.gif';

  nextPageID = currPageID + 1;
  if (nextPageID > Pic.length-1) {
    nextPageID = 0;
  }

  tx = setTimeout('slideShow()', 6000);

}

function changePage(newPageID) {

  clearTimeout(tx);

  nextPageID = newPageID;
  slideShow();

}

function overOutPage(pageID, overOut) {

  if (overOut == 1) {
    if (pageID != currPageID) {
      document.getElementById('squarePage_'+pageID).src = 'immagini/page_grey.gif';
    }
  } else {
      if (pageID != currPageID) {
        document.getElementById('squarePage_'+pageID).src = 'immagini/page.gif';
      }
  }

}
