//<b></b>var stile = "top=0, left=0, width=500, height=400, status=no, menubar=no, toolbar=no, scrollbars=yes";
     function Popup(apri) {
        window.open(apri, "", stile);
     }

var stile = "top=0, left=0, width=591, height=587, status=no, menubar=no, toolbar=no scrollbar=no";
     function popup_car(apri) {
        window.open(apri, "", stile);
     }

var slideShowSpeed = 4000

var crossFadeDuration = 10

var Pic = new Array()

Pic[0] = 'images/header13.gif'
Pic[1] = 'images/header12.gif'
Pic[2] = 'images/header14.gif'
Pic[3] = 'images/header15.gif'
Pic[4] = 'images/header25.gif'
Pic[5] = 'images/header22.gif'
Pic[6] = 'images/header21.gif'
Pic[7] = 'images/header23.gif'
Pic[8] = 'images/header24.gif'
Pic[9] = 'images/header12.gif'

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]
}

//Funzioni per immagini nell'header

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)
}


//Funzione per le immagini nella pagina itinerari.php

var Itinerari = new Array()

Itinerari[0] = 'images/itinerari/nome2.gif'
Itinerari[1] = 'images/itinerari/nome3.gif'
Itinerari[2] = 'images/itinerari/nome4.gif'
Itinerari[3] = 'images/itinerari/nome5.gif'
Itinerari[4] = 'images/itinerari/nome6.gif'
Itinerari[5] = 'images/itinerari/nome7.gif'
Itinerari[6] = 'images/itinerari/nome8.gif'
Itinerari[7] = 'images/itinerari/nome9.gif'
Itinerari[8] = 'images/itinerari/nome10.gif'
Itinerari[9] = 'images/itinerari/nome1.gif'



var tItinerari
var jItinerari = 0
var pItinerari = Itinerari.length

var preLoadItinerari = new Array()
for (iItinerari = 0; iItinerari < pItinerari; iItinerari++){
   preLoadItinerari[iItinerari] = new Image()
   preLoadItinerari[iItinerari].src = Itinerari[iItinerari]
}

function runSlideShowItinerari(){
   if (document.all){
      document.images.SlideShowItinerari.style.filter="blendTrans(duration=2)"
      document.images.SlideShowItinerari.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShowItinerari.filters.blendTrans.Apply()      
   }
   document.images.SlideShowItinerari.src = preLoadItinerari[jItinerari].src
   if (document.all){
      document.images.SlideShowItinerari.filters.blendTrans.Play()
   }
   jItinerari = jItinerari + 1
   if (jItinerari > (pItinerari-1)) jItinerari=0
   tItinerari = setTimeout('runSlideShowItinerari()', slideShowSpeed)
}


//Funzione per le immagini nella pagina itinerari.php


var PicLocanda = new Array()

PicLocanda[0] = 'images/itinerari/matera.jpg'
PicLocanda[1] = 'images/itinerari/castel-del-monte.jpg'
PicLocanda[2] = 'images/itinerari/castellana-grotte.jpg'
PicLocanda[3] = 'images/itinerari/lecce2.gif'
PicLocanda[4] = 'images/itinerari/locorotondo.jpg'
PicLocanda[5] = 'images/itinerari/martina-franca.jpg'
PicLocanda[6] = 'images/itinerari/ostuni.gif'
PicLocanda[7] = 'images/itinerari/zoo1.jpg'
PicLocanda[8] = 'images/itinerari/polignano.jpg'
PicLocanda[9] = 'images/itinerari/alberobello.jpg'

var tLocanda
var jLocanda = 0
var pLocanda = PicLocanda.length

var preLoadLocanda = new Array()
for (iLocanda = 0; iLocanda < pLocanda; iLocanda++){
   preLoadLocanda[iLocanda] = new Image()
   preLoadLocanda[iLocanda].src = PicLocanda[iLocanda]
}

function runSlideShowLocanda(){
   if (document.all){
      document.images.SlideShowLocanda.style.filter="blendTrans(duration=2)"
      document.images.SlideShowLocanda.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShowLocanda.filters.blendTrans.Apply()      
   }
   document.images.SlideShowLocanda.src = preLoadLocanda[jLocanda].src
   if (document.all){
      document.images.SlideShowLocanda.filters.blendTrans.Play()
   }
   jLocanda = jLocanda + 1
   if (jLocanda > (pLocanda-1)) jLocanda=0
   tLocanda = setTimeout('runSlideShowLocanda()', slideShowSpeed)
}


//Funzione per le immagini nella pagina mappa.php

var Mappa = new Array()

Mappa[0] = 'images/mappa_2.gif'
Mappa[1] = 'images/mappa.gif'


var tMappa
var jMappa = 0
var pMappa = Mappa.length

var preLoadMappa = new Array()
for (iMappa = 0; iMappa < pMappa; iMappa++){
   preLoadMappa[iMappa] = new Image()
   preLoadMappa[iMappa].src = Mappa[iMappa]
}

function runSlideShowMappa(){
   if (document.all){
      document.images.SlideShowMappa.style.filter="blendTrans(duration=2)"
      document.images.SlideShowMappa.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShowMappa.filters.blendTrans.Apply()      
   }
   document.images.SlideShowMappa.src = preLoadMappa[jMappa].src
   if (document.all){
      document.images.SlideShowMappa.filters.blendTrans.Play()
   }
   jMappa = jMappa + 1
   if (jMappa > (pMappa-1)) jMappa=0
   tMappa = setTimeout('runSlideShowMappa()', slideShowSpeed)
}



//Funzione per le immagini nella pagina camera.php


var Camere = new Array()

Camere[0] = 'images/camere/camera2.jpg'
Camere[1] = 'images/camere/bagno16.jpg'
Camere[2] = 'images/camere/camera3.jpg'
Camere[3] = 'images/camere/bagno17.jpg'
Camere[4] = 'images/camere/camera4.jpg'
Camere[5] = 'images/camere/bagno1.gif'
Camere[6] = 'images/camere/camera5.jpg'
Camere[7] = 'images/camere/bagno3.gif'
Camere[8] = 'images/camere/camera9.jpg'
Camere[9] = 'images/camere/bagno4.gif'
Camere[10] = 'images/camere/camera8.jpg'
Camere[11] = 'images/camere/bagno5.gif'
Camere[12] = 'images/camere/camera1.jpg'

var tCamere
var jCamere = 0
var pCamere = Camere.length

var preLoadCamere = new Array()
for (iCamere = 0; iCamere < pCamere; iCamere++){
   preLoadCamere[iCamere] = new Image()
   preLoadCamere[iCamere].src = Camere[iCamere]
}

function runSlideShowCamere(){
   if (document.all){
      document.images.SlideShowCamere.style.filter="blendTrans(duration=2)"
      document.images.SlideShowCamere.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShowCamere.filters.blendTrans.Apply()      
   }
   document.images.SlideShowCamere.src = preLoadCamere[jCamere].src
   if (document.all){
      document.images.SlideShowCamere.filters.blendTrans.Play()
   }
   jCamere = jCamere + 1
   if (jCamere > (pCamere-1)) jCamere=0
   tCamere = setTimeout('runSlideShowCamere()', slideShowSpeed)
}




function startmenu()
{
	document.getElementById('menu1').style.display = "none";
}

function menufunc(menuId)
{
	if(document.getElementById(menuId).style.display == "none")
	{
		startmenu();
		document.getElementById(menuId).style.display = "block";
	}
	else
	{
		startmenu();
	}
}



function openPictureWindow_Fever(imageType,imageName,imageWidth,imageHeight,alt,posLeft,posTop) {  // v4.01
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",scrollbars=no,left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">'); 
	if (imageType == "swf"){
	newWindow.document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('<param name=movie value=\"'+imageName+'\"><param name=quality value=high>');
	newWindow.document.write('<embed src=\"'+imageName+'\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('</embed></object>');	}else{
	newWindow.document.write('<img src=\"'+imageName+'\" width='+imageWidth+' height='+imageHeight+' alt=\"'+alt+'\">'); 	}
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

//Funzione per le immagini nella pagina bed&breakfast.php

var PicRistorante = new Array()

PicRistorante[0] = 'images/ristorante/foto1.gif'
PicRistorante[1] = 'images/ristorante/rist2.jpg'
PicRistorante[2] = 'images/ristorante/foto2.gif'
PicRistorante[3] = 'images/ristorante/rist3.jpg'
PicRistorante[4] = 'images/ristorante/foto3.gif'
PicRistorante[5] = 'images/ristorante/rist4.jpg'
PicRistorante[6] = 'images/ristorante/foto4.gif'
PicRistorante[7] = 'images/ristorante/foto7.gif'
PicRistorante[8] = 'images/ristorante/foto8.gif'
PicRistorante[9] = 'images/ristorante/foto9.gif'
PicRistorante[9] = 'images/ristorante/foto10.gif'
PicRistorante[10] = 'http://www.tenutamartinelli.it/home/images/ristorante/ristorante4.jpg'
PicRistorante[11] = 'images/ristorante/rist1.jpg'



var tRistorante
var jRistorante = 0
var pRistorante = PicRistorante.length

var preLoadRistorante = new Array()
for (iRistorante = 0; iRistorante < pRistorante; iRistorante++){
   preLoadRistorante[iRistorante] = new Image()
   preLoadRistorante[iRistorante].src = PicRistorante[iRistorante]
}

function runSlideShowRistorante(){
   if (document.all){
      document.images.SlideShowRistorante.style.filter="blendTrans(duration=2)"
      document.images.SlideShowRistorante.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShowRistorante.filters.blendTrans.Apply()      
   }
   document.images.SlideShowRistorante.src = preLoadRistorante[jRistorante].src
   if (document.all){
      document.images.SlideShowRistorante.filters.blendTrans.Play()
   }
   jRistorante = jRistorante + 1
   if (jRistorante > (pRistorante-1)) jRistorante=0
   tRistorante = setTimeout('runSlideShowRistorante()', slideShowSpeed)
}

var PicEsterni = new Array()

PicEsterni[0] = 'images/esterni/esterno3.gif'
PicEsterni[1] = 'images/esterni/fotoest7.jpg'
PicEsterni[2] = 'images/esterni/esterno4.gif'
PicEsterni[3] = 'images/esterni/esterno6.gif'
PicEsterni[4] = 'images/esterni/rist5.jpg'
PicEsterni[5] = 'images/esterni/esterno7.gif'
PicEsterni[6] = 'images/esterni/fotopisc3.jpg'
PicEsterni[7] = 'images/esterni/esterno8.gif'
PicEsterni[8] = 'images/esterni/fotopisc4.jpg'
PicEsterni[9] = 'images/esterni/esterno12.gif'
PicEsterni[10] = 'images/esterni/rist8.jpg'
PicEsterni[11] = 'images/esterni/fotoest6.jpg'

var tEsterni
var jEsterni = 0
var pEsterni = PicEsterni.length

var preLoadEsterni = new Array()
for (iEsterni = 0; iEsterni < pEsterni; iEsterni++){
   preLoadEsterni[iEsterni] = new Image()
   preLoadEsterni[iEsterni].src = PicEsterni[iEsterni]
}



function runSlideShowEsterni(){
   if (document.all){
      document.images.SlideShowEsterni.style.filter="blendTrans(duration=2)"
      document.images.SlideShowEsterni.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShowEsterni.filters.blendTrans.Apply()      
   }
   document.images.SlideShowEsterni.src = preLoadEsterni[jEsterni].src
   if (document.all){
      document.images.SlideShowEsterni.filters.blendTrans.Play()
   }
   jEsterni = jEsterni + 1
   if (jEsterni > (pEsterni-1)) jEsterni=0
   tEsterni = setTimeout('runSlideShowEsterni()', slideShowSpeed)
}




//Funzione per le immagini nella pagina camera.php


var Bed = new Array()

Bed[0] = 'images/bed%26breakfast/fotoest3.jpg'
Bed[1] = 'images/bed%26breakfast/fotoest4.jpg'
Bed[2] = 'images/bed%26breakfast/fotoest5.jpg'
Bed[3] = 'images/bed%26breakfast/fotoest8.jpg'
Bed[4] = 'images/bed%26breakfast/fotoest9.jpg'
Bed[5] = 'images/bed%26breakfast/fotoest10.jpg'
Bed[6] = 'images/bed%26breakfast/fotoest11.jpg'
Bed[7] = 'images/bed%26breakfast/fotoest12.jpg'
Bed[8] = 'images/bed%26breakfast/foto3.gif'
Bed[9] = 'images/bed%26breakfast/foto6.gif'
Bed[10] = 'images/bed%26breakfast/foto7.gif'
Bed[11] = 'images/bed%26breakfast/foto8.gif'
Bed[12] = 'images/bed%26breakfast/fotoest1.jpg'


var tBed
var jBed = 0
var pBed = Bed.length

var preLoadBed = new Array()
for (iBed = 0; iBed < pBed; iBed++){
   preLoadBed[iBed] = new Image()
   preLoadBed[iBed].src = Bed[iBed]
}

function runSlideShowBed(){
   if (document.all){
      document.images.SlideShowBed.style.filter="blendTrans(duration=2)"
      document.images.SlideShowBed.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShowBed.filters.blendTrans.Apply()      
   }
   document.images.SlideShowBed.src = preLoadBed[jBed].src
   if (document.all){
      document.images.SlideShowBed.filters.blendTrans.Play()
   }
   jBed = jBed + 1
   if (jBed > (pBed-1)) jBed=0
   tBed = setTimeout('runSlideShowBed()', slideShowSpeed)
}





function _attachToEvent (obj, name, func) {
  name = name.toLowerCase();
  if(obj.addEventListener) obj.addEventListener(name, func, false);
  else if(obj.attachEvent) obj.attachEvent("on"+name, func);
}
_attachToEvent(window, "load", runSlideShowEsterni); 
_attachToEvent(window, "load", runSlideShowMappa); 
_attachToEvent(window, "load", runSlideShowCamere); 
_attachToEvent(window, "load", runSlideShowRistorante);
_attachToEvent(window, "load", runSlideShowBed);  

window.onload=function(){runSlideShowItinerari();}

