<!--

var formfilename;
var formdir;

var tariffe = new Array(2);

for (i = 0; i < tariffe.length; i++)
  tariffe[i] = new Array(19);

for (i = 0; i < tariffe.length; i++) {
 for (j = 0; j < tariffe[i].length; j++) {
  tariffe[i][j] = new Array(7);
 }
}

 function init()
{
  formfilename='res_';
  formdir = 'https://secure.airports-shuttle.com/reservations/';
  document.formr.book_btn.disabled = true;

	if (screen.width <= 1030)
	  selw = 186;
	else
	  selw = 223;

  document.formr.form_arrival_location.style.width=selw+'px';
  document.formr.form_arrival_destination.style.width=selw+'px';

  document.formr.form_arrival_location.options.length = 0;
  document.formr.form_arrival_destination.options.length = 0;
  document.formr.form_arrival_location.options[0] = new Option('select','select');
  document.formr.form_arrival_destination.options[0] = new Option('select','select');

  document.formr.form_total_passengers.options.length = 0;
  document.formr.form_total_passengers.options[0] = new Option('select','select');
  document.formr.form_total_passengers.options[1] = new Option('1','1');
  document.formr.form_total_passengers.options[2] = new Option('2','2');
  document.formr.form_total_passengers.options[3] = new Option('3','3');
  document.formr.form_total_passengers.options[4] = new Option('4','4');
  document.formr.form_total_passengers.options[5] = new Option('5','5');
  document.formr.form_total_passengers.options[6] = new Option('6','6');
  document.formr.form_total_passengers.options[7] = new Option('7','7');
  document.formr.form_total_passengers.options[8] = new Option('8','8');
  document.formr.form_total_passengers.options[9] = new Option('9','9');
  document.formr.form_total_passengers.options[10] = new Option('10','10');
  document.formr.form_total_passengers.options[11] = new Option('11','11');
  document.formr.form_total_passengers.options[12] = new Option('12','12');
  document.formr.form_total_passengers.options[13] = new Option('13','13');
  document.formr.form_total_passengers.options[14] = new Option('14','14');

tariffe[1][0][0] = 'Turin Airport';
tariffe[1][1][0] = 'Aosta';
tariffe[1][1][1] = '90';
tariffe[1][1][2] = 'apt';
tariffe[1][1][3] = 'TO';
tariffe[1][1][4] = '0,23,23,23,23,43,43,43,43,10,10,10,10,10,10';
tariffe[1][1][5] = '0,180,180,180,180,220,220,220,220,0,0,0,0,0,0';
tariffe[1][1][6] = '0,360,360,360,360,440,440,440,440,0,0,0,0,0,0';
tariffe[1][2][0] = 'Bardonecchia';
tariffe[1][2][1] = '90';
tariffe[1][2][2] = 'apt';
tariffe[1][2][3] = 'TO';
tariffe[1][2][4] = '0,10,10,10,43,43,43,43,43,43,43,43,43,43,43';
tariffe[1][2][5] = '0,165,165,165,195,195,195,195,195,245,245,245,250,250,250';
tariffe[1][2][6] = '0,320,320,320,380,380,380,380,380,480,480,480,490,490,490';
tariffe[1][3][0] = 'Cervinia';
tariffe[1][3][1] = '105';
tariffe[1][3][2] = 'apt';
tariffe[1][3][3] = 'TO';
tariffe[1][3][4] = '0,10,10,10,23,23,43,43,43,69,69,69,69,69,69';
tariffe[1][3][5] = '0,180,180,180,205,205,225,225,225,340,340,345,345,345,345';
tariffe[1][3][6] = '0,350,350,350,400,400,440,440,440,670,670,680,680,680,680';
tariffe[1][4][0] = 'Champoluc';
tariffe[1][4][1] = '80';
tariffe[1][4][2] = 'apt';
tariffe[1][4][3] = 'TO';
tariffe[1][4][4] = '0,23,23,23,23,43,43,43,43,10,10,10,10,10,10';
tariffe[1][4][5] = '0,200,200,200,200,220,220,220,220,0,0,0,0,0,0';
tariffe[1][4][6] = '0,400,400,400,400,440,440,440,440,0,0,0,0,0,0';
tariffe[1][5][0] = 'Claviere';
tariffe[1][5][1] = '90';
tariffe[1][5][2] = 'apt';
tariffe[1][5][3] = 'TO';
tariffe[1][5][4] = '0,10,10,10,23,23,43,43,43,69,69,69,69,69,69';
tariffe[1][5][5] = '0,155,155,155,175,175,205,205,205,265,265,270,270,270,270';
tariffe[1][5][6] = '0,300,300,300,340,340,400,400,400,520,520,530,530,530,530';
tariffe[1][6][0] = 'Courmayeur';
tariffe[1][6][1] = '110';
tariffe[1][6][2] = 'apt';
tariffe[1][6][3] = 'TO';
tariffe[1][6][4] = '0,23,23,23,23,43,43,43,43,10,10,10,10,10,10';
tariffe[1][6][5] = '0,250,250,250,250,280,280,280,280,0,0,0,0,0,0';
tariffe[1][6][6] = '0,500,500,500,500,560,560,560,560,0,0,0,0,0,0';
tariffe[1][7][0] = 'Gressoney';
tariffe[1][7][1] = '120';
tariffe[1][7][2] = 'apt';
tariffe[1][7][3] = 'TO';
tariffe[1][7][4] = '0,23,23,23,23,43,43,43,43,10,10,10,10,10,10';
tariffe[1][7][5] = '0,210,210,210,210,230,230,230,230,0,0,0,0,0,0';
tariffe[1][7][6] = '0,420,420,420,420,460,460,460,460,0,0,0,0,0,0';
tariffe[1][8][0] = 'La Thuille';
tariffe[1][8][1] = '135';
tariffe[1][8][2] = 'apt';
tariffe[1][8][3] = 'TO';
tariffe[1][8][4] = '0,10,10,10,23,23,43,43,43,69,69,69,69,69,69';
tariffe[1][8][5] = '0,220,220,220,240,240,255,255,255,290,290,290,290,290,290';
tariffe[1][8][6] = '0,430,430,430,470,470,500,500,500,570,570,570,570,570,570';
tariffe[1][9][0] = 'Montgenèvre';
tariffe[1][9][1] = '90';
tariffe[1][9][2] = 'apt';
tariffe[1][9][3] = 'TO';
tariffe[1][9][4] = '0,10,10,10,23,23,43,43,43,69,69,69,69,69,69';
tariffe[1][9][5] = '0,155,155,155,175,175,205,205,205,265,265,270,270,270,270';
tariffe[1][9][6] = '0,300,300,300,340,340,400,400,400,520,520,530,530,530,530';
tariffe[1][10][0] = 'Puy Saint Vincent';
tariffe[1][10][1] = '120';
tariffe[1][10][2] = 'apt';
tariffe[1][10][3] = 'TO';
tariffe[1][10][4] = '0,10,10,10,23,23,43,43,43,69,69,69,69,69,69';
tariffe[1][10][5] = '0,205,205,205,235,235,265,265,265,310,310,315,315,315,315';
tariffe[1][10][6] = '0,400,400,400,460,460,520,520,520,610,610,620,620,620,620';
tariffe[1][11][0] = 'Risoul';
tariffe[1][11][1] = '150';
tariffe[1][11][2] = 'apt';
tariffe[1][11][3] = 'TO';
tariffe[1][11][4] = '0,10,10,10,23,23,43,43,43,69,69,69,69,69,69';
tariffe[1][11][5] = '0,250,250,250,275,275,310,310,310,355,355,360,360,360,360';
tariffe[1][11][6] = '0,490,490,490,540,540,610,610,610,700,700,710,710,710,710';
tariffe[1][12][0] = 'Sauze d Oulx';
tariffe[1][12][1] = '140';
tariffe[1][12][2] = 'apt';
tariffe[1][12][3] = 'TO';
tariffe[1][12][4] = '0,10,10,10,23,23,43,43,43,69,69,69,69,69,69';
tariffe[1][12][5] = '0,165,165,165,175,175,195,195,195,280,280,290,290,290,290';
tariffe[1][12][6] = '0,320,320,320,340,340,380,380,380,550,550,570,570,570,570';
tariffe[1][13][0] = 'Serre Chevalier';
tariffe[1][13][1] = '120';
tariffe[1][13][2] = 'apt';
tariffe[1][13][3] = 'TO';
tariffe[1][13][4] = '0,10,10,10,43,43,43,43,43,43,43,43,43,43,43';
tariffe[1][13][5] = '0,205,205,205,255,255,260,260,260,305,305,305,305,315,315';
tariffe[1][13][6] = '0,400,400,400,500,500,510,510,510,600,600,600,600,620,620';
tariffe[1][14][0] = 'Sestriere';
tariffe[1][14][1] = '90';
tariffe[1][14][2] = 'apt';
tariffe[1][14][3] = 'TO';
tariffe[1][14][4] = '0,10,10,10,23,23,43,43,43,69,69,69,69,69,69';
tariffe[1][14][5] = '0,155,155,155,180,180,210,210,210,265,265,270,270,270,270';
tariffe[1][14][6] = '0,300,300,300,350,350,410,410,410,520,520,530,530,530,530';
tariffe[1][15][0] = 'St. Vincent';
tariffe[1][15][1] = '80';
tariffe[1][15][2] = 'apt';
tariffe[1][15][3] = 'TO';
tariffe[1][15][4] = '0,10,10,10,23,23,43,43,43,69,69,69,69,69,69';
tariffe[1][15][5] = '0,120,120,120,135,135,150,150,150,210,210,220,220,220,220';
tariffe[1][15][6] = '0,230,230,230,260,260,290,290,290,410,410,430,430,430,430';
tariffe[1][16][0] = 'Turin city hotels';
tariffe[1][16][1] = '30';
tariffe[1][16][2] = 'apt';
tariffe[1][16][3] = 'TO';
tariffe[1][16][4] = '0,10,10,10,23,23,43,43,43,69,69,69,69,69,69';
tariffe[1][16][5] = '0,45,45,45,50,50,60,60,60,105,105,105,105,105,105';
tariffe[1][16][6] = '0,90,90,90,100,100,120,120,120,210,210,210,210,210,210';
tariffe[1][17][0] = 'Valmeinier';
tariffe[1][17][1] = '130';
tariffe[1][17][2] = 'apt';
tariffe[1][17][3] = 'TO';
tariffe[1][17][4] = '0,10,10,10,23,23,43,43,43,10,10,10,10,10,10';
tariffe[1][17][5] = '0,300,300,300,360,360,400,400,400,0,0,0,0,0,0';
tariffe[1][17][6] = '0,590,590,590,710,710,790,790,790,0,0,0,0,0,0';

 for(i=1;i<tariffe.length;i++)
 document.formr.form_arrival_location.options[i] = new Option(tariffe[i][0][0],tariffe[i][0][0]);

 setfare();

}

var triptime;

function setjourney()
{
 if( document.formr.form_arrival_location.selectedIndex ==  0 || document.formr.form_arrival_destination.selectedIndex ==  0 )
  triptime = '';
 else
  triptime = 'Approx. trip time:  ' + tariffe[document.formr.form_arrival_location.selectedIndex][document.formr.form_arrival_destination.selectedIndex][1] + ' min.'; 
}

function setd()
{
	
if( document.formr.form_arrival_location.selectedIndex ==  0 )
 {
  document.formr.book_btn.disabled = true;
  document.formr.form_arrival_destination.selectedIndex = 0;
  return;
 }
document.formr.form_arrival_destination.options.length = 0;
 document.formr.form_arrival_destination.options[0] = new Option('select','select');

for (i = 1; i <= tariffe[document.formr.form_arrival_location.selectedIndex].length; i++)
{
 if( typeof tariffe[document.formr.form_arrival_location.selectedIndex][i] !== 'undefined' && typeof tariffe[document.formr.form_arrival_location.selectedIndex][i][0] != 'undefined'  )
 document.formr.form_arrival_destination.options[i] = new Option(tariffe[document.formr.form_arrival_location.selectedIndex][i][0],tariffe[document.formr.form_arrival_location.selectedIndex][i][0]);
}
  setfare();

}

function setfare()
{

 setjourney();

 var LABELPRICE = document.getElementById('LABELPRICE');
 var LABELONPRICE = document.getElementById('LABELONPRICE');
 var LABELDES = document.getElementById('LABELDES');
 var LABELBAG = document.getElementById('LABELBAG');

 if( document.formr.onewayreturn[0].checked )
 {
   document.formr.form_return_time_h.disabled = true;
   document.formr.form_return_time_m.disabled = true;
 }
 else
 {
   document.formr.form_return_time_h.disabled = false;
   document.formr.form_return_time_m.disabled = false;
 }

 if( document.formr.form_arrival_location.selectedIndex ==  0 || document.formr.form_arrival_destination.selectedIndex ==  0 )
 {
  LABELPRICE.innerHTML = ' --- select trip ---';
  LABELONPRICE.innerHTML = '&nbsp;';
  LABELDES.innerHTML = ' '; 
  LABELBAG.innerHTML = ''; 
  document.formr.book_btn.disabled = true;
  return;
 }
 if( document.formr.form_total_passengers.selectedIndex == 0 )
 {
 LABELPRICE.innerHTML = ' --- select passengers number ---';
 LABELONPRICE.innerHTML = '&nbsp;';
 LABELDES.innerHTML = ' '; 
 LABELBAG.innerHTML = '';
 document.formr.book_btn.disabled = true;
 return;
 }
 if( document.formr.bag_1.value == 0 && document.formr.bag_2.value == 0 && document.formr.bag_3.value == 0 )
 {
  LABELPRICE.innerHTML = ' --- select luggage ---';
  LABELONPRICE.innerHTML = '&nbsp;';
  LABELDES.innerHTML = ' ';
  LABELBAG.innerHTML = '';
  document.formr.book_btn.disabled = true;
  return;
 }
 if( document.formr.form_arrival_time_h.selectedIndex == 0 )
 {
  LABELPRICE.innerHTML = ' --- select pickup time ---';
  LABELONPRICE.innerHTML = '&nbsp;';
  LABELDES.innerHTML = ' '; 
  LABELBAG.innerHTML = '';
  document.formr.book_btn.disabled = true;
  return;
 }

if( document.formr.onewayreturn[1].checked && document.formr.form_return_time_h.selectedIndex == 0 )
 {
  LABELPRICE.innerHTML = ' --- select return pickup time ---';
  LABELONPRICE.innerHTML = '&nbsp;';
  LABELDES.innerHTML = ' ';  
  LABELBAG.innerHTML = '';
  document.formr.book_btn.disabled = true;
  return;
 }
 

 var faresreturndisc = new Array(16);
 var addnight = '';
 var percadd = 0;
 var arrval = 0;

 var faretypeofv = tariffe[document.formr.form_arrival_location.selectedIndex][document.formr.form_arrival_destination.selectedIndex][4].split(',');

 var actionform = formdir+formfilename+tariffe[document.formr.form_arrival_location.selectedIndex][document.formr.form_arrival_destination.selectedIndex][2]+'_eng';
 var city = tariffe[document.formr.form_arrival_location.selectedIndex][document.formr.form_arrival_destination.selectedIndex][3];

 if( document.formr.onewayreturn[0].checked )
 {
  var fares = tariffe[document.formr.form_arrival_location.selectedIndex][document.formr.form_arrival_destination.selectedIndex][5].split(',');
  actionform = actionform + '.php';
 if( document.formr.form_arrival_time_h.value >= 21 || document.formr.form_arrival_time_h.value >= 0 && document.formr.form_arrival_time_h.value < 7 )
percadd = 20;
 }
 else
 {
  var fares = tariffe[document.formr.form_arrival_location.selectedIndex][document.formr.form_arrival_destination.selectedIndex][6].split(',');
actionform = actionform + '.php';
 if( document.formr.form_arrival_time_h.value >= 21 || document.formr.form_arrival_time_h.value >= 0 && document.formr.form_arrival_time_h.value < 7 )
percadd = 10;
 if( document.formr.form_return_time_h.value >= 21 || document.formr.form_return_time_h.value >= 0 && document.formr.form_return_time_h.value < 7 )
percadd = percadd + 10;
  var fares_o = tariffe[document.formr.form_arrival_location.selectedIndex][document.formr.form_arrival_destination.selectedIndex][5].split(',');
   for (var i=1; i < fares.length; i++)
   {
	 if( parseInt(fares[i]) < parseInt(fares_o[i]) * 2  )
	 faresreturndisc[i] = 1;
	 else
 	 faresreturndisc[i] = 0;
   }
 }

 document.formr.action=actionform;
 document.formr.code.value = city;
 document.formr.book_btn.disabled = false;

 arrval = fares.length;

 if( percadd > 0 )
 {
  for (var i=1; i < arrval; i++)
  {
   add = parseInt(fares[i] * percadd / 100);
   add+=parseInt(fares[i]);
   fares[i] = add;
  }

  if( percadd >= 20 )
   addnight = '  (night fare)';
  else
   addnight = '  (one way night fare)';
 }

 fillfares( arrval, fares, addnight, faresreturndisc, faretypeofv );
}

function fillfares( numarray, fares, addnight, faresreturndisc, faretypeofv )
{
 var farestrfull = '';
 var strpas = '';
 var strfare = '';
 var typetransfer;
 var totalbag;
 var trovato=0;

 var LABELPRICE = document.getElementById('LABELPRICE');
 var LABELONPRICE = document.getElementById('LABELONPRICE');
 var LABELDES = document.getElementById('LABELDES');
 var LABELBAG = document.getElementById('LABELBAG');

   i = document.formr.form_total_passengers.selectedIndex;

   if( fares[i] <= 0 )
   {
	LABELPRICE.innerHTML = 'not available';
	LABELONPRICE.innerHTML = '&nbsp;';
	LABELDES.innerHTML = '';
	LABELBAG.innerHTML = 'This fare is not available. Please contact us.';
	document.formr.book_btn.disabled = true;
	return;
   }

   totalbag = document.formr.form_total_passengers.selectedIndex * 0.5
   totalbag = totalbag + (document.formr.bag_1.value * 1.5) + (document.formr.bag_2.value * 2.3) + (document.formr.bag_3.value * 3);

   if( totalbag > faretypeofv[i] )
   {
        for (var f=i+1; f < numarray; f++)
	      {

          if( totalbag <= faretypeofv[f] )
     	  {
		  	  trovato = 1;
			  break;
		    }
	      }

	    if( trovato == 1 )
	    {
		   strpas = i+'';
            if( i == 1 ) {
             strpas =  strpas + ' passenger ';
            }
            else {
             strpas =  strpas + ' passengers ';
            }

            if( document.formr.onewayreturn[0].checked )
             typetransfer = ' - one way ';	
            else if( document.formr.onewayreturn[1].checked )
            {
          	if( faresreturndisc[i] == 1 )
             typetransfer = ' - discounted round trip ';
            else
             typetransfer = ' - round trip ';
            }
            farestrfull= '   ' + strpas+fares[f]+' Euros'+typetransfer+addnight;
            faredes = '   ' + triptime+decodeve( faretypeofv[f] );
			if( fares[f] <= 0 )
			{
            LABELPRICE.innerHTML = 'not available';
		    LABELONPRICE.innerHTML = '&nbsp;';
            LABELDES.innerHTML = '';
			LABELBAG.innerHTML = 'This fare is not available. Please contact us.';
			document.formr.book_btn.disabled = true;
			return;
			}
            LABELPRICE.innerHTML = farestrfull;
            LABELONPRICE.innerHTML = fares[f]+',00 Euros'; 
            LABELDES.innerHTML = faredes;
			LABELBAG.innerHTML = '   Shifted to the upper vehicle category due to luggage amount';
 	    }

   return;
   }

   strpas = i+'';
   if( i == 1 ) {
    strpas =  strpas + ' passenger ';
   }
   else {
    strpas =  strpas + ' passengers ';
   }

   if( document.formr.onewayreturn[0].checked )
    typetransfer = ' - one way ';	
   else if( document.formr.onewayreturn[1].checked )   
   {
 	if( faresreturndisc[i] == 1 )
      typetransfer = ' - discounted round trip ';
     else
      typetransfer = ' - round trip ';
   }
   farestrfull= '   ' + strpas+fares[i]+' Euros'+typetransfer+addnight;
   faredes = '   ' + triptime+decodeve( faretypeofv[i] );

   LABELPRICE.innerHTML = farestrfull;
   LABELONPRICE.innerHTML = fares[i]+',00 Euros';
   LABELDES.innerHTML = faredes;
   LABELBAG.innerHTML = '';
}
function decodeve(argvalue) 
{
var retval;
if( argvalue == 10 )
 retval =  '  Service: Limousine E class transfer';
else if( argvalue == 23 )
 retval =  '  Service: luxury van transfer';
else if( argvalue == 43 )
 retval =  '  Service: luxury minibus transfer';
else if( argvalue == 69 )
 retval =  '  Service: luxury bus transfer';
else if( argvalue == 32 )
 retval =  '  Service: shuttle + water taxi transfer';
else if( argvalue == 32 )
 retval =  '  Service: shuttle mb + water taxi transfer';
else if( argvalue == 70 )
 retval =  '  Service: 2 x luxury minibus transfer';
else 
retval =  '  Service NOT available on line. Please email us for a quote.';
return  retval;
}

-->