function setVal() {

dz=document.form.duration.options[document.form.duration.selectedIndex].value;

standard=document.form.standard.options[document.form.standard.selectedIndex].value;
family=document.form.family.options[document.form.family.selectedIndex].value;
seven=document.form.seven.options[document.form.seven.selectedIndex].value;
sofab1=document.form.sofab1.options[document.form.sofab1.selectedIndex].value;
sofab2=document.form.sofab2.options[document.form.sofab2.selectedIndex].value;
sofab3=document.form.sofab3.options[document.form.sofab3.selectedIndex].value;
extrab=document.form.extrab.options[document.form.extrab.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;


//SOLVE FRENCH PROBLEM 
var s = document.URL;
is_french = s.indexOf("indexfr") != -1;

if (is_french){
lang=document.form.lang.options[document.form.lang.selectedIndex].value;
//window.alert("DOC IS FRENCH")
}
else{
//window.alert("DOC IS NOT FRENCH")
lang=document.form.lang.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();

min34 = minimum(dz,ss)
if (min34 == false) 
{return false;}

dayuvweak = new Date (ss);
dayuvweak = dayuvweak.getDay()

if (lang == "eng")
{text = "The number of sofa-beds exceeds the number of apartments.";}

if (lang == "eng")
{text1 = "The number of extra beds exceeds the number of apartments.";}


if (lang == "span")
{text = "El número de sofá-camas excede el número de apartamentos.";}

if (lang == "span")
{text1 = "El número de camas supletorias excede el número de apartamentos.";}


if (sofab1 > standard)
{window.alert(text)}

if (sofab2 > family)
{window.alert(text)}

if (sofab3 > seven)
{window.alert(text)}

if (extrab > seven)
{window.alert(text1)}




holidaydate(dz,ss)

combined = holdhigh + holdlow;
holdmid = dz - combined; 

price_high=0;
price_mid=0;
price_low=0;


//HIGH SEASON

stan_base_high = standard *(dz * 75);
stan_sofa_high = sofab1 * (dz * 55);

family_base_high = family * (dz * 160);
family_sofa_high = sofab2 * (dz * 0);

seven_base_high = seven * (dz * 160);
seven_sofa_high = sofab3 * (dz * 0);
seven_extra_high = extrab * (dz * 20);

price_high = stan_base_high + stan_sofa_high + family_base_high + family_sofa_high + seven_base_high + seven_sofa_high + seven_extra_high;
ppn_high =  price_high/dz; 

price_high = holdhigh * ppn_high

//END  HIGH SEASON



//MID SEASON

stan_base_mid = standard *(dz * 60);
stan_sofa_mid = sofab1 * (dz * 35);

if (dz > 6) 
{
stan_base_mid = standard * (dz * 60);
stan_sofa_mid = sofab1 * (dz * 35);
}

family_base_mid = family * (dz * 120);
family_sofa_mid = sofab2 * (dz * 0);

if (dz > 6) 
{
family_base_mid = family * (dz * 120);
family_sofa_mid = sofab2 * (dz * 0);
}

seven_base_mid = seven * (dz * 120);
seven_sofa_mid = sofab3 * (dz * 0);
seven_extra_mid = extrab * (dz * 20);


if (dz > 6) 
{
seven_base_mid = seven * (dz * 120);
seven_sofa_mid = sofab3 * (dz * 0);
seven_extra_mid = extrab * (dz * 20);
}

price_mid = stan_base_mid + stan_sofa_mid + family_base_mid + family_sofa_mid + seven_base_mid + seven_sofa_mid + seven_extra_mid;
ppn_mid =  price_mid/dz; 

price_mid = holdmid * ppn_mid

//END  mid SEASON


//low SEASON

stan_base_low = standard *(dz * 57);
stan_sofa_low = sofab1 * (dz * 38);

if (dz > 6) 
{
stan_base_low = standard * (dz * 57);
stan_sofa_low = sofab1 * (dz * 35);
}

family_base_low = family * (dz * 115);
family_sofa_low = sofab2 * (dz * 0);

if (dz > 6) 
{
family_base_low = family * (dz * 112);
family_sofa_low = sofab2 * (dz * 0);
}

seven_base_low = seven * (dz * 115);
seven_sofa_low = sofab3 * (dz * 0);
seven_extra_low = extrab * (dz * 20);


if (dz > 6) 
{
seven_base_low = seven * (dz * 112);
seven_sofa_low = sofab3 * (dz * 0);
seven_extra_low = extrab * (dz * 20);
}

//START GIVE LOW PRICES IN JANUARY AND FEBRUARY
if ((arrivalmonth == 1 || arrivalmonth == 2) && (dz==2))
{

stan_base_low = standard *(dz * 50);
stan_sofa_low = sofab1 * (dz * 30);

if (dz > 6) 
{
stan_base_low = standard * (dz * 50);
stan_sofa_low = sofab1 * (dz * 30);
}

family_base_low = family * (dz * 115);
family_sofa_low = sofab2 * (dz * 0);

if (dz > 6) 
{
family_base_low = family * (dz * 100);
family_sofa_low = sofab2 * (dz * 0);
}

seven_base_low = seven * (dz * 115);
seven_sofa_low = sofab3 * (dz * 0);
seven_extra_low = extrab * (dz * 20);


if (dz > 6) 
{
seven_base_low = seven * (dz * 100);
seven_sofa_low = sofab3 * (dz * 0);
seven_extra_low = extrab * (dz * 20);
}

}
//END GIVE LOW PRICES IN JANUARY AND FEBRUARY

price_low = stan_base_low + stan_sofa_low + family_base_low + family_sofa_low + seven_base_low + seven_sofa_low + seven_extra_low;
ppn_low =  price_low/dz; 

price_low = holdlow * ppn_low

//END  low SEASON


fullprices = price_high + price_mid + price_low;





//GIVE FREE NIGHT IN JULY
//if ((arrivalmonth == 8 )||(arrivalmonth == 9 ))
//{
//		if (dz > 2 ){
//	price_per_night = fullprices /dz
//	fullprices = fullprices - price_per_night;}
//	}

//GIVE FREE NIGHT IF DATE IS LOW SEASON IN JANUARY, FEBRUARY FOR 2+ NIGHTS

discount = 0

if (holdlow > 2 && (arrivalmonth == 1 || arrivalmonth == 2)) 
{
discount = ppn_low}
fullprices = fullprices - discount





fullprices = Math.round(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;




maxp = ((2*((standard*1)+(family*2)+(seven*2)+(sofab1*1)+(sofab2*1)+(sofab3*1)))+(1*extrab)); 
document.form.maxp.value=maxp;

howmanyap = 0;
howmanyap =1*(((standard*1)+(family*1)+(seven*1)));


pricepn=0;
pricepp=0;
priceppn=0;




pricepn = fullprices/dz;
pricepp = fullprices/maxp;
priceppn = fullprices/maxp/dz;

if (maxp == 0)
{
pricepn=0;
pricepp=0;
priceppn=0;
}


document.form.howmanyap.value=howmanyap;
document.form.fullprice.value=Math.round(+fullprices*100)/100;
document.form.howmanyap.value=Math.round(+howmanyap);
document.form.ppn.value=Math.round(+pricepn);
document.form.ppp.value=Math.round(+pricepp);
document.form.pppn.value=Math.round(+priceppn);
document.form.pounds.value=Math.round(+pounds);
document.form.dollars.value=Math.round(+dollars);

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;




}

          

