
function setVal() {
  dz=document.form.duration.options[document.form.duration.selectedIndex].value;
  mz=document.form.numberofpeople.options[document.form.numberofpeople.selectedIndex].value;
  dollarconv=document.form.dollareuro.value;
  poundeuro=document.form.poundeuro.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;


if (arrivalyear == 2008)

{

price= "0";

if (dz == 5 && mz < 3 )
{price = 325}
if (dz == 6 && mz < 3 )
{price = 390}
if (dz == 7 && mz < 3 )
{price = 390}
if (dz > 7 && mz < 3 )
{price = ((dz-7)*45) + 390}

if (dz == 4 && mz == 3 )
{price = 344}
if (dz == 5 && mz == 3 )
{price = 430}
if (dz == 6 && mz == 3 )
{price = 490}
if (dz == 7 && mz == 3 )
{price = 490}
if (dz > 7 && mz == 3 )
{price = ((dz-7)*60) + 490}
if (dz > 14 && mz == 3 )
{price = ((dz-14)*57) + 910}
if (dz > 21 && mz == 3 )
{price = ((dz-21)*55) + 1309}

if (dz == 25 && mz == 3 )
{price = 1529}
if (dz == 26 && mz == 3 )
{price = 1594}
if (dz == 27 && mz == 3 )
{price = 1649}
if (dz == 28 && mz == 3 )
{price = 1704}


if (dz == 3 && mz == 4 )
{price = 321}
if (dz == 4 && mz == 4 )
{price = 428}
if (dz == 5 && mz == 4 )
{price = 535}
if (dz == 6 && mz == 4 )
{price = 590}
if (dz == 7 && mz == 4 )
{price = 590}

if (dz > 7 && mz == 4 )
{price = ((dz-7)*75) + 590}
if (dz > 14 && mz == 4 )
{price = ((dz-14)*69) + 1115}
if (dz > 21 && mz == 4 )
{price = ((dz-21)*65) + 1598}

}

//2009 2009

if (arrivalyear > 2008)

{

price= "0";

if (dz == 5 && mz < 3 )
{price = 350}
if (dz == 6 && mz < 3 )
{price = 420}
if (dz == 7 && mz < 3 )
{price = 420}
if (dz > 7 && mz < 3 )
{price = ((dz-7)*45) + 420}

if (dz == 4 && mz == 3 )
{price = 364}
if (dz == 5 && mz == 3 )
{price = 455}
if (dz == 6 && mz == 3 )
{price = 520}
if (dz == 7 && mz == 3 )
{price = 520}
if (dz > 7 && mz == 3 )
{price = ((dz-7)*60) + 520}
if (dz > 14 && mz == 3 )
{price = ((dz-14)*57) + 940}
if (dz > 21 && mz == 3 )
{price = ((dz-21)*55) + 1339}

if (dz == 25 && mz == 3 )
{price = 1559}
if (dz == 26 && mz == 3 )
{price = 1614}
if (dz == 27 && mz == 3 )
{price = 1669}
if (dz == 28 && mz == 3 )
{price = 1724}

if (dz == 3 && mz == 4 )
{price = 336}
if (dz == 4 && mz == 4 )
{price = 448}
if (dz == 5 && mz == 4 )
{price = 560}
if (dz == 6 && mz == 4 )
{price = 620}
if (dz == 7 && mz == 4 )
{price = 620}

if (dz > 7 && mz == 4 )
{price = ((dz-7)*75) + 620}
if (dz > 14 && mz == 4 )
{price = ((dz-14)*69) + 1145}
if (dz > 21 && mz == 4 )
{price = ((dz-21)*65) + 1628}

}


if (lang == "eng")
{min5nxtext = "The minimum length of stay for 1 or 2 people is 5 nights.";
min4nxtext = "The minimum length of stay for 3 people is 4 nights.";}

if (lang == "span")
{min5nxtext = "La estancia mínima para 1 o 2 personas es 5 noches.";
min4nxtext = "La estancia mínima para 3 personas es 4 noches."}

if (mz < 3 && dz < 5)
{window.alert(min5nxtext);
document.form.duration.options.value = 5;
document.form.duration.options[document.form.duration.selectedIndex].value = 5;
setVal(form)}

if (mz == 3 && dz < 4)
{window.alert(min4nxtext);
document.form.duration.options.value = 4;
document.form.duration.options[document.form.duration.selectedIndex].value = 4;
setVal(form)}

parking =0;

if (document.form.parking.checked)
{parking =0;}


fullprices =(price*1)+(parking*1);

//fullprices = price;

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;

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);
}
