﻿
function ChangeColor(tableRow, highLight)
    {
      //If folded out, dont change color
    if(document.getElementById(tableRow.id+"sub")!=null && document.getElementById(tableRow.id+"sub").style.display=='')
        return;
    if (highLight)
    {
     // tableRow.style.backgroundColor = '#ffffff';
      tableRow.style.backgroundColor = '#f0e375';
     
      
      
    }
    else
    {
      tableRow.style.backgroundColor = '#f5f5f5';
    }
}
function ChangeColor(tableRow, highLight,basecolor)
    {
    if(document.getElementById(tableRow.id+"sub")!=null && document.getElementById(tableRow.id+"sub").style.display=='')
        return;
    if (highLight)
    {
    tableRow.style.backgroundColor = '#f0e375';
      
    }
    else
    {
         if(basecolor==null){
         tableRow.style.backgroundColor = '#f5f5f5';
           }
         else{
            tableRow.style.backgroundColor = basecolor;
         }
    }
}

function ShowHideRow(nameofbaserow)
{
    if(nameofbaserow!=null){
            if(document.getElementById(nameofbaserow.id+"sub").style.display==''){
            document.getElementById(nameofbaserow.id+"sub").style.display='none';
            document.getElementById(nameofbaserow.id+"Textcell").innerHTML = document.getElementById(nameofbaserow.id+"Textcell").innerHTML.replace('-','+');
            }
            else{
                rows = document.getElementsByTagName('tr');
                for(var i=0 ; i<rows.length ; i++){
                    if(rows[i].id.indexOf('sub')>=0 && rows[i].id.indexOf('Basic')<0){
                        rows[i].style.display = 'none';
                        if(document.getElementById(rows[i].id.replace('sub',''))!=nameofbaserow){
                            document.getElementById(rows[i].id.replace('sub','')).style.backgroundColor = '#f5f5f5';
                        }
                        }
                }
                cells = document.getElementsByTagName('td');
                for(var j=0 ; j<cells.length ; j++){
                    if(cells[j].id.indexOf('Textcell')>=0 && cells[j].id.indexOf('Basic')<0){
               
                        cells[j].innerHTML = cells[j].innerHTML.replace('-','+');
                       
                        }
                }
                document.getElementById(nameofbaserow.id+"Textcell").innerHTML = document.getElementById(nameofbaserow.id+"Textcell").innerHTML.replace('+','-');
                document.getElementById(nameofbaserow.id+"sub").style.display = '';
                
            }
    }
}

