

// Airline filter check box check uncheck
function SelectedAirlines(flightCode, checkboxid) {


    var grd = document.getElementById("lavitable");
    var rdoArray = grd.rows;
    for (i = 1; i <= rdoArray.length; i++) {
        if (i < 10) {
            var j = '0' + i;
        }
        else {
            j = i;

        }

        
        if (document.getElementById("ctl00_ContentPlaceHolder1_myrepeater_ctl" + j + "_LabelAirllinename").innerHTML == flightCode) {

            if (document.getElementById(checkboxid).checked == true) {

                document.getElementById("ctl00_ContentPlaceHolder1_myrepeater_ctl" +j+ "_lavirow").style.display = 'block';
            }


            if (document.getElementById(checkboxid).checked == false) {

                document.getElementById("ctl00_ContentPlaceHolder1_myrepeater_ctl" + j+ "_lavirow").style.display = 'none';
            }
        }
    }
}
                         
                        
        


//FLight filter click on check all
function checkalllavi() {
    document.getElementById("ctl00_ContentPlaceHolder1_CheckBox_AI").checked = true;
    document.getElementById("ctl00_ContentPlaceHolder1_CheckBox_G8").checked = true;
    document.getElementById("ctl00_ContentPlaceHolder1_CheckBox_IC").checked = true;
    document.getElementById("ctl00_ContentPlaceHolder1_CheckBox_6E").checked = true;
    document.getElementById("ctl00_ContentPlaceHolder1_CheckBox_9W").checked = true;
    document.getElementById("ctl00_ContentPlaceHolder1_CheckBox_S2").checked = true;
    document.getElementById("ctl00_ContentPlaceHolder1_CheckBox_IT").checked = true;
    document.getElementById("ctl00_ContentPlaceHolder1_CheckBox_9H").checked = true;
    document.getElementById("ctl00_ContentPlaceHolder1_CheckBox_I7").checked = true;
    document.getElementById("ctl00_ContentPlaceHolder1_CheckBox_SG").checked = true;

    SelectedAirlines("Air India", "ctl00_ContentPlaceHolder1_CheckBox_AI");
    SelectedAirlines("GoAir", "ctl00_ContentPlaceHolder1_CheckBox_G8");
    SelectedAirlines("Indian Airlines", "ctl00_ContentPlaceHolder1_CheckBox_IC");
    SelectedAirlines("Indigo", "ctl00_ContentPlaceHolder1_CheckBox_6E");
    SelectedAirlines("Jet Airways", "ctl00_ContentPlaceHolder1_CheckBox_9W");
    SelectedAirlines("JetLite", "ctl00_ContentPlaceHolder1_CheckBox_S2");
    SelectedAirlines("Kingfisher", "ctl00_ContentPlaceHolder1_CheckBox_IT");
    SelectedAirlines("MDLR", "ctl00_ContentPlaceHolder1_CheckBox_9H");
    SelectedAirlines("Paramount", "ctl00_ContentPlaceHolder1_CheckBox_I7");
    SelectedAirlines("SpiceJet", "ctl00_ContentPlaceHolder1_CheckBox_SG");



}


//Flight Filter click on check all
function uncheckAlllavi() {
    document.getElementById("ctl00_ContentPlaceHolder1_CheckBox_AI").checked = false;
    document.getElementById("ctl00_ContentPlaceHolder1_CheckBox_G8").checked = false;
    document.getElementById("ctl00_ContentPlaceHolder1_CheckBox_IC").checked = false;
    document.getElementById("ctl00_ContentPlaceHolder1_CheckBox_6E").checked = false;
    document.getElementById("ctl00_ContentPlaceHolder1_CheckBox_9W").checked = false;
    document.getElementById("ctl00_ContentPlaceHolder1_CheckBox_S2").checked = false;
    document.getElementById("ctl00_ContentPlaceHolder1_CheckBox_IT").checked = false;
    document.getElementById("ctl00_ContentPlaceHolder1_CheckBox_9H").checked = false;
    document.getElementById("ctl00_ContentPlaceHolder1_CheckBox_I7").checked = false;
    document.getElementById("ctl00_ContentPlaceHolder1_CheckBox_SG").checked = false;

    SelectedAirlines("Air India", "ctl00_ContentPlaceHolder1_CheckBox_AI");
    SelectedAirlines("GoAir", "ctl00_ContentPlaceHolder1_CheckBox_G8");
    SelectedAirlines("Indian Airlines", "ctl00_ContentPlaceHolder1_CheckBox_IC");
    SelectedAirlines("Indigo", "ctl00_ContentPlaceHolder1_CheckBox_6E");
    SelectedAirlines("Jet Airways", "ctl00_ContentPlaceHolder1_CheckBox_9W");
    SelectedAirlines("JetLite", "ctl00_ContentPlaceHolder1_CheckBox_S2");
    SelectedAirlines("Kingfisher", "ctl00_ContentPlaceHolder1_CheckBox_IT");
    SelectedAirlines("MDLR", "ctl00_ContentPlaceHolder1_CheckBox_9H");
    SelectedAirlines("Paramount", "ctl00_ContentPlaceHolder1_CheckBox_I7");
    SelectedAirlines("SpiceJet", "ctl00_ContentPlaceHolder1_CheckBox_SG");


}





// Stop fliter
function Stopages(val, checkboxid) {


    var grd = document.getElementById("lavitable");
    var rdoArray = grd.rows;
    for (i = 1; i <= rdoArray.length; i++) {
        if (i < 10) {
            var j = '0' + i;
        }
        else {
            j = i;
        }



        if (document.getElementById("ctl00_ContentPlaceHolder1_myrepeater_ctl" + j + "_LabelStopQuantity").innerHTML == val) {



            if (document.getElementById(checkboxid).checked == true) {
                document.getElementById("ctl00_ContentPlaceHolder1_myrepeater_ctl" + j + "_lavirow").style.display = 'block';
            }




            if (document.getElementById(checkboxid).checked == false) {
                document.getElementById("ctl00_ContentPlaceHolder1_myrepeater_ctl" + j + "_lavirow").style.display = 'none';
            }
        }
    }
}
 

   




//stopagfe filter for 1+
function Stopages1p(val, checkboxid) {

    var grd = document.getElementById("lavitable");
    var rdoArray = grd.rows;
    for (i = 1; i <= rdoArray.length; i++) {
        if (i < 10) {
            var j = '0' + i;
        }
        else {
            j = i;
        }

        if (parseInt(document.getElementById("ctl00_ContentPlaceHolder1_myrepeater_ctl" + j + "_LabelStopQuantity").innerHTML) > parseInt(val)) {



            if (document.getElementById(checkboxid).checked == true) {
                document.getElementById("ctl00_ContentPlaceHolder1_myrepeater_ctl" + j + "_lavirow").style.display = 'block';
            }


            if (document.getElementById(checkboxid).checked == false) {
                document.getElementById("ctl00_ContentPlaceHolder1_myrepeater_ctl" + j + "_lavirow").style.display = 'none';
            }
        }
    }
}





function Search_Price(minfair, maxfare) {



    var fair = parseInt(minfair);
    var maxfare = maxfare;


    document.getElementById("ctl00_ContentPlaceHolder1_lbl_filter_minprice_slider").innerHTML = fair;
    document.getElementById("ctl00_ContentPlaceHolder1_lbl_filter_maxprice_slider").innerHTML = maxfare;


    var grd = document.getElementById("lavitable");
    var rdoArray = grd.rows;


    for (i = 1; i <= rdoArray.length; i++) {


        if (i < 10) {
            var j = '0' + i;

        }
        else {
            j = i;

        }


        var Flight_fair = document.getElementById("ctl00_ContentPlaceHolder1_myrepeater_ctl" + j + "_LabelTotalFare").innerHTML;

        if (parseInt(Flight_fair) >= parseInt(fair) && parseInt(Flight_fair) <= parseInt(maxfare)) {
            document.getElementById("ctl00_ContentPlaceHolder1_myrepeater_ctl" + j + "_lavirow").style.display = 'block';

        }
        else {
            document.getElementById("ctl00_ContentPlaceHolder1_myrepeater_ctl" + j + "_lavirow").style.display = 'none';

        }
    }
}






function Time_Filter(min, max) {

    var hours = parseInt(min / 60, 10);
    if (hours < 10) {
        var F_hours = '0' + hours;
    }

    else {
        F_hours = hours;
    }

    var minutes = min % 60;

    if (minutes < 10) {
        var F_minutes = '0' + minutes;
    }

    else {
        F_minutes = minutes;
    }
    var SelectedTotalTime = F_hours + ':' + F_minutes;
    document.getElementById("ctl00_ContentPlaceHolder1_lbl_filter_mintime_slider").innerHTML = SelectedTotalTime;
    var dtSliderTimemin = new Date("1/1/2007 " + SelectedTotalTime);
    //___________________
    hours = parseInt(max / 60, 10);
    if (hours < 10) {
        var F_hours = '0' + hours;
    }

    else {
        F_hours = hours;
    }

    minutes = max % 60;

    if (minutes < 10) {
        var F_minutes = '0' + minutes;
    }

    else {
        F_minutes = minutes;
    }
    SelectedTotalTime = F_hours + ':' + F_minutes;
    document.getElementById("ctl00_ContentPlaceHolder1_lbl_filter_maxtime_slider").innerHTML = SelectedTotalTime;
    var dtSliderTimemax = new Date("1/1/2007 " + SelectedTotalTime);
    document.getElementById("ctl00_ContentPlaceHolder1_lbl_filter_dash").style.display = 'block';
    document.getElementById("ctl00_ContentPlaceHolder1_lbl_filter_maxtime_slider").style.display = 'block';

    if (min == "0" && max == "1440") {
        document.getElementById("ctl00_ContentPlaceHolder1_lbl_filter_mintime_slider").innerHTML = "Anytime";
        document.getElementById("ctl00_ContentPlaceHolder1_lbl_filter_dash").style.display = 'none';
        document.getElementById("ctl00_ContentPlaceHolder1_lbl_filter_maxtime_slider").style.display = 'none';
    }

    //___________

    var grd = document.getElementById("lavitable");
    var rdoArray = grd.rows;

    for (i = 1; i <= rdoArray.length; i++) {

        if (i < 10) {
            var j = '0' + i;
        }
        else {
            j = i;
        }


        var Flight_DepartTime = document.getElementById("ctl00_ContentPlaceHolder1_myrepeater_ctl" + j + "_LabelDepartTime").innerHTML;
        var dtFlightDTime = new Date("1/1/2007 " + Flight_DepartTime);

        //________________________________________________________________________________________
        if (dtFlightDTime >= dtSliderTimemin && dtFlightDTime <= dtSliderTimemax) {
            document.getElementById("ctl00_ContentPlaceHolder1_myrepeater_ctl" + j + "_lavirow").style.display = 'block';

        }
        else {
            document.getElementById("ctl00_ContentPlaceHolder1_myrepeater_ctl" + j + "_lavirow").style.display = 'none';

        }
    }
}

function showrefundable(chk) {

    var grd = document.getElementById("lavitable");
    var rdoArray = grd.rows;

    for (i = 1; i <= rdoArray.length; i++) {

        if (i < 10) {
            var j = '0' + i;
        }
        else {
            j = i;
        }

        if (chk.checked) {

            if (document.getElementById("ctl00_ContentPlaceHolder1_myrepeater_ctl" + j + "_LabelFareType0").innerHTML == "Refundable") {
                document.getElementById("ctl00_ContentPlaceHolder1_myrepeater_ctl" + j + "_lavirow").style.display = 'block';
            }
            else {
                document.getElementById("ctl00_ContentPlaceHolder1_myrepeater_ctl" + j + "_lavirow").style.display = 'none';

            }
        }
        else {
            document.getElementById("ctl00_ContentPlaceHolder1_myrepeater_ctl" + j + "_lavirow").style.display = 'block';

        }

    }
}

            
