


$(function () {
    $('.hrfmoving').click(function () {
           
        $('.chkselectallVehicle').hide();
        $('.chkselectallonVehicle').show();
        $('.chkselectalloffVehicle').hide();
        $('.chkselectallidleVehicle').hide();
        $('.chkselectallnetworkVehicle').hide();
        $('.Onvehicle').attr('checked', false);
        $('.chkselectallonVehicle').attr('checked', false);
        $('.txtsearchall').hide();
        $('.txtsearchon').show();
        $('.txtsearchoff').hide();
        $('.txtsearchidle').hide();
        $('.txtsearchnetwork').hide();
        $('.spansearchall').hide();
        $('.spansearchon').show();
        $('.spansearchoff').hide();
        $('.spansearchidle').hide();
        $('.spansearchnetwork').hide();
        $('.chkselectalltowedVehicle').hide();
        $('.txtsearchtowed').hide();
        $('.spansearchtowed').hide();


    });
})

$(function () {
    $('.hrfallvehicle').click(function () {
           
        $('.chkselectallVehicle').show();
        $('.chkselectallonVehicle').hide();
        $('.chkselectalloffVehicle').hide();
        $('.chkselectallidleVehicle').hide();
        $('.chkselectallnetworkVehicle').hide();
        $('.AllVehicle').attr('checked', false);
        $('.chkselectallVehicle').attr('checked', false);
        $('.txtsearchall').show();
        $('.txtsearchon').hide();
        $('.txtsearchoff').hide();
        $('.txtsearchidle').hide();
        $('.txtsearchnetwork').hide();
        $('.spansearchall').show();
        $('.spansearchon').hide();
        $('.spansearchoff').hide();
        $('.spansearchidle').hide();
        $('.spansearchnetwork').hide();
        $('.chkselectalltowedVehicle').hide();
        $('.txtsearchtowed').hide();
        $('.spansearchtowed').hide();
    });
})

$(function () {
    $('.hrfstopped').click(function () {
           
        $('.chkselectallVehicle').hide();
        $('.chkselectallonVehicle').hide();
        $('.chkselectalloffVehicle').show();
        $('.chkselectallidleVehicle').hide();
        $('.chkselectallnetworkVehicle').hide();
        $('.Offvehicle').attr('checked', false);
        $('.chkselectalloffVehicle').attr('checked', false);
        $('.txtsearchall').hide();
        $('.txtsearchon').hide();
        $('.txtsearchoff').show();
        $('.txtsearchidle').hide();
        $('.txtsearchnetwork').hide();
        $('.spansearchall').hide();
        $('.spansearchon').hide();
        $('.spansearchoff').show();
        $('.spansearchidle').hide();
        $('.spansearchnetwork').hide();
        $('.chkselectalltowedVehicle').hide();
        $('.txtsearchtowed').hide();
        $('.spansearchtowed').hide();
    });
})

$(function () {
    $('.hrfidle').click(function () {
           
        $('.chkselectallVehicle').hide();
        $('.chkselectallonVehicle').hide();
        $('.chkselectalloffVehicle').hide();
        $('.chkselectallidleVehicle').show();
        $('.chkselectallnetworkVehicle').hide();
        $('.Idlevehicle').attr('checked', false);
        $('.chkselectallidleVehicle').attr('checked', false);
        $('.txtsearchall').hide();
        $('.txtsearchon').hide();
        $('.txtsearchoff').hide();
        $('.txtsearchidle').show();
        $('.txtsearchnetwork').hide();
        $('.spansearchall').hide();
        $('.spansearchon').hide();
        $('.spansearchoff').hide();
        $('.spansearchidle').show();
        $('.spansearchnetwork').hide();

        $('.chkselectalltowedVehicle').hide();
        $('.txtsearchtowed').hide();
        $('.spansearchtowed').hide();
    });
})

$(function () {
    $('.hrfnetwork').click(function () {        
        $('.chkselectallVehicle').hide();
        $('.chkselectallonVehicle').hide();
        $('.chkselectalloffVehicle').hide();
        $('.chkselectallidleVehicle').hide();
        $('.chkselectallnetworkVehicle').show();
        $('.Networkvehicle').attr('checked', false);
        $('.chkselectallnetworkVehicle').attr('checked', false);
        $('.txtsearchall').hide();
        $('.txtsearchon').hide();
        $('.txtsearchoff').hide();
        $('.txtsearchidle').hide();     
        $('.txtsearchnetwork').show();
        $('.spansearchall').hide();
        $('.spansearchon').hide();
        $('.spansearchoff').hide();
        $('.spansearchidle').hide();
        $('.spansearchnetwork').show();
        $('.chkselectalltowedVehicle').hide();
        $('.txtsearchtowed').hide();
        $('.spansearchtowed').hide();
    });
})


$(function () {
    $('.hrftowed').click(function () {

        $('.chkselectallVehicle').hide();
        $('.chkselectallonVehicle').hide();
        $('.chkselectalloffVehicle').hide();
        $('.chkselectallidleVehicle').hide();
        $('.chkselectallnetworkVehicle').hide();
        $('.Towedvehicle').attr('checked', false);
        $('.chkselectalltowedVehicle').attr('checked', false);
        $('.txtsearchall').hide();
        $('.txtsearchon').hide();
        $('.txtsearchoff').hide();
        $('.txtsearchidle').hide();
        $('.txtsearchnetwork').hide();
        $('.spansearchall').hide();
        $('.spansearchon').hide();
        $('.spansearchoff').hide();
        $('.spansearchidle').hide();
        $('.spansearchnetwork').hide();

        $('.chkselectalltowedVehicle').show();
        $('.txtsearchtowed').show();
        $('.spansearchtowed').show();
    });
})




function checkAll(ele) {
    var checkboxes = document.getElementsByClassName('AllVehicle');
    if (ele.checked) {
        for (var i = 0; i < checkboxes.length; i++) {
            if (checkboxes[i].type == 'checkbox') {
                checkboxes[i].checked = true;
            }
        }
    } else {
        for (var i = 0; i < checkboxes.length; i++) {          
            if (checkboxes[i].type == 'checkbox') {
                checkboxes[i].checked = false;
            }
        }
    }
}

function checkAllOn(ele) {
    var checkboxes = document.getElementsByClassName('Onvehicle');
    if (ele.checked) {
        for (var i = 0; i < checkboxes.length; i++) {
            if (checkboxes[i].type == 'checkbox') {
                checkboxes[i].checked = true;
            }
        }
    } else {
        for (var i = 0; i < checkboxes.length; i++) {
            console.log(i)
            if (checkboxes[i].type == 'checkbox') {
                checkboxes[i].checked = false;
            }
        }
    }
}

function checkAllOff(ele) {
    var checkboxes = document.getElementsByClassName('Offvehicle');
    if (ele.checked) {
        for (var i = 0; i < checkboxes.length; i++) {
            if (checkboxes[i].type == 'checkbox') {
                checkboxes[i].checked = true;
            }
        }
    } else {
        for (var i = 0; i < checkboxes.length; i++) {
            console.log(i)
            if (checkboxes[i].type == 'checkbox') {
                checkboxes[i].checked = false;
            }
        }
    }
}

function checkAllIdle(ele) {
    var checkboxes = document.getElementsByClassName('Idlevehicle');
    if (ele.checked) {
        for (var i = 0; i < checkboxes.length; i++) {
            if (checkboxes[i].type == 'checkbox') {
                checkboxes[i].checked = true;
            }
        }
    } else {
        for (var i = 0; i < checkboxes.length; i++) {
            console.log(i)
            if (checkboxes[i].type == 'checkbox') {
                checkboxes[i].checked = false;
            }
        }
    }
}

function checkAllNetwork(ele) {
    var checkboxes = document.getElementsByClassName('Networkvehicle');
    if (ele.checked) {
        for (var i = 0; i < checkboxes.length; i++) {
            if (checkboxes[i].type == 'checkbox') {
                checkboxes[i].checked = true;
            }
        }
    } else {
        for (var i = 0; i < checkboxes.length; i++) {
            console.log(i)
            if (checkboxes[i].type == 'checkbox') {
                checkboxes[i].checked = false;
            }
        }
    }
}

function checkAllTowed(ele) {
    var checkboxes = document.getElementsByClassName('Towedvehicle');
    if (ele.checked) {
        for (var i = 0; i < checkboxes.length; i++) {
            if (checkboxes[i].type == 'checkbox') {
                checkboxes[i].checked = true;
            }
        }
    } else {
        for (var i = 0; i < checkboxes.length; i++) {
            console.log(i)
            if (checkboxes[i].type == 'checkbox') {
                checkboxes[i].checked = false;
            }
        }
    }
}





//Check only one checkbox and uncheck others  
$(function () {
    $(document).on('click', 'input[name="historycheckbox"]', function () {
        $('input[name="historycheckbox"]').not(this).prop('checked', false);
    });
})

//diasble future date 
var today = new Date().toISOString().split('T')[0];
document.getElementsByName("fromdate")[0].setAttribute('max', today);



//Hide show speedometer and fuel gauage  div


$(function () {
    $('#speedometer').click(function () {
           
        $('#container').show();
        $('.fuelgauage').hide();


    });
})
$(function () {
    $('#fuelgauage').click(function () {
           
        $('#container').hide();
        $('.fuelgauage').show();


    });
})


