function setVal() {


  dz=document.form.duration.options[document.form.duration.selectedIndex].value;
  mz=document.form.numberofpeople.options[document.form.numberofpeople.selectedIndex].value;
  hma=document.form.howmanyap.options[document.form.howmanyap.selectedIndex].value;
  arrivalday=document.form.arrivalday.options[document.form.arrivalday.selectedIndex].value;
  arrivalmonth=document.form.arrivalmonth.options[document.form.arrivalmonth.selectedIndex].value;
  arrivalyear=document.form.arrivalyear.options[document.form.arrivalyear.selectedIndex].value;
  dollarconv=document.form.dollareuro.value;
  poundeuro=document.form.poundeuro.value;
  lang=document.form.lang.value;


sstemp = new Date(arrivalyear,arrivalmonth-1,arrivalday);
ss = sstemp.getTime();


nodis=0; 
minimum(dz,ss)
supp = 0;


texteng = "It is not possible for "+mz+" people to stay in "+hma+" apartment(s) becuase the max. per apartment is 7. \nPlease increase the number of apartments to correct the error.";
textspan = ""+mz+" personas no caben en "+hma+" apartamento(s) porque el máximo por apartamento es 7. \nPor favor, aumenta el número de apartamentos para conincidir con el número de personas.";

if (lang == "eng")
{text = texteng}
if (lang == "span")
{text = textspan}

//if too many people per ap
if ( mz >  (hma * 7) ) 
{window.alert(text)
return false;
}



holidaydates_santiago(dz,ss)

//CHANGE PRICE IN FUTURE CODE
cd = new Date(2008,1,22);
change_date = cd.getTime();


//PRE 2008 START  PRE 2008 START 
if (ss < change_date) 
{ 

//less than a week.
price= "0";

if (dz < 7)
{
price = (dz * 75) * hma
supp = 0;

if (mz > (hma * 2))
{
extrapeople = mz - (hma * 2)
supp = supp + dz * (extrapeople * 10) 
price = supp + price
}
}
 
//7 days or more .
if (dz > 6) 
{price = (dz * 55.71) * hma 

if (mz > (hma * 2))
{
extrapeople = mz - (hma * 2)
supp = supp + dz * (extrapeople * 10) 
price = supp + price
}

}



normalprice = price;

//find price per night of booking with no sups
price_per_nite = (price/dz); 

//find out number of nights not affected by sups.
not_supdays =  (dz - holsupdays) 

// window.alert(holsupdays)

//find price of the days which have no supplements.
not_supdays_price = (price_per_nite * not_supdays)

supdays_price = hma * (holsupdays * 130)
if ( holsupdays > 6)
{
supdays_price = hma * (holsupdays * 98.57)
}

if ( holsupdays == 6)
{
supdays_price = hma * (holsupdays * 112.5)
}

//PRE 2008 END PRE 2008 END 
}




//POST 2008 START  POST 2008 START POST 2008 START  POST 2008 START POST 2008 START  POST 2008 START 
if (ss >= change_date) 
{ 

//less than a week.
price= "0";

if (dz < 7)
{
price = (dz * 75) * hma
supp = 0;

if (mz > (hma * 2))
{
extrapeople = mz - (hma * 2)

if (extrapeople == 1) 
{supp = supp + dz * (extrapeople * 20) 
}

if (extrapeople == 2) 
{supp = supp + dz * (extrapeople * 15) 
}

if (extrapeople == 3) 
{supp = supp + dz * (extrapeople * 16.6) 
}

if (extrapeople == 4) 
{supp = supp + dz * (extrapeople * 15) 
}

if (extrapeople == 5) 
{supp = supp + dz * (extrapeople * 15) 
}

if (extrapeople > 5) 
{supp = supp + dz * (extrapeople * 15) 
}

price = supp + price
}
}
 
//7 days or more .
if (dz > 6) 
{price = (dz * 55.71) * hma 

if (mz > (hma * 2))
{
extrapeople = mz - (hma * 2)
supp = supp + dz * (extrapeople * 10) 
price = supp + price
}

}



normalprice = price;

//find price per night of booking with no sups
price_per_nite = (price/dz); 

//find out number of nights not affected by sups.
not_supdays =  (dz - holsupdays) 

// window.alert(holsupdays)

//find price of the days which have no supplements.
not_supdays_price = (price_per_nite * not_supdays)

supdays_price = hma * (holsupdays * 180)
if ( holsupdays > 6)
{
supdays_price = hma * (holsupdays * 98.57)
}

if ( holsupdays == 6)
{
supdays_price = hma * (holsupdays * 112.5)
}

//POST 2008 END POST 2008 END 
}




price = (not_supdays_price + supdays_price) 

price =  Math.round(price);

//price = price * hma;

holsup = price - normalprice

fullprices = price;

//texteng = "It is not possible for "+mz+" people to stay in "+hma+" apartment(s) becuase the max. per apartment is 7. \nPlease //increase the number of apartments to correct the error.";
//textspan = ""+mz+" personas no caben en "+hma+" apartamento(s) porque el máximo por apartamento es 7. \nPor favor, aumenta el //número de apartamentos para conincidir con el número de personas.";
//
//if (lang == "eng")
//{text = texteng}
//if (lang == "span")
//{text = textspan}

//if too many people per ap
//if ( mz >  (hma * 7) ) 
//window.alert(text)


fullprices = fullprices;


discountsup(dz,fullprices,ss)
fullprices = fullprices + holsup_zz;


fianth = fullprices/4;
if (fianth < 51 )
{fianth = 50}

dollars = fullprices*dollarconv; 
pounds = fullprices*poundeuro; 
fianza = fianth;
pricepn = fullprices/dz;
pricepp = fullprices/mz;
pesetass = fullprices*166.386;
restante = fullprices - fianth;


holsupdays_zz = holsupdays_zz + holsupdays;
holsup_zz = holsup_zz + holsup;

document.form.fullprice.value=Math.round(+fullprices*100)/100;
document.form.pounds.value=Math.round(+pounds*100)/100;
document.form.dollars.value=Math.round(+dollars*100)/100;
document.form.deposit.value=Math.round(+fianza*100)/100;
document.form.ppn.value=Math.round(+pricepn*100)/100;
document.form.ppp.value=Math.round(+pricepp*100)/100;
document.form.pesetas.value=Math.round(+pesetass);
document.form.depositeuros.value=Math.round(+restante);
document.form.holsupdays.value=holsupdays_zz;
document.form.holsup.value=Math.round(+holsup_zz);




}
          