function setVal() {


dz=document.form.duration.options[document.form.duration.selectedIndex].value;
sixty=document.form.sixty.options[document.form.sixty.selectedIndex].value;
seventy=document.form.seventy.options[document.form.seventy.selectedIndex].value;
ninety=document.form.ninety.options[document.form.ninety.selectedIndex].value;
ninetyfive=document.form.ninetyfive.options[document.form.ninetyfive.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;
lang=document.form.lang.value;

dollarconv=document.form.dollareuro.value;
poundeuro=document.form.poundeuro.value;


deposit_amount = 0
pay_dep = "NOPAY";

var d = new Date()
secs=d.getTime()
secss=("" + secs)
stamp=secss.substr(0,10)

sstemp = new Date(arrivalyear,arrivalmonth-1,arrivalday);
ss = sstemp.getTime();

//FIND OUT HOW MANY WEEKEND DAYS THERE ARE

weekend = 0
weekday = 0 

sstemp = new Date(arrivalyear,arrivalmonth-1,arrivalday);
ss = sstemp.getTime();

sx = ss
for (i = 1; i <= dz; i++)
{
dayuvweak = new Date (sx);
dayuvweak = dayuvweak.getDay()

if (dayuvweak < 5)
{
weekday++
} 
else {
weekend++
}
sx = (sx + 86400000)

}

//END FIND OUT HOW MANY WEEKEND DAYS THERE ARE



minimum(dz,ss)


//window.alert(holsupdays)


price= "0";


//FIND OUT IF SPECIAL DISCOUNT BOX IS CHECKED
if (document.form.want_discount.checked)
{want_discount = "Yes"}
else {
want_discount = "no"
}

//SPECIAL OFFER NON-REFUNDABLE DEPOSIT
if ((((((arrivalmonth == 6 )||(arrivalmonth == 7 )||(arrivalmonth == 8 ))) && (nodis == 0) && (dz > 2)&& (want_discount =="Yes"))))
{
{
texteng = "Special offer available on these dates.";
textspan = "Oferta espcial disponible en estas fechas.";

if (lang == "eng")
{text = texteng}
if (lang == "span")
{text = textspan}

window.alert(text)
}
pay_dep = "PAY"
}
//END SPECIAL OFFER NON-REFUNDABLE DEPOSIT

//NORMAL PRICE
high_sixtyprice = sixty * (dz * 85);
high_seventyprice = seventy * (dz * 95);
high_ninetyprice = ninety * (dz * 110);
high_ninetyfiveprice = ninetyfive * (dz * 120);



//WEEKDAY DISCOUNTS
if ((((arrivalmonth == 6 )||(arrivalmonth == 7 )||(arrivalmonth == 8 ))) && (nodis == 0))
{
//WEEKEND PRICE
high_sixtyprice_WE = sixty * (weekend * 55);
high_seventyprice_WE = seventy * (weekend * 65);
high_ninetyprice_WE = ninety * (weekend * 75);
high_ninetyfiveprice_WE = ninetyfive * (weekend * 85);


//WEEKDAY PRICE
high_sixtyprice_WD = sixty * (weekday * 50);
high_seventyprice_WD = seventy * (weekday * 60);
high_ninetyprice_WD = ninety * (weekday * 70);
high_ninetyfiveprice_WD = ninetyfive * (weekday * 80);

high_sixtyprice = high_sixtyprice_WE + high_sixtyprice_WD;
high_seventyprice = high_seventyprice_WE + high_seventyprice_WD;
high_ninetyprice = high_ninetyprice_WE + high_ninetyprice_WD;
high_ninetyfiveprice =  high_ninetyfiveprice_WE + high_ninetyfiveprice_WD;
}


if (pay_dep == "PAY")

{

if (arrivalmonth == 6)
   {
//DISCOUNT BY PAYING FULL AMOUNT
high_sixtyprice = sixty * (dz * 42.056);
high_seventyprice = seventy * (dz * 46.729);
high_ninetyprice = ninety * (dz * 56.075);
high_ninetyfiveprice = ninetyfive * (dz * 70.093);
deposit_amount = ((high_sixtyprice + high_seventyprice) + (high_sixtyprice + high_seventyprice)*0.07)
   }
else 
   {
//DISCOUNT BY PAYING FULL AMOUNT
high_sixtyprice = sixty * (dz * 41.667);
high_seventyprice = seventy * (dz * 46.296);
high_ninetyprice = ninety * (dz * 55.555);
high_ninetyfiveprice = ninetyfive * (dz * 69.444);
deposit_amount = ((high_sixtyprice + high_seventyprice) + (high_sixtyprice + high_seventyprice)*0.08)
   }
}



//alert if weekend and weekdays not equal number of days

if (weekend+weekday != dz)
{
window.alert("AAGGGHHH")
}

price = high_sixtyprice + high_seventyprice + high_ninetyprice + high_ninetyfiveprice; 





fullprices = price;

//CHANGE IN VAT AS OF JULY 2010
if (arrivalmonth == 6)
{
fullprices = fullprices + (fullprices * 0.07)
}
else 
{
fullprices = fullprices + (fullprices * 0.08)
}



//window.alert(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;
pesetass = fullprices*166.386;

document.form.maxp.value=2*((sixty*1)+(seventy*1)+(ninety*1)+(ninetyfive*1)); 
document.form.howmanyap.value=1*((sixty*1)+(seventy*1)+(ninety*1)+(ninetyfive*1)); 
document.form.id.value=+stamp;
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.downpayment.value=Math.round(+deposit_amount*100)/100;

document.form.holsupdays.value=holsupdays_zz;
document.form.holsup.value=holsup_zz;



}

          
