﻿function toggleDiv(div)
    {
        if(document.getElementById(div).style.display=='block'){
            document.getElementById(div).style.display = 'none'
        }
        else{
            document.getElementById(div).style.display = 'block'
        }

    } 

function checkBusFormOther(ddlBusForm,rowId){
    row = document.getElementById(rowId)
    
    if(ddlBusForm.value==5){
//        row.style.visibility= "visible"
        row.style.display="block";
    }
    else    row.style.display="none";
//    else row.style.visibility= "collapse"
}
function radioToggle(radioButton,rblDCId,rowId,turnOffCheckBoxIds,showValue){
    if (showValue == null) { showValue="true" }
    aryRowIds = rowId.split(",")
    aryturnOffCheckBoxIds = turnOffCheckBoxIds.split(",")
    rowsI = 0

    var rb0Value = document.getElementById(radioButton + '_0').value;
    var rb0Checked = document.getElementById(radioButton + '_0').checked;
    var rb1Value = document.getElementById(radioButton + '_1').value;
    var rb1Checked = document.getElementById(radioButton + '_1').checked;

    while(rowsI < aryRowIds.length){
        var thisRowId = aryRowIds[rowsI]
        var row = document.getElementById(thisRowId )
        var lblDC = document.getElementById(radioButton)
        var rblDCs = document.getElementsByName(rblDCId)
        var rblDCSelection = ""
        
        var showRow = false;

        if (rb0Value == showValue){
            if(rb0Checked){
                showRow = true;
            }
        }
        else if (rb1Value == showValue){
            if(rb1Checked){
                showRow = true;
            }
        }

        var isIE = navigator.appName.indexOf("Microsoft") != -1
        if(showRow) {
            row.style.display="";
            if(isIE) row.style.display="block";
            else row.style.visibility= "visible";
        }
        else {
            row.style.display="";
            if(isIE) row.style.display="none";
            else row.style.visibility= "collapse";
        }
//        alert('rb:' + document.getElementById(radioButton + '_0').value)
////        alert(row + ';' + lblDC+ ';' + rblDCs)
//        for (var i in rblDCs)
//        {
//            alert(lblDC)
//            if (rblDCs[i].checked)
//            {
//                rblDCSelection = rblDCs[i].value
//                break
//            }
//        }
//        if (lblDC.innerText == rblDCSelection)
//        {
//        }
////alert('rblDCSelection:' + rblDCSelection + '  showvalue:' + showValue )
//        if(rblDCSelection==showValue){
////                row.style.visibility= "visible"
////alert('hide:' + rblDCSelection)
//                row.style.display= "block"
//        }
//        else {
////alert('show:' + rblDCSelection)
////            row.style.visibility= "collapse"
//                row.style.display= "none"
//        }
        rowsI++
    }
        if(!turnOffCheckBoxIds==""){
            rowsJ = 0
            while(rowsJ < aryturnOffCheckBoxIds.length){
                turnOffRowId = aryturnOffCheckBoxIds[rowsJ]
                turnOffRbIds = document.getElementsByName(turnOffRowId)               
                turnOffRbIds[0].checked=true               
                rowsJ++
            }                
        }
}
