﻿function searchType(x) {
   if (x==0) {
      var a = document.getElementById("drbAll");   
      var b = document.getElementById("drbOne");
   } else {
      var b = document.getElementById("drbAll");   
      var a = document.getElementById("drbOne");   
   }
   a.className = 'colW';
   b.className = 'colY';
}

function isChecked(what) {
   //alert(what.id);
   //what.removeAttribute('class');
   var cb = what.id;
   var lb = cb.replace('s','t');
   var lbl = document.getElementById(lb);
   if (what.checked) {
      what.className = 'bkgY';
      lbl.className = 'bkgY colB';
     // what.setAttribute('class','bkgY');
   } else {
      what.className = 'bkgG';
      lbl.className = 'bkgG colW';
     // what.setAttribute('class','bkgG');
   }
}
function checkAll(what,subcats) {
   var ids = subcats.split(',');
   var cb;
   var lbl;
   //lbl = document.getElementById(what.id.replace('c','b'));  
   if (what.checked) {
      what.className = 'bkgY'; 
      //lbl.className = 'bkgY colB'; 
      for (var i=0;i<ids.length;i++) {
         cb = document.getElementById(ids[i]);  
         lbl = document.getElementById(ids[i].replace('s','t'));  
         cb.checked=true;
         cb.className = 'bkgY';
         lbl.className = 'bkgY colB';
      }
      cb = document.getElementById("rbOne");  
      cb.checked=true;      
   } else {
      what.className = 'bkgG';
      //lbl.className = 'bkgG colW'; 
      for (var i=0;i<ids.length;i++) {
         cb = document.getElementById(ids[i]);  
         lbl = document.getElementById(ids[i].replace('s','t'));  
         cb.checked=false;
         cb.className = 'bkgG';
         lbl.className = 'bkgG colW';
      }
   }
}

function checkOptAll(cat,subcats) {
   var cb;
   var x = 0;
   var ids = subcats.split(',');
   var rb = document.getElementById("rbOne");  
      for (var i=0;i<ids.length;i++) {
         cb = document.getElementById(ids[i]);  
         if (cb.checked) {x += 1;}
      }   
      cb = document.getElementById(cat);  
      //lbl = document.getElementById(cat.replace('c','b'));  
      if (x==ids.length) {
         cb.checked=true;
         //cb.className = 'bkgY';
         rb.checked=true;      
         //lbl.className = 'bkgImgG colY';
      } else {
         cb.checked=false;
         //cb.className = 'bkgG';
         //lbl.className = 'bkgImgY colB';
      }
}

