
//this function populated the main category menu by grabing the array level 0
//which is written to the page either manually or by way of php
function populateCat1(cat0,select0){
  document.browse.c1.options.length = 2; 
  var num = '';
  if(!list[cat0]){
     num = 0;
    }else{
     num = list[cat0].length;
    }   
  //alert (list[cat1][0]);   
   for (i=0; i < num; i++ ){            
     // alert(list[cat1][i][0]);      
     if (list[cat0][i][0]==select0){
      //alert ('true');
      document.browse.c1.options[i+2] = new Option(list[cat0][i][1],list[cat0][i][0],1,1);
     }else{ 
      document.browse.c1.options[i+2] = new Option(list[cat0][i][1],list[cat0][i][0]);     
    }  
  }
}

//this function populated the Level 2 category menu by grabing the array level from cat one selection
//category array is written to the page either manually or by way of php
function populateCat2(cat1,select1){
  document.browse.c2.options.length = 2;
  document.browse.c2.disabled = true;
  document.browse.c3.disabled = true;  
  document.browse.c2.options[0] = new Option('','',1,1); 
  document.browse.c3.options[0] = new Option('','',1,1);
  //document.createasset.category2.style.display='none';
  //document.createasset.category3.style.display='none';
  var num = '';
  if(cat1 != ''){
    if(!list[cat1]){
     num = 0;
    }else{
     num = list[cat1].length;
    }
  if (num > 0){
   //document.createasset.category2.style.display='';
   document.browse.c2.options[0] = new Option('-Select All-','',1,1);
   document.browse.c2.disabled = false;
    
  }
  //alert (list[cat1][0]);   
   for (i=0; i < num; i++ ){    
    if (list[cat1][i][0]==select1){            
     // alert(list[cat1][i][0]); 
     document.browse.c2.options[i+2] = new Option(list[cat1][i][1],list[cat1][i][0],1,1);
    }else{
      document.browse.c2.options[i+2] = new Option(list[cat1][i][1],list[cat1][i][0]);     
    }
  }
}
}
//this function populated the Level 3 category menu by grabing the array level from cat two selection
//category array is written to the page either manually or by way of php
function populateCat3(cat2,select2){
  document.browse.c3.options.length = 2;
  document.browse.c3.options[0] = new Option('','',1,1);
  document.browse.c3.disabled = true;
  //document.createasset.category3.style.display='none'; 
  var num = '';
  if(cat2 != ''){     
  //alert(cat2);  
   if(!list[cat2]){
   num = 0;
   }else{     
   num = list[cat2].length;
   }
   if (num > 0){
    //document.createasset.category3.style.display='';
   document.browse.c3.disabled = false;
   document.browse.c3.options[0] = new Option('-Select All-','',1,1);
   }
   for (i=0; i < num; i++ ){    
    if (list[cat2][i][0]==select2){            
     // alert(list[cat1][i][0]); 
     document.browse.c3.options[i+2] = new Option(list[cat2][i][1],list[cat2][i][0],1,1); 
    }else{
      document.browse.c3.options[i+2] = new Option(list[cat2][i][1],list[cat2][i][0]); 
    }
    }     
  }
}

function displayCat3(cat3){
  if(cat3 != ''){
  alert(cat3);
  }
}
