﻿
function Book(idApart) {
    SendFormBook(document.getElementById("fidDestino").value
               , idApart
               , document.getElementById("fcal-arr").value
               , document.getElementById("fcal-go").value
               , document.getElementById("fPax").value
               , document.getElementById("fPaxKids").value
               , document.getElementById("fPaxBabies").value
               , document.getElementById("fIdioma").value
               , document.getElementById("fCurrency").value)

}

function BookApt() {
    SendFormBook(document.getElementById("fidDestino").value
               , document.getElementById("fidApart").value
               , document.getElementById("fcal-arrApt").value
               , document.getElementById("fcal-goApt").value
               , document.getElementById("fPaxApt").value
               , document.getElementById("fPaxKidsApt").value
               , document.getElementById("fPaxBabiesApt").value
               , document.getElementById("fIdioma").value
               , document.getElementById("fCurrency").value)

}


function SendFormBook(fiddestino, fidapart, fcalarr, fcalgo, fpax, fkids, fbabies, fidioma, fcurrency) {

    var action = "https://" + window.location.host + "/reservation/personalDetails.aspx";

    var f = document.createElement("form");
    f.setAttribute("name", "formBook");
    f.setAttribute("action", action);
    f.setAttribute("method", "POST");

    var field = document.createElement("input");
    field.setAttribute("type", "hidden");
    field.setAttribute("name", "fidDestino");
    field.setAttribute("value", fiddestino);
    f.appendChild(field);

    var field = document.createElement("input");
    field.setAttribute("type", "hidden");
    field.setAttribute("name", "fidApart");
    field.setAttribute("value", fidapart);
    f.appendChild(field);

    var field = document.createElement("input");
    field.setAttribute("type", "hidden");
    field.setAttribute("name", "fcal-arr");
    field.setAttribute("value", fcalarr);
    f.appendChild(field);

    var field = document.createElement("input");
    field.setAttribute("type", "hidden");
    field.setAttribute("name", "fcal-go");
    field.setAttribute("value", fcalgo);
    f.appendChild(field);

    var field = document.createElement("input");
    field.setAttribute("type", "hidden");
    field.setAttribute("name", "fPax");
    field.setAttribute("value", fpax);
    f.appendChild(field);

    var field = document.createElement("input");
    field.setAttribute("type", "hidden");
    field.setAttribute("name", "fPaxKids");
    field.setAttribute("value", fkids);
    f.appendChild(field);

    var field = document.createElement("input");
    field.setAttribute("type", "hidden");
    field.setAttribute("name", "fPaxBabies");
    field.setAttribute("value", fbabies);
    f.appendChild(field);


    var field = document.createElement("input");
    field.setAttribute("type", "hidden");
    field.setAttribute("name", "fIdioma");
    field.setAttribute("value", fidioma);
    f.appendChild(field);

    var field = document.createElement("input");
    field.setAttribute("type", "hidden");
    field.setAttribute("name", "fCurrency");
    field.setAttribute("value", fcurrency);
    f.appendChild(field);

    var field = document.createElement("input");
    field.setAttribute("type", "hidden");
    field.setAttribute("name", "initBooking");
    field.setAttribute("value", 1);
    f.appendChild(field);
    document.body.appendChild(f);

    f.submit();
}
