function setVal() {

dz=document.form.duration.options[document.form.duration.selectedIndex].value;

standard=document.form.standard.options[document.form.standard.selectedIndex].value;
penthouse=document.form.penthouse.options[document.form.penthouse.selectedIndex].value;
sofab1=document.form.sofab1.options[document.form.sofab1.selectedIndex].value;
sofab2=document.form.sofab2.options[document.form.sofab2.selectedIndex].value;

stanextra=document.form.stanextra.options[document.form.stanextra.selectedIndex].value;
pentextra=document.form.pentextra.options[document.form.pentextra.selectedIndex].value;


lang=document.form.lang.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;

var d = new Date()
secs=d.getTime()
secss=("" + secs)
stamp=secss.substr(0,10)

sstemp = new Date(arrivalyear,arrivalmonth-1,arrivalday);
ss = sstemp.getTime();



nodis=0; 
min34 = minimum(dz,ss)
if (min34 == false) 
{return false;}

if (lang == "eng")
{text = "There is only 1 sofa-bed per apartment. The number of sofa-beds cannot exceed the number of apartments.";}

if (lang == "span")
{text = "Sólo hay 1 sofá-cama por apartamento. El número de sofá-camas no puede superar el número de apartamentos.";}


if (lang == "eng")
{penttext = "There is only 1 extra-bed per apartment. The number of extra beds cannot exceed the number of apartments.";}

if (lang == "span")
{penttext = "Sólo hay 1 cama supletoria por apartamento. El número de sofá-camas no puede superar el número de apartamentos.";}


if (sofab1 > standard)
{window.alert(text);}

if (sofab2 > penthouse)
{window.alert(text);}

if (stanextra > standard)
{window.alert(penttext);}

if (pentextra > penthouse)
{window.alert(penttext);}



price= "0";

holidaydate(dz,ss)


combined = holdhigh + holdlow;
holdmid = dz - combined; 

price_high=0;
price_mid=0;
price_low=0;

////////////////////////////PRICES 2011 - 2012/////////////////////////////////////////////////////////////
//prices work with if, else clause - if new prices change next year remove 2012 from if clause)

if ((arrivalyear==2011)||(arrivalyear==2012))
{
//HIGH PRICES 

stan_base_high = standard *(dz * 75);
stan_sofa_high = sofab1 * (dz * 55);
stan_extra_high = stanextra * (dz * 20);

//work out penthouse price.

penthouse_base_high = penthouse * (dz * 75);
penthouse_sofa_high = sofab2 * (dz * 55);
penthouse_extra_high = pentextra * (dz * 20);


price_high = stan_base_high + stan_sofa_high + penthouse_base_high + penthouse_sofa_high + stan_extra_high + penthouse_extra_high; 

ppn_high =  price_high/dz; 
price_high = holdhigh * ppn_high

//END HIGH PRICES 



//mid PRICES 

stan_base_mid = standard *(dz * 60);
stan_sofa_mid = sofab1 * (dz * 35);
stan_extra_mid = stanextra * (dz * 20);


//work out penthouse price.

penthouse_base_mid = penthouse * (dz * 60);
penthouse_sofa_mid = sofab2 * (dz * 35);
penthouse_extra_mid = pentextra * (dz * 20);

price_mid = stan_base_mid + stan_sofa_mid + penthouse_base_mid + penthouse_sofa_mid + stan_extra_mid + penthouse_extra_mid; 

ppn_mid =  price_mid/dz; 
price_mid = holdmid * ppn_mid

//END mid PRICES 



//low PRICES 

stan_base_low = standard *(dz * 57);
stan_sofa_low = sofab1 * (dz * 38);
stan_extra_low = stanextra * (dz * 20);

//work out penthouse price.

penthouse_base_low = penthouse * (dz * 57);
penthouse_sofa_low = sofab2 * (dz * 38);
penthouse_extra_low = pentextra * (dz * 20);

//SPECIAL LOW PRICE DECEMBER
if ((arrivalmonth == 1)&&(dz==2))
{
stan_base_low = standard *(dz * 50);
stan_sofa_low = sofab1 * (dz * 30);
stan_extra_low = stanextra * (dz * 35);

penthouse_base_low = penthouse * (dz * 50);
penthouse_sofa_low = sofab2 * (dz * 30);
penthouse_extra_low = pentextra * (dz * 35);
}


}
else

///////START 2013 PRICES///////

{

//HIGH PRICES 

stan_base_high = standard *(dz * 80);
stan_sofa_high = sofab1 * (dz * 60);
stan_extra_high = stanextra * (dz * 20);

//work out penthouse price.

penthouse_base_high = penthouse * (dz * 80);
penthouse_sofa_high = sofab2 * (dz * 60);
penthouse_extra_high = pentextra * (dz * 20);


price_high = stan_base_high + stan_sofa_high + penthouse_base_high + penthouse_sofa_high + stan_extra_high + penthouse_extra_high; 

ppn_high =  price_high/dz; 
price_high = holdhigh * ppn_high

//END HIGH PRICES 



//MID PRICES 

stan_base_mid = standard *(dz * 75);
stan_sofa_mid = sofab1 * (dz * 35);
stan_extra_mid = stanextra * (dz * 20);


//work out penthouse price.

penthouse_base_mid = penthouse * (dz * 75);
penthouse_sofa_mid = sofab2 * (dz * 35);
penthouse_extra_mid = pentextra * (dz * 20);

price_mid = stan_base_mid + stan_sofa_mid + penthouse_base_mid + penthouse_sofa_mid + stan_extra_mid + penthouse_extra_mid; 

ppn_mid =  price_mid/dz; 
price_mid = holdmid * ppn_mid

//END mid PRICES 



//LOW PRICES 

stan_base_low = standard *(dz * 65);
stan_sofa_low = sofab1 * (dz * 35);
stan_extra_low = stanextra * (dz * 20);

//work out penthouse price.

penthouse_base_low = penthouse * (dz * 65);
penthouse_sofa_low = sofab2 * (dz * 35);
penthouse_extra_low = pentextra * (dz * 20);




price_low = stan_base_low + stan_sofa_low + penthouse_base_low + penthouse_sofa_low + stan_extra_low + penthouse_extra_low; 

ppn_low =  price_low/dz; 
price_low = holdlow * ppn_low

//END LOW PRICES 



fullprices = price_high + price_mid + price_low;


}
///////END 2012 PRICES///////





price_low = stan_base_low + stan_sofa_low + penthouse_base_low + penthouse_sofa_low + stan_extra_low + penthouse_extra_low; 

ppn_low =  price_low/dz; 
price_low = holdlow * ppn_low

//END low PRICES 



fullprices = price_high + price_mid + price_low;

//GIVE FREE NIGHT FOR 2+ STAYS IN DECEMBER IN LOW SEASON
discount = 0

if ((dz > 2) && holdlow > 2  && arrivalmonth == 1 ) {
discount = ppn_low}
fullprices = fullprices - discount
//GIVE FREE NIGHT FOR 2+ STAYS IN DECEMBER IN LOW SEASON



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;
pesetass = fullprices*166.386;
maxp = 2*((standard*1)+(penthouse*1)+(sofab1*1)+(sofab2*1)+(stanextra*0.5)+(pentextra*0.5)); 
document.form.maxp.value=maxp;
pppp = fullprices/maxp;
document.form.howmanyap.value=1*((standard*1)+(penthouse*1)); 
 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.ppn.value=Math.round(+pricepn*100)/100;

document.form.holdhigh.value=holdhigh;
document.form.holdmid.value=holdmid;
document.form.holdlow.value=holdlow;

document.form.holsupdays.value=holsupdays_zz;
document.form.holsup.value=holsup_zz;

}

