﻿function open_booking_2() {
    var path2 = path + "frmbooking2.aspx?CR=" + CR
    var stile = "neutro"
    var tipo = "3d"
    var ordinamento = ""
    var stag=""
    // Stile
    for (var i = 0; i < document.forms[0].radio_2.length; i++) {
        if (document.forms[0].radio_2[i].checked)
            stile = document.forms[0].radio_2[i].value
    }
    path2 = path2 + "&stile=" + stile
    // Stile booking
    for (var i = 0; i < document.forms[0].radio_2_tipo.length; i++) {
        if (document.forms[0].radio_2_tipo[i].checked)
            tipo = document.forms[0].radio_2_tipo[i].value
    }
    path2 = path2 + "&stilebooking=" + tipo
    // Ordinamento
    for (var i = 0; i < document.forms[0].radio_2_ord.length; i++) {
        if (document.forms[0].radio_2_ord[i].checked) {
            ordinamento = document.forms[0].radio_2_ord[i].value
        }
    }
    if(ordinamento!="")
        path2 = path2 + "&ordinamento=" + ordinamento
    // Stagionalità
    for (var i = 0; i < document.forms[0].radio_2_stag.length; i++) {
        if ((document.forms[0].radio_2_stag[i].checked)&&(document.forms[0].radio_2_stag[i].value!="si"))
            stag = document.forms[0].radio_2_stag[i].value
    }
    if(stag!="")
        path2 = path2 + "&Stag=" + stag
    var win2 = window.open(path2, "_blank", "width=985,height=430,resizable=yes")
//    winR.focus()
}
function open_booking_R() {
    var pathR = path + "frmbookingR.aspx?CR=" + CR + "&CdR=" + CdR
    var stile = "neutro"
    var tipo = "3d"
    var ordinamento = ""
    var stag = ""
    // Stile
    for (var i = 0; i < document.forms[0].radio_r.length; i++) {
        if (document.forms[0].radio_r[i].checked)
            stile = document.forms[0].radio_r[i].value
    }
    pathR = pathR + "&stile=" + stile
    // Stile booking
    for (var i = 0; i < document.forms[0].radio_r_tipo.length; i++) {
        if (document.forms[0].radio_r_tipo[i].checked)
            tipo = document.forms[0].radio_r_tipo[i].value
    }
    pathR = pathR + "&stilebooking=" + tipo
    // Stagionalità
    for (var i = 0; i < document.forms[0].radio_r_stag.length; i++) {
        if ((document.forms[0].radio_r_stag[i].checked)&&(document.forms[0].radio_r_stag[i].value!="si"))
            stag = document.forms[0].radio_r_stag[i].value
    }
    if (stag != "")
        pathR = pathR + "&Stag=" + stag

    var winR = window.open(pathR, "_blank", "width=690,height=470,resizable=yes")
    //    winR.focus()
}
function open_booking_S() {
    var pathS = path + "frmbookingS.aspx?CR=" + CR + "&CdR=" + CdR
    var stile = "neutro"
    var tipo = "3d"
    var ordinamento = ""
    var stag = ""
    var colonne = "4"
    var mesi="6"
    // Stile
    for (var i = 0; i < document.forms[0].radio_s.length; i++) {
        if (document.forms[0].radio_s[i].checked)
            stile = document.forms[0].radio_s[i].value
    }
    pathS = pathS + "&stile=" + stile
    // Stile booking
    for (var i = 0; i < document.forms[0].radio_s_tipo.length; i++) {
        if (document.forms[0].radio_s_tipo[i].checked)
            tipo = document.forms[0].radio_s_tipo[i].value
    }
    pathS = pathS + "&stilebooking=" + tipo
    // Stagionalità
    for (var i = 0; i < document.forms[0].radio_s_stag.length; i++) {
        if ((document.forms[0].radio_s_stag[i].checked) && (document.forms[0].radio_s_stag[i].value != "si"))
            stag = document.forms[0].radio_s_stag[i].value
    }
    if (stag != "")
        pathS = pathS + "&Stag=" + stag
    // Mesi
    for (var i = 0; i < document.forms[0].radio_s_mesi.length; i++) {
        if (document.forms[0].radio_s_mesi[i].checked)
            mesi = document.forms[0].radio_s_mesi[i].value
    }
    pathS = pathS + "&Mesi=" + mesi
    // Colonne
    for (var i = 0; i < document.forms[0].radio_s_col.length; i++) {
        if (document.forms[0].radio_s_col[i].checked)
            colonne = document.forms[0].radio_s_col[i].value
    }
    pathS = pathS + "&Colonne=" + colonne
    var wWin = 330 + 148 * parseInt(colonne)
    var hWin = 400 + 156 * parseInt(mesi/colonne)
    var winS = window.open(pathS, "_blank", "width="+wWin+",height="+hWin+",resizable=yes")
    //    winR.focus()
}
function open_booking_L() {
    var pathL = path + "frmbookingL.aspx?CR=" + CR
    var stile = "neutro"
    // Stile
    for (var i = 0; i < document.forms[0].radio_l.length; i++) {
        if (document.forms[0].radio_l[i].checked)
            stile = document.forms[0].radio_l[i].value
    }
    pathL = pathL + "&stile=" + stile
    // Stile booking
    for (var i = 0; i < document.forms[0].radio_r_tipo.length; i++) {
        if (document.forms[0].radio_r_tipo[i].checked)
            tipo = document.forms[0].radio_r_tipo[i].value
    }
    pathL = pathL + "&stilebooking=" + tipo

    var winL = window.open(pathL, "_blank", "width=522,height=560,resizable=yes")
    //    winR.focus()
}
function open_booking_A() {
    var pathA = path + "frmrichiestabooking2.aspx?CR=" + CR + "&TipoRichiesta=R&Albergo=S"
    var stile = "neutro"
    var tipo = "s"
    var filtri = ""
    var hwin="680"
    // Stile
    for (var i = 0; i < document.forms[0].radio_a.length; i++) {
        if (document.forms[0].radio_a[i].checked)
            stile = document.forms[0].radio_a[i].value
    }
    pathA = pathA + "&stile=" + stile
    // Tipo booking
    for (var i = 0; i < document.forms[0].radio_a_tipo.length; i++) {
        if (document.forms[0].radio_a_tipo[i].checked) {
            tipo = document.forms[0].radio_a_tipo[i].value
            if (tipo == "m") {
                hwin="700"
                // Filtri
                for (var j = 0; j < document.forms[0].radio_a_ric.length; j++) {
                    if (document.forms[0].radio_a_ric[j].checked) {
                        if(filtri!="")
                            filtri = filtri + ","
                        filtri = filtri + document.forms[0].radio_a_ric[j].value
                    }
                }
                if (filtri != "")
                    pathA = pathA + "&filtri=" + filtri
            }
            else
                pathA = pathA + "&CdG=" + CdG
        }
    }
    var winL = window.open(pathA, "_blank", "width=600,height="+hwin+",resizable=yes,scrollbars=yes")
    //    winR.focus()
}

function mod_a_radio_tipo() {
    for (var i = 0; i < document.forms[0].radio_a_tipo.length; i++) {
        if (document.forms[0].radio_a_tipo[i].checked)
            var disabilita=(document.forms[0].radio_a_tipo[i].value=="s")
            for (var j = 0; j < document.forms[0].radio_a_ric.length; j++){
                document.forms[0].radio_a_ric[j].disabled = disabilita;
            }   
    }    
}
