/* Hotel.si	Copyright © 2009 MAiS Informacijski sistemi.*//*init*/var hotelsi_AdultsMAX = 5;var hotelsi_KidsMAX = 3;/*1-SLO, 2-ENG, 3-GER, 4-ITA, 5-FRA, 6-CHN*/var hotelsi_TransInt = new Array();hotelsi_TransInt["SLO"] = [1];hotelsi_TransInt["ENG"] = [2];hotelsi_TransInt["GER"] = [3];hotelsi_TransInt["ITA"] = [4];hotelsi_TransInt["FRA"] = [5];hotelsi_TransInt["CHN"] = [6];/*Parameter check*//*language*/try {    if (hotelsi_language != undefined && hotelsi_language != null) {        hotelsi_lang = hotelsi_TransInt[hotelsi_language];    }}catch (e) {}try {    if (hotelsi_lang == undefined) {        alert("Parameter hotelsi_language is missing!");    }}catch (e) {    alert("Parameter hotelsi_language is missing!");}function hotelsi_ParameterCheck() {    try {        if (hotelsi_lang == undefined) {            alert("Parameter hotelsi_lang is missing!");            return false;        }    }    catch (e) {        alert("Parameter hotelsi_lang is missing!");        return false;    }    /*id hotela na portalu tip INT*/    try {        if (hotelsi_hotelID == undefined)            ;    }    catch (e) {        hotelsi_hotelID = undefined;    }    /*seznam hotelov tip ARRAY */    try {        if (hotelsi_hotels == undefined)            ;    }    catch (e) {        hotelsi_hotels = undefined;    }    if (hotelsi_hotels == undefined && hotelsi_hotelID == undefined) {        alert("One of parameters hotelsi_hotels or hotelsi_hotelID must be defined!");        return false;    }    return true;}/*koda cenika - opcijsko*/try {    if (hotelsi_rateCODE == undefined)        ;}catch (e) {    hotelsi_rateCODE = undefined;}/*seznam cenikov - opcijsko*/try {    if (hotelsi_rates == undefined)        ;    }    catch (e) {        hotelsi_rates = undefined;}/*povratni url, v primeru da se rezrvacije odprejo v istem oknu*/try {    if (hotelsi_ReturnUrl == undefined)        hotelsi_ReturnUrl = "";    }    catch (e) {        hotelsi_ReturnUrl = "";}/*look&feel prameters*//*false - odstrani Hotel.si povezavo*/ try {    if (hotelsi_DisplayBrand == undefined)        hotelsi_DisplayBrand = true;}catch (e) {    hotelsi_DisplayBrand = true;}/*false - odstrani izbiro odraslih in otrok*/try {    if (hotelsi_DisplayPersons == undefined)        hotelsi_DisplayPersons = true;}catch (e) {    hotelsi_DisplayPersons = true;}/*false - po koncu generiranja forme ne inicializira koledarjev*/try {    if (hotelsi_calendarInit == undefined)        hotelsi_calendarInit = true;}catch (e) {    hotelsi_calendarInit = true;}/*false - ne naloži dodatnih javascript (trenutno za koledar)*/try {    if (hotelsi_scripts == undefined)        hotelsi_scripts = true;}catch (e) {    hotelsi_scripts = true;}/*false - header "RESERVATIONS" se ne prikaže*/try {    if (hotelsi_DisplayHeader == undefined)        hotelsi_DisplayHeader = true;}catch (e) {    hotelsi_DisplayHeader = true;}/*postavite elementov {TWOCOLUMN,HORIZONTAL,VERTICAL}*/try {    if (hotelsi_layout == undefined)        hotelsi_layout = "VERTICAL";}catch (e) {    hotelsi_layout = "VERTICAL";}/*Preperties for custom calendar*/try {    if (hotelsi_txtArrivalProperties == undefined)        hotelsi_txtArrivalProperties = "";}catch (e) {    hotelsi_txtArrivalProperties = "";}try {    if (hotelsi_txtDepartureProperties == undefined)        hotelsi_txtDepartureProperties = "";}catch (e) {    hotelsi_txtDepartureProperties = "";}try {    if (hotelsi_btnArrivalProperties == undefined)        hotelsi_btnArrivalProperties = "";}catch (e) {    hotelsi_btnArrivalProperties = "";}try {    if (hotelsi_btnDepartureProperties == undefined)        hotelsi_btnDepartureProperties = "";}catch (e) {    hotelsi_btnDepartureProperties = "";}/*CSS style calendar*/try {    if (hotelsi_calendarCSS == undefined)        hotelsi_calendarCSS = window.location.protocol + "//www.fidelityhotel.net/scripts/embeded/cal/calendar-default.css";}catch (e) {    hotelsi_calendarCSS = window.location.protocol + "//www.fidelityhotel.net/scripts/embeded/cal/calendar-default.css";}/*false - odstrani vse CSS class vrednosti*/try {    if (hotelsi_InsertClasses == undefined)        hotelsi_InsertClasses = true;}catch (e) {    hotelsi_InsertClasses = true;}/*CSS class - table*/try {    if (hotelsi_tableClass == undefined)        hotelsi_tableClass = "class='hotelsi_defaultTable'";    else if (hotelsi_tableClass.match("class='") == null)        hotelsi_tableClass = "class='" + hotelsi_tableClass + "'";}catch (e) {    hotelsi_tableClass = "class='hotelsi_defaultTable'";}/*CSS class - header*/try {    if (hotelsi_headerClass == undefined)        hotelsi_headerClass = "class='hotelsi_defaultHead'";    else if (hotelsi_headerClass.match("class='") == null)        hotelsi_headerClass = "class='" + hotelsi_headerClass + "'";}catch (e) {    hotelsi_headerClass = "class='hotelsi_defaultHead'";}/*CSS class - labels*/try {    if (hotelsi_lblClass == undefined)        hotelsi_lblClass = "class='hotelsi_defaultLbl'";    else if (hotelsi_lblClass.match("class='") == null)        hotelsi_lblClass = "class='" + hotelsi_lblClass + "'";}catch (e) {    hotelsi_lblClass = "class='hotelsi_defaultLbl'";}/*CSS class - combobox*/try {    if (hotelsi_ddlClass == undefined)        hotelsi_ddlClass = "class='hotelsi_defaultSelect'";    else if (hotelsi_ddlClass.match("class='") == null)        hotelsi_ddlClass = "class='" + hotelsi_ddlClass + "'";}catch (e) {    hotelsi_ddlClass = "class='hotelsi_defaultSelect'";}/*CSS class - textfield*/try {    if (hotelsi_txtClass == undefined)        hotelsi_txtClass = "class='hotelsi_defaultInput'";    else if (hotelsi_txtClass.match("class='") == null)        hotelsi_txtClass = "class='" + hotelsi_txtClass + "'";}catch (e) {    hotelsi_txtClass = "class='hotelsi_defaultInput'";}/*CSS class - gumb za koledarček*/try {    if (hotelsi_btnCalClass == undefined)        hotelsi_btnCalClass = "class='hotelsi_CalBtn'";    else if (hotelsi_btnClass.match("class='") == null)        hotelsi_btnCalClass = "class='" + hotelsi_btnCalClass + "'";}catch (e) {    hotelsi_btnCalClass = "class='hotelsi_CalBtn'";}/*CSS class - gumbe rezerviraj*/try {    if (hotelsi_btnClass == undefined)        hotelsi_btnClass = "class='hotelsi_defaultBtn'";    else if (hotelsi_btnClass.match("class='") == null)        hotelsi_btnClass = "class='" + hotelsi_btnClass + "'";}catch (e) {    hotelsi_btnClass = "class='hotelsi_defaultBtn'";}if (!hotelsi_InsertClasses) {    hotelsi_headerClass = "";    hotelsi_tableClass = "";    hotelsi_lblClass = "";    hotelsi_ddlClass = "";    hotelsi_txtClass = "";    hotelsi_btnCalClass = "";    hotelsi_btnClass = "";}/*Transaltions1-SLO, 2-ENG, 3-GER, 4-ITA, 5-FRA, 6-CHN*/var hotelsi_Labels = new Array();hotelsi_Labels[1] = ["ONLINE REZERVACIJE", "Hotel", "Paket", "Prihod", "Odhod", "Odrasli", "Otroci", "Rezerviraj"];hotelsi_Labels[2] = ["ONLINE RESERVATIONS", "Hotel", "Packet", "Arrival", "Departure", "Adults", "Children", "Book"];hotelsi_Labels[3] = ["ONLINE RESERVIERUNGEN", "Hotel", "Paket", "Anreise", "Abreise", "Erwachs.", "Kinder", "Buchen"];hotelsi_Labels[4] = ["ONLINE PRENOTAZIONI", "Hotel", "Pacchetto", "Arrivo", "Partenza", "Adulti", "Bambini", "Book"];hotelsi_Labels[5] = ["RÉSERVATIONS EN LIGNE", "Hôtel", "Paquet", "Arrivée", "Départ", "Adultes", "Enfants", "Réserver"];hotelsi_Labels[6] = ["在线预订", "饭店", "包", "到达", "离开", "成人", "儿童", "预订"];var hotelsi_Setup = new Array();hotelsi_Setup[1] = ["SLO", "%d.%m.%Y", "dd.MM.yyyy"];hotelsi_Setup[2] = ["ENG", "%d/%m/%Y", "dd/MM/yyyy"];hotelsi_Setup[3] = ["GER", "%d.%m.%Y", "dd.MM.yyyy"];hotelsi_Setup[4] = ["ITA", "%d/%m/%Y", "dd/MM/yyyy"];hotelsi_Setup[5] = ["FRA", "%d/%m/%Y", "dd/MM/yyyy"];hotelsi_Setup[6] = ["CHN", "%Y/%m/%d", "yyyy/MM/dd"];/*Load scripts*/function hotelsi_dateAddDays(date, days) {    return new Date(date.getFullYear(), date.getMonth(), date.getDate() + days);}function hotelsi_strToDate(datestring) {    try {        return new Date(getDateFromFormat(datestring, hotelsi_Setup[hotelsi_lang][2]));    }    catch (e) {        return new Date();    }}function hotelsi_dateToString(date) {    try {        return formatDate(date, hotelsi_Setup[hotelsi_lang][2]);    }    catch (e) {        return formatDate(new Date(), hotelsi_Setup[hotelsi_lang][2]);    }}function hotelsi_catcalc(cal) {    var date = cal.date;    var time = 0;    var time2 = 0;    var name = cal.params.inputField.id;    var field = null;    if (name.indexOf("Arrival") != -1) {        field = document.getElementById(name.replace("Arrival", "Departure"));        time2 = hotelsi_strToDate(field.value).getTime();        time = hotelsi_dateAddDays(date, 1).getTime();        if (time2 < time) {            time2 = time;        }    } else {        field = document.getElementById(name.replace("Departure", "Arrival"));        time2 = hotelsi_strToDate(field.value).getTime();        time = hotelsi_dateAddDays(date, -1).getTime();        if (time2 > time) {            time2 = time;        }    }    var date2 = new Date(time2);    field.value = hotelsi_dateToString(date2);}function hotelsi_importJS(src, look_for, onload) {    var s = document.createElement('script');    s.setAttribute('type', 'text/javascript');    s.setAttribute('src', src);    if (onload) hotelsi_wait_for_script_load(look_for, onload);    var head = document.getElementsByTagName('head')[0];    if (head) {        head.appendChild(s);    } else {        document.body.appendChild(s);    }}function hotelsi_importCSS(href, look_for, onload) {    var s = document.createElement('link');    s.setAttribute('rel', 'stylesheet');    s.setAttribute('type', 'text/css');    s.setAttribute('media', 'screen');    s.setAttribute('href', href);    if (onload) hotelsi_wait_for_script_load(look_for, onload);    var head = document.getElementsByTagName('head')[0];    if (head) {        head.appendChild(s);    } else {        document.body.appendChild(s);    }}function hotelsi_wait_for_script_load(look_for, callback) {    var interval = setInterval(function() {        if (eval("typeof " + look_for) != 'undefined') {            clearInterval(interval);            callback();        }    }, 50);}/*EMBEDED FORM CODE*/if (hotelsi_scripts) {    hotelsi_importJS(window.location.protocol + '//www.fidelityhotel.net/scripts/embeded/cal/calendar_stripped.js');    hotelsi_wait_for_script_load("Calendar", function() { hotelsi_importJS(window.location.protocol + '//www.fidelityhotel.net/scripts/embeded/cal/calendar-setup_stripped.js'); });    if (hotelsi_lang == 1){        hotelsi_wait_for_script_load("Calendar", function() { hotelsi_importJS(window.location.protocol + '//www.fidelityhotel.net/scripts/embeded/cal/lang/calendar-si.js'); });    }    else if (hotelsi_lang == 3){        hotelsi_wait_for_script_load("Calendar", function() { hotelsi_importJS(window.location.protocol + '//www.fidelityhotel.net/scripts/embeded/cal/lang/calendar-de.js'); });    }    else if (hotelsi_lang == 4){        hotelsi_wait_for_script_load("Calendar", function() { hotelsi_importJS(window.location.protocol + '//www.fidelityhotel.net/scripts/embeded/cal/lang/calendar-it.js'); });    }    else{        hotelsi_wait_for_script_load("Calendar", function() { hotelsi_importJS(window.location.protocol + '//www.fidelityhotel.net/scripts/embeded/cal/lang/calendar-en.js'); });    }}hotelsi_importJS(window.location.protocol + '//www.fidelityhotel.net/scripts/embeded/booklib.js');try {    if (Ghotelsi_ReturnUrls == undefined)        Ghotelsi_ReturnUrls = new Array();}catch (e) {    Ghotelsi_ReturnUrls = new Array();}function hotelsi_Book(num, ReturnUrl) {    var arrival = document.getElementById('HotelSi_txtArrival' + num).value;    var departure = document.getElementById('HotelSi_txtDeparture' + num).value;    arrival = formatDate(hotelsi_strToDate(arrival), 'yyyy-MM-dd');    departure = formatDate(hotelsi_strToDate(departure), 'yyyy-MM-dd');        var adults = 1;    var kids = 0;    if (hotelsi_DisplayPersons) {        adults = document.getElementById('HotelSi_ddlAdults' + num).value;        kids = document.getElementById('HotelSi_ddlKids' + num).value;    }    hotel = document.getElementById('HotelSi_ddlHotel' + num).value;    var ratecode = undefined;    if (document.getElementById('HotelSi_ddlRate' + num) != null) {        ratecode = document.getElementById('HotelSi_ddlRate' + num).value;    }    if (Ghotelsi_ReturnUrls[num] == "") {        hotelsi_BookBlank(hotel, ratecode, arrival, departure, adults, kids, hotelsi_Setup[hotelsi_lang][0]);    }    else {        hotelsi_BookParent(hotel, ratecode, arrival, departure, adults, kids, hotelsi_Setup[hotelsi_lang][0], Ghotelsi_ReturnUrls[num]);    }    return false;}hotelsi_importCSS(window.location.protocol + "//www.fidelityhotel.net/scripts/embeded/style/hotelsiDefault.css");if (hotelsi_calendarCSS != "")    hotelsi_importCSS(hotelsi_calendarCSS);function hotelsi_printForm(divID) {    if (!hotelsi_ParameterCheck()) {        return false;    }    try {        if (Ghotelsi_FormCount == undefined)            Ghotelsi_FormCount = 0;    }    catch (e) {        Ghotelsi_FormCount = 0;    }    var FormCount = Ghotelsi_FormCount++;    var lbl = 0;    var htmlform = "";    var hidden = "";    var colspan = 1;    Ghotelsi_ReturnUrls[FormCount] = hotelsi_ReturnUrl;    try {        lbl++;        if (hotelsi_layout == "TWOCOLUMN") {            var paired = false;            var rowprinted = false;            var titleRow = "<tr>";            var inputRow = "<tr>";            if (hotelsi_hotels != undefined) {                titleRow += "<td valing='middle' align='left' " + hotelsi_lblClass + ">" + hotelsi_Labels[hotelsi_lang][lbl++] + "</td>";                inputRow += "<td valing='middle' align='left'><select " + hotelsi_ddlClass + " name='HotelSi_ddlHotel" + FormCount + "' id='HotelSi_ddlHotel" + FormCount + "'>";                for (var i = 0; i < hotelsi_hotels.length; i++) {                    inputRow += "<option value='" + hotelsi_hotels[i][0] + "'>" + hotelsi_hotels[i][1] + "</option>";                }                inputRow += "</select></td>";                paired = true;                rowprinted = true;            }            else {                hidden += "<input type='hidden' id='HotelSi_ddlHotel" + FormCount + "' name='HotelSi_ddlHotel" + FormCount + "' value='" + hotelsi_hotelID + "'/>";                lbl++;            }            if (hotelsi_rates != undefined) {                titleRow += "<td valing='middle' align='left' " + hotelsi_lblClass + ">" + hotelsi_Labels[hotelsi_lang][lbl++] + "</td>";                inputRow += "<td valing='middle' align='left'><select " + hotelsi_ddlClass + " name='HotelSi_ddlRate" + FormCount + "' id='HotelSi_ddlRate" + FormCount + "'>";                for (var i = 0; i < hotelsi_rates.length; i++) {                    inputRow += "<option value='" + hotelsi_rates[i][0] + "'>" + hotelsi_rates[i][1] + "</option>";                }                inputRow += "</select></td>";                if (!paired) {                    titleRow += "<td></td>";                    inputRow += "<td></td>";                }                rowprinted = true;            }            else if (hotelsi_rateCODE != undefined) {                paired = false;                hidden += "<input type='hidden' id='HotelSi_ddlRate" + FormCount + "' name='HotelSi_ddlRate" + FormCount + "' value='" + hotelsi_rateCODE + "'/>";                lbl++;            }            else {                paired = false;                lbl++;            }            if (rowprinted) {                if (!paired) {                    titleRow += "<td></td>";                    inputRow += "<td></td>";                }                            htmlform += titleRow + "</tr>" + inputRow + "</tr>";            }            htmlform += "<tr>" +                   "<td valing='middle' align='left' " + hotelsi_lblClass + ">" + hotelsi_Labels[hotelsi_lang][lbl++] + "</td>" +                   "<td valing='middle' align='left' " + hotelsi_lblClass + ">" + hotelsi_Labels[hotelsi_lang][lbl++] + "</td>" +                   "</tr>" +                   "<tr>" +                   "<td valing='middle' align='left' style='white-space:nowrap;'><input " + hotelsi_txtClass + " type='text' name='HotelSi_txtArrival" + FormCount + "' id='HotelSi_txtArrival" + FormCount + "' value='" + hotelsi_dateToString(hotelsi_dateAddDays(new Date(), 1)) + "' " + hotelsi_txtArrivalProperties + "/><button name='HotelSi_btnArrival" + FormCount + "' id='HotelSi_btnArrival" + FormCount + "' " + hotelsi_btnCalClass + "></button></td>" +                   "<td valing='middle' align='left' style='white-space:nowrap;'><input " + hotelsi_txtClass + "type='text' name='HotelSi_txtDeparture" + FormCount + "' id='HotelSi_txtDeparture" + FormCount + "' value='" + hotelsi_dateToString(hotelsi_dateAddDays(new Date(), 2)) + "' " + hotelsi_txtDepartureProperties + "/><button name='HotelSi_btnDeparture" + FormCount + "' id='HotelSi_btnDeparture" + FormCount + "' " + hotelsi_btnCalClass + "></button></td>" +                   "</tr>";            if (hotelsi_DisplayPersons) {                htmlform += "<tr>" +                            "<td valing='middle' align='left' " + hotelsi_lblClass + ">" + hotelsi_Labels[hotelsi_lang][lbl++] + "</td>" +                             "<td valing='middle' align='left' " + hotelsi_lblClass + ">" + hotelsi_Labels[hotelsi_lang][lbl++] + "</td>" +                            "</tr>";                htmlform += "<tr>" +                "<td valing='top' align='left'><select " + hotelsi_ddlClass + " style='width:40px;' name='HotelSi_ddlAdults" + FormCount + "' id='HotelSi_ddlAdults" + FormCount + "'>";                for (var i = 1; i <= hotelsi_AdultsMAX; i++) {                    htmlform += "<option value='" + i + "'>" + i + "</option>";                }                htmlform += "</select></td>" +                "<td valing='top' align='left'><select " + hotelsi_ddlClass + " style='width:40px;' name='HotelSi_ddlKids" + FormCount + "' id='HotelSi_ddlKids" + FormCount + "'>";                for (var i = 0; i <= hotelsi_KidsMAX; i++) {                    htmlform += "<option value='" + i + "'>" + i + "</option>";                }                htmlform += "</select></td></tr>";            }            else {                lbl++;                lbl++;            }            htmlform += "<tr>" +                   "<td valing='middle' colspan='2' align='center'><button style='margin: 5px auto !important;' type='button' " + hotelsi_btnClass + " onclick='javascript:hotelsi_Book(" + FormCount + ",\"" + hotelsi_ReturnUrl + "\");'>" + hotelsi_Labels[hotelsi_lang][lbl++] + "</button></td>" +                   "</tr>";            if (hotelsi_DisplayBrand) {                htmlform += "<tr>" +                           "<td valing='bottom' colspan='2' align='right'><a class='hotelsi_defaultInfo' href='http://www.fidelityhotel.net' target='_blank'>Hotel.si</a></td>" +                           "</tr>";            }        }        else if (hotelsi_layout == "HORIZONTAL") {            htmlform += "<tr>";            if (hotelsi_hotels != undefined) {                htmlform += "<td valing='middle' align='left' " + hotelsi_lblClass + ">" + hotelsi_Labels[hotelsi_lang][lbl++] + "</td>";            }            else {                lbl++;            }            if (hotelsi_rates != undefined) {                htmlform += "<td valing='middle' align='left' " + hotelsi_lblClass + ">" + hotelsi_Labels[hotelsi_lang][lbl++] + "</td>";            }            else {                lbl++;            }            htmlform += "<td valing='middle' align='left' " + hotelsi_lblClass + ">" + hotelsi_Labels[hotelsi_lang][lbl++] + "</td>" +                   "<td valing='middle' align='left' " + hotelsi_lblClass + ">" + hotelsi_Labels[hotelsi_lang][lbl++] + "</td>";            if (hotelsi_DisplayPersons) {                htmlform += "<td valing='middle' align='left' " + hotelsi_lblClass + ">" + hotelsi_Labels[hotelsi_lang][lbl++] + "</td>" +                   "<td valing='middle' align='left' " + hotelsi_lblClass + ">" + hotelsi_Labels[hotelsi_lang][lbl++] + "</td>";            }            else {                lbl++;                lbl++;            }            htmlform += "</tr><tr>";            if (hotelsi_hotels != undefined) {                htmlform += "<td valing='middle' align='left'><select " + hotelsi_ddlClass + " name='HotelSi_ddlHotel" + FormCount + "' id='HotelSi_ddlHotel" + FormCount + "'>";                for (var i = 0; i < hotelsi_hotels.length; i++) {                    htmlform += "<option value='" + hotelsi_hotels[i][0] + "'>" + hotelsi_hotels[i][1] + "</option>";                }                htmlform += "</select></td>";            }            else {                hidden += "<input type='hidden' id='HotelSi_ddlHotel" + FormCount + "' name='HotelSi_ddlHotel" + FormCount + "' value='" + hotelsi_hotelID + "'/>";            }            if (hotelsi_rates != undefined) {                htmlform += "<td valing='middle' align='left'><select " + hotelsi_ddlClass + " name='HotelSi_ddlRate" + FormCount + "' id='HotelSi_ddlRate" + FormCount + "'>";                for (var i = 0; i < hotelsi_rates.length; i++) {                    htmlform += "<option value='" + hotelsi_rates[i][0] + "'>" + hotelsi_rates[i][1] + "</option>";                }                htmlform += "</select></td>";            }            else if (hotelsi_rateCODE != undefined) {                hidden += "<input type='hidden' id='HotelSi_ddlRate" + FormCount + "' name='HotelSi_ddlRate" + FormCount + "' value='" + hotelsi_rateCODE + "'/>";            }            htmlform += "<td valing='middle' align='left' style='white-space:nowrap;'><input " + hotelsi_txtClass + " type='text' name='HotelSi_txtArrival" + FormCount + "' id='HotelSi_txtArrival" + FormCount + "' value='" + hotelsi_dateToString(hotelsi_dateAddDays(new Date(), 1)) + "' " + hotelsi_txtArrivalProperties + "/><button name='HotelSi_btnArrival" + FormCount + "' id='HotelSi_btnArrival" + FormCount + "' " + hotelsi_btnCalClass + " " + hotelsi_btnArrivalProperties + "></button></td>" +                   "<td valing='middle' align='left' style='white-space:nowrap;'><input " + hotelsi_txtClass + " type='text' name='HotelSi_txtDeparture" + FormCount + "' id='HotelSi_txtDeparture" + FormCount + "' value='" + hotelsi_dateToString(hotelsi_dateAddDays(new Date(), 2)) + "' " + hotelsi_txtDepartureProperties + "/><button name='HotelSi_btnDeparture" + FormCount + "' id='HotelSi_btnDeparture" + FormCount + "' " + hotelsi_btnCalClass + " " + hotelsi_btnDepartureProperties + "></button></td>";            if (hotelsi_DisplayPersons) {                htmlform += "<td valing='middle' align='left'><select " + hotelsi_ddlClass + " style='width:40px;' name='HotelSi_ddlAdults" + FormCount + "' id='HotelSi_ddlAdults" + FormCount + "'>";                for (var i = 1; i <= hotelsi_AdultsMAX; i++) {                    htmlform += "<option value='" + i + "'>" + i + "</option>";                }                htmlform += "</select></td>";                htmlform += "<td valing='middle' align='left'><select " + hotelsi_ddlClass + " style='width:40px;' name='HotelSi_ddlKids" + FormCount + "' id='HotelSi_ddlKids" + FormCount + "'>";                for (var i = 0; i <= hotelsi_KidsMAX; i++) {                    htmlform += "<option value='" + i + "'>" + i + "</option>";                }                htmlform += "</select></td>";            }            htmlform += "</tr><tr>";            if (hotelsi_DisplayBrand) {                htmlform += "<td valing='middle' align='left'><a class='hotelsi_defaultInfo' href='http://www.fidelityhotel.net' target='_blank'>Hotel.si</a></td>";            }            else {                htmlform += "<td></td>";            }            if (hotelsi_hotels != undefined) {                colspan++;            }            if (hotelsi_rates != undefined)                colspan++;            if (hotelsi_DisplayPersons)                colspan += 2;            if (colspan > 1) {                htmlform += "<td valing='middle' align='right' colspan='" + colspan + "'>";            }            else {                htmlform += "<td valing='middle' align='right'>";            }            htmlform += "<button type='button' " + hotelsi_btnClass + " onclick='javascript:hotelsi_Book(" + FormCount + ",\"" + hotelsi_ReturnUrl + "\");'>" + hotelsi_Labels[hotelsi_lang][lbl++] + "</button></td>" +                   "</tr>";        }        else {            if (hotelsi_hotels != undefined) {                htmlform += "<tr>" +                            "<td valing='middle' align='left' " + hotelsi_lblClass + ">" + hotelsi_Labels[hotelsi_lang][lbl++] + "</td>" +                            "<td valing='middle' align='left'><select " + hotelsi_ddlClass + " name='HotelSi_ddlHotel" + FormCount + "' id='HotelSi_ddlHotel" + FormCount + "'>";                for (var i = 0; i < hotelsi_hotels.length; i++) {                    htmlform += "<option value='" + hotelsi_hotels[i][0] + "'>" + hotelsi_hotels[i][1] + "</option>";                }                htmlform += "</select></td></tr>";            }            else {                hidden += "<input type='hidden' id='HotelSi_ddlHotel" + FormCount + "' name='HotelSi_ddlHotel" + FormCount + "' value='" + hotelsi_hotelID + "'/>";                lbl++;            }            if (hotelsi_rates != undefined) {                htmlform += "<tr>" +                            "<td valing='middle' align='left' " + hotelsi_lblClass + ">" + hotelsi_Labels[hotelsi_lang][lbl++] + "</td>" +                            "<td valing='middle' align='left'><select " + hotelsi_ddlClass + " name='HotelSi_ddlRate" + FormCount + "' id='HotelSi_ddlRate" + FormCount + "'>";                for (var i = 0; i < hotelsi_rates.length; i++) {                    htmlform += "<option value='" + hotelsi_rates[i][0] + "'>" + hotelsi_rates[i][1] + "</option>";                }                htmlform += "</select></td></tr>";            }            else if (hotelsi_rateCODE != undefined) {                hidden += "<input type='hidden' id='HotelSi_ddlRate" + FormCount + "' name='HotelSi_ddlRate" + FormCount + "' value='" + hotelsi_rateCODE + "'/>";                lbl++;            }            else {                lbl++;            }            htmlform += "<tr>" +                   "<td valing='middle' align='left' " + hotelsi_lblClass + ">" + hotelsi_Labels[hotelsi_lang][lbl++] + "</td>" +                   "<td valing='middle' align='left' style='white-space:nowrap;'><input " + hotelsi_txtClass + " type='text' name='HotelSi_txtArrival" + FormCount + "' id='HotelSi_txtArrival" + FormCount + "' value='" + hotelsi_dateToString(hotelsi_dateAddDays(new Date(), 1)) + "' " + hotelsi_txtArrivalProperties + "/><button name='HotelSi_btnArrival" + FormCount + "' id='HotelSi_btnArrival" + FormCount + "' " + hotelsi_btnCalClass + "></button></td>" +                   "</tr>" +                   "<tr>" +                   "<td valing='middle' align='left' " + hotelsi_lblClass + ">" + hotelsi_Labels[hotelsi_lang][lbl++] + "</td>" +                   "<td valing='middle' align='left' style='white-space:nowrap;'><input " + hotelsi_txtClass + "type='text' name='HotelSi_txtDeparture" + FormCount + "' id='HotelSi_txtDeparture" + FormCount + "' value='" + hotelsi_dateToString(hotelsi_dateAddDays(new Date(), 2)) + "' " + hotelsi_txtDepartureProperties + "/><button name='HotelSi_btnDeparture" + FormCount + "' id='HotelSi_btnDeparture" + FormCount + "' " + hotelsi_btnCalClass + "></button></td>" +                   "</tr>";            if (hotelsi_DisplayPersons) {                htmlform += "<tr>" +                            "<td valing='middle' align='left' " + hotelsi_lblClass + ">" + hotelsi_Labels[hotelsi_lang][lbl++] + "</td>" +                            "<td valing='top' align='left'><select " + hotelsi_ddlClass + " style='width:40px;' name='HotelSi_ddlAdults" + FormCount + "' id='HotelSi_ddlAdults" + FormCount + "'>";                for (var i = 1; i <= hotelsi_AdultsMAX; i++) {                    htmlform += "<option value='" + i + "'>" + i + "</option>";                }                htmlform += "</select></td></tr>";                htmlform += "<tr>" +                            "<td valing='middle' align='left' " + hotelsi_lblClass + ">" + hotelsi_Labels[hotelsi_lang][lbl++] + "</td>" +                            "<td valing='top' align='left'><select " + hotelsi_ddlClass + " style='width:40px;' name='HotelSi_ddlKids" + FormCount + "' id='HotelSi_ddlKids" + FormCount + "'>";                for (var i = 0; i <= hotelsi_KidsMAX; i++) {                    htmlform += "<option value='" + i + "'>" + i + "</option>";                }                htmlform += "</select></td></tr>";            }            else {                lbl++;                lbl++;            }            htmlform += "<tr>" +                   "<td valing='middle' colspan='2' align='center'><button style='margin: 5px auto !important;' type='button' " + hotelsi_btnClass + " onclick='javascript:hotelsi_Book(" + FormCount + ",\"" + hotelsi_ReturnUrl + "\");'>" + hotelsi_Labels[hotelsi_lang][lbl++] + "</button></td>" +                   "</tr>";            if (hotelsi_DisplayBrand) {                htmlform += "<tr>" +                           "<td valing='bottom' colspan='2' align='right'><a class='hotelsi_defaultInfo' href='http://www.fidelityhotel.net' target='_blank'>Hotel.si</a></td>" +                           "</tr>";            }        }        /*header rabm vedet kolk je colspan*/        if (hotelsi_DisplayHeader) {            htmlform = "<tr><td colspan='" + (colspan + 1) + "' " + hotelsi_headerClass + ">" + hotelsi_Labels[hotelsi_lang][0] + "</td></tr>" + "<tr><td colspan='" + (colspan + 1) + "'></td></tr>" + htmlform;        }        htmlform = "<table border='0' cellspacing='0' cellpadding='0' " + hotelsi_tableClass + ">" + htmlform;        htmlform += "</table>";        document.write(htmlform + hidden);    }    catch (e) {        alert(e);    }    if (hotelsi_calendarInit) {        var calINIT = "Calendar.setup({" +                            "inputField: \"HotelSi_txtArrival" + FormCount + "\"," +                            "button: \"HotelSi_btnArrival" + FormCount + "\"," +                            "ifFormat: \"" + hotelsi_Setup[hotelsi_lang][1] + "\"," +                            "weekNumbers: false," +                            "firstDay: 1," +                            "electric: false," +                            "showOthers: true," +                            "onUpdate: hotelsi_catcalc" +                        "});" +                        "Calendar.setup({" +                            "inputField: \"HotelSi_txtDeparture" + FormCount + "\"," +                            "button: \"HotelSi_btnDeparture" + FormCount + "\"," +                            "ifFormat: \"" + hotelsi_Setup[hotelsi_lang][1] + "\"," +                            "weekNumbers: false," +                            "firstDay: 1," +                            "electric: false," +                            "showOthers: true," +                            "onUpdate: hotelsi_catcalc" +                        "});";        hotelsi_wait_for_script_load("Calendar", function() { hotelsi_wait_for_script_load("Calendar._TT", function() { hotelsi_wait_for_script_load("Calendar.setup", function() { setTimeout(calINIT, 10); }); }); });    }}/* ===================================================================// Author: Matt Kruse <matt@mattkruse.com>// WWW: http://www.mattkruse.com///// NOTICE: You may use this code for any purpose, commercial or// private, without any further permission from the author. You may// remove this notice from your final code if you wish, however it is// appreciated by the author if at least my web site address is kept.//// You may *NOT* re-distribute this code in any way except through its// use. That means, you can include it in your product, or your web// site, or any other form where the code is actually being used. You// may not put the plain javascript up on your site for download or// include it in your javascript libraries for download. // If you wish to share this code with others, please just point them// to the URL instead.// Please DO NOT link directly to my .js files from your site. Copy// the files to your server and use them there. Thank you.// ===================================================================*/var MONTH_NAMES = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); var DAY_NAMES = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');function LZ(x) { return (x < 0 || x > 9 ? "" : "0") + x }function isDate(val, format) { var date = getDateFromFormat(val, format); if (date == 0) { return false; } return true; }function compareDates(date1, dateformat1, date2, dateformat2) { var d1 = getDateFromFormat(date1, dateformat1); var d2 = getDateFromFormat(date2, dateformat2); if (d1 == 0 || d2 == 0) { return -1; } else if (d1 > d2) { return 1; } return 0; }function formatDate(date, format) { format = format + ""; var result = ""; var i_format = 0; var c = ""; var token = ""; var y = date.getYear() + ""; var M = date.getMonth() + 1; var d = date.getDate(); var E = date.getDay(); var H = date.getHours(); var m = date.getMinutes(); var s = date.getSeconds(); var yyyy, yy, MMM, MM, dd, hh, h, mm, ss, ampm, HH, H, KK, K, kk, k; var value = new Object(); if (y.length < 4) { y = "" + (y - 0 + 1900); } value["y"] = "" + y; value["yyyy"] = y; value["yy"] = y.substring(2, 4); value["M"] = M; value["MM"] = LZ(M); value["MMM"] = MONTH_NAMES[M - 1]; value["NNN"] = MONTH_NAMES[M + 11]; value["d"] = d; value["dd"] = LZ(d); value["E"] = DAY_NAMES[E + 7]; value["EE"] = DAY_NAMES[E]; value["H"] = H; value["HH"] = LZ(H); if (H == 0) { value["h"] = 12; } else if (H > 12) { value["h"] = H - 12; } else { value["h"] = H; } value["hh"] = LZ(value["h"]); if (H > 11) { value["K"] = H - 12; } else { value["K"] = H; } value["k"] = H + 1; value["KK"] = LZ(value["K"]); value["kk"] = LZ(value["k"]); if (H > 11) { value["a"] = "PM"; } else { value["a"] = "AM"; } value["m"] = m; value["mm"] = LZ(m); value["s"] = s; value["ss"] = LZ(s); while (i_format < format.length) { c = format.charAt(i_format); token = ""; while ((format.charAt(i_format) == c) && (i_format < format.length)) { token += format.charAt(i_format++); } if (value[token] != null) { result = result + value[token]; } else { result = result + token; } } return result; }function _isInteger(val) { var digits = "1234567890"; for (var i = 0; i < val.length; i++) { if (digits.indexOf(val.charAt(i)) == -1) { return false; } } return true; }function _getInt(str, i, minlength, maxlength) { for (var x = maxlength; x >= minlength; x--) { var token = str.substring(i, i + x); if (token.length < minlength) { return null; } if (_isInteger(token)) { return token; } } return null; }function getDateFromFormat(val, format) { val = val + ""; format = format + ""; var i_val = 0; var i_format = 0; var c = ""; var token = ""; var token2 = ""; var x, y; var now = new Date(); var year = now.getYear(); var month = now.getMonth() + 1; var date = 1; var hh = now.getHours(); var mm = now.getMinutes(); var ss = now.getSeconds(); var ampm = ""; while (i_format < format.length) { c = format.charAt(i_format); token = ""; while ((format.charAt(i_format) == c) && (i_format < format.length)) { token += format.charAt(i_format++); } if (token == "yyyy" || token == "yy" || token == "y") { if (token == "yyyy") { x = 4; y = 4; } if (token == "yy") { x = 2; y = 2; } if (token == "y") { x = 2; y = 4; } year = _getInt(val, i_val, x, y); if (year == null) { return 0; } i_val += year.length; if (year.length == 2) { if (year > 70) { year = 1900 + (year - 0); } else { year = 2000 + (year - 0); } } } else if (token == "MMM" || token == "NNN") { month = 0; for (var i = 0; i < MONTH_NAMES.length; i++) { var month_name = MONTH_NAMES[i]; if (val.substring(i_val, i_val + month_name.length).toLowerCase() == month_name.toLowerCase()) { if (token == "MMM" || (token == "NNN" && i > 11)) { month = i + 1; if (month > 12) { month -= 12; } i_val += month_name.length; break; } } } if ((month < 1) || (month > 12)) { return 0; } } else if (token == "EE" || token == "E") { for (var i = 0; i < DAY_NAMES.length; i++) { var day_name = DAY_NAMES[i]; if (val.substring(i_val, i_val + day_name.length).toLowerCase() == day_name.toLowerCase()) { i_val += day_name.length; break; } } } else if (token == "MM" || token == "M") { month = _getInt(val, i_val, token.length, 2); if (month == null || (month < 1) || (month > 12)) { return 0; } i_val += month.length; } else if (token == "dd" || token == "d") { date = _getInt(val, i_val, token.length, 2); if (date == null || (date < 1) || (date > 31)) { return 0; } i_val += date.length; } else if (token == "hh" || token == "h") { hh = _getInt(val, i_val, token.length, 2); if (hh == null || (hh < 1) || (hh > 12)) { return 0; } i_val += hh.length; } else if (token == "HH" || token == "H") { hh = _getInt(val, i_val, token.length, 2); if (hh == null || (hh < 0) || (hh > 23)) { return 0; } i_val += hh.length; } else if (token == "KK" || token == "K") { hh = _getInt(val, i_val, token.length, 2); if (hh == null || (hh < 0) || (hh > 11)) { return 0; } i_val += hh.length; } else if (token == "kk" || token == "k") { hh = _getInt(val, i_val, token.length, 2); if (hh == null || (hh < 1) || (hh > 24)) { return 0; } i_val += hh.length; hh--; } else if (token == "mm" || token == "m") { mm = _getInt(val, i_val, token.length, 2); if (mm == null || (mm < 0) || (mm > 59)) { return 0; } i_val += mm.length; } else if (token == "ss" || token == "s") { ss = _getInt(val, i_val, token.length, 2); if (ss == null || (ss < 0) || (ss > 59)) { return 0; } i_val += ss.length; } else if (token == "a") { if (val.substring(i_val, i_val + 2).toLowerCase() == "am") { ampm = "AM"; } else if (val.substring(i_val, i_val + 2).toLowerCase() == "pm") { ampm = "PM"; } else { return 0; } i_val += 2; } else { if (val.substring(i_val, i_val + token.length) != token) { return 0; } else { i_val += token.length; } } } if (i_val != val.length) { return 0; } if (month == 2) { if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) { if (date > 29) { return 0; } } else { if (date > 28) { return 0; } } } if ((month == 4) || (month == 6) || (month == 9) || (month == 11)) { if (date > 30) { return 0; } } if (hh < 12 && ampm == "PM") { hh = hh - 0 + 12; } else if (hh > 11 && ampm == "AM") { hh -= 12; } var newdate = new Date(year, month - 1, date, hh, mm, ss); return newdate.getTime(); }

