﻿// Percorso della cartella delle immagini
var siena="/images/siena/";
var hotelsiena = "/images/albergo/";

x = 1;
thmb1= 2;
thmb2 = 3;
thmb3 = 4;

var photoHotelBig =new Array();
for(i= 0 ; i < 9; i++)
{
  if(i < 10)
    photoHotelBig[i]=hotelsiena+'hotel_big_0'+i+'.jpg';
  else
    photoHotelBig[i]=hotelsiena+'hotel_big_'+i+'.jpg';  
}


var photoHotelThmb =new Array();
for(i= 0 ; i < 9; i++)
{
  if(i < 10)
    photoHotelThmb[i]=hotelsiena+'hotel_small_0'+i+'.jpg';
  else
    photoHotelThmb[i]=hotelsiena+'hotel_small_'+i+'.jpg';
}

var photoSienaBig =new Array();
for(i= 0 ; i < 13; i++)
{
  if(i < 10)
    photoSienaBig[i]=siena+'siena_big_0'+i+'.jpg';
  else
    photoSienaBig[i]=siena+'siena_big_'+i+'.jpg'; 
}

var photoSienaThmb =new Array();
for(i= 0 ; i < 13; i++)
{
  if(i < 10)
    photoSienaThmb[i]=siena+'siena_small_0'+i+'.jpg';
  else
    photoSienaThmb[i]=siena+'siena_small_'+i+'.jpg';
}

var photoBreakfastBig = new Array();

photoBreakfastBig[0] = '';
photoBreakfastBig[1] = '/images/albergo/hotel_big_08.jpg';
photoBreakfastBig[2] = '/images/albergo/hotel_big_05.jpg';

var photoBreakfastThmb = new Array();
photoBreakfastThmb[0] = '';
photoBreakfastThmb[1] = '/images/albergo/hotel_small_08.jpg';
photoBreakfastThmb[2] = '/images/albergo/hotel_small_05.jpg';

function initPhotoHotels()
{
   x = 1;
   showImg(photoHotelBig);
   x = 2;
   showThmb(photoHotelThmb,1);
   x++
   showThmb(photoHotelThmb,2);
   x++
   showThmb(photoHotelThmb,3);  
}

function initPhotoSiena()
{
   x = 1;
   showImg(photoSienaBig);
   x = 2;
   showThmb(photoSienaThmb,1);
   x++
   showThmb(photoSienaThmb,2);
   x++
   showThmb(photoSienaThmb,3);  
}

function initPhotoBreakfast()
{
  x = 1;
  showImg(photoBreakfastBig);
  showThmb(photoBreakfastThmb, 1);
  x = 2;
  showThmb(photoBreakfastThmb, 2);
}

function showHotelImg(position)
{
  if(position == 1)
  {
    x = thmb1;
    showImg(photoHotelBig);
  }
  if(position == 2)
  {
    x = thmb2;
    showImg(photoHotelBig);
  }
  if(position == 3)
  {
    x = thmb3;
    showImg(photoHotelBig);
  }
}

function showSienaImg(position)
{
  if(position == 1)
  {
    x = thmb1;
    showImg(photoSienaBig);
  }
  if(position == 2)
  {
    x = thmb2;
    showImg(photoSienaBig);
  }
  if(position == 3)
  {
    x = thmb3;
    showImg(photoSienaBig);
  }
}

function showBreakfastImg(position)
{
  if(position == 1)
  {
    x = 1;
    showImg(photoBreakfastBig);
  }
  else if (position == 2)
  {
    x = 2;
    showImg(photoBreakfastBig);
  }
}

function nextHotelImg() 
{
  nextImg(photoHotelThmb);
}

function prevHotelImg() 
{
  prevImg(photoHotelThmb);
}

function nextSienaImg() 
{
  nextImg(photoSienaThmb);
}

function prevSienaImg() 
{
  prevImg(photoSienaThmb);
}

function showImg(photoArray) 
{
	document.getElementById("photoBig").src= photoArray[x];
	document.getElementById("photoBig").alt='';

}

function showThmb(photoArray, position) 
{
	document.getElementById("photoThmb"+position).src=photoArray[x];
	document.getElementById("photoThmb"+position).alt='';
}

function nextImg(photoArray) 
{
	x = thmb1 + 1 ;
	thmb1++;
	showThmb(photoArray, 1);
	x++;
	thmb2++;
	showThmb(photoArray, 2);
  x++;
  thmb3++;
 	showThmb(photoArray, 3);
 	
 	if(x == 1)
 	  document.getElementById("arrowup").style.visibility = 'hidden';
  else
 	  document.getElementById("arrowup").style.visibility = 'visible';

 	if(x == photoArray.length-1)
 	  document.getElementById("arrowdown").style.visibility = 'hidden';
 	else
 	  document.getElementById("arrowdown").style.visibility = 'visible';
 	  
}
	
function prevImg(photoArray) 
{
	x = thmb3 -1;
	thmb3--;
	showThmb(photoArray, 3);
	x--;
	thmb2--;
	showThmb(photoArray, 2);
  x--;
  thmb1--;
 	showThmb(photoArray, 1);
 	
 	if(x == 1)
 	  document.getElementById("arrowup").style.visibility = 'hidden';
  else
 	  document.getElementById("arrowup").style.visibility = 'visible';
 	  
 	if(x == photoArray.length-1)
 	  document.getElementById("arrowdown").style.visibility = 'hidden';
 	else
 	  document.getElementById("arrowdown").style.visibility = 'visible';
}

