﻿
var isIE = document.all;
var isNN = !document.all && document.getElementById;
var isN4 = document.layers;
var nn = document.layers ? true : false;
var DOM2 = document.getElementById ? true : false;


var slideShowSpeed = 5000
var crossFadeDuration = 3
var Pic = new Array() 
Pic[0] = 'img/sl2.jpg'
Pic[1] = 'img/sl3.jpg'
Pic[2] = 'img/sl1.jpg'
Pic[3] = 'img/sl4.jpg'
Pic[4] = 'img/sl5.jpg'
Pic[5] = 'img/sl6.jpg'
Pic[6] = 'img/sl7.jpg'

var t
var j = 0
var p = Pic.length

var preLoad = new Array()
for (i = 0; i < p; i++){
   preLoad[i] = new Image()
   preLoad[i].src = Pic[i]
}

function runSlideShow(){
   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=2)"
      document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()      
   }
   document.images.SlideShow.src = preLoad[j].src
   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play()
   }
   j = j + 1
   if (j > (p-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
}

function video(id) {   
    var lin = "<object width='560' height='344'><param name='movie' value='http://www.youtube.com/v/"+id+"&hl=it_IT&fs=1&'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='http://www.youtube.com/v/"+id+"&hl=it_IT&fs=1&' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='560' height='344'></embed></object>";
    tiplayer = nn ? document.layers.tip : DOM2 ? document.getElementById("videoS") : document.all.tooltip
    if (nn) {
        tiplayer.document.open(); tiplayer.document.write(lin); tiplayer.document.close();
    }
    else tiplayer.innerHTML = lin;
}
