//initSubcategories( catCode1, catCode2, catCode3...catCodeN )function initSubcategories( ){  var args = initSubcategories.arguments;  var subcategoryArray = new Array();  var prodArray        = new Array();  for(var i=0; i < args.length; i++)  {     subcategoryArray.push( Subcategories.fetchListAt(args[i], false, false) );     prodArray       .push( Products     .fetchListAt(args[i], false, true ) );  }   var sortedArrays = sortSubcategoriesByCode( subcategoryArray, prodArray );   initLists(document.frmBrowse.lstSubcategories, sortedArrays[0], sortedArrays[1] );}function sortSubcategoriesByCode( subcategories, products ){     var code;   var newProdArray = new Array();   subcategories = subcategories.sort();   for (var i=0; i<subcategories.length; i++)   {     //get the code for that subcategory     code = subcategories[i][1];         //get the products for that subcategory     //copy the products to the "sorted" array     newProdArray.push( products.fetchListAt( code, false, true ) );   }   return new Array(subcategories, newProdArray);}function getListArray( code, sort, includeEmptyElements ){     var listArray = new Array();   var i = 0;    //find the code   while ( !this[i].length || this[i][1].substr(0,code.length) != code )     if (++i == this.length) return listArray; //code not found   //copy all the matching items   while ( !this[i].length || this[i][1].substr(0,code.length) == code )   {      if ( this[i].length || includeEmptyElements )      { listArray[listArray.length] = this[i]; }          if (++i == this.length) break;   }   return (sort ? listArray.sort() : listArray); }Array.prototype.fetchListAt = getListArray;function getBrowseSubSection(){  var browseHTML =    '<table width="764" border="0" cellpadding="0" cellspacing="0" background="http://secure.zpets.com/zpets/GIFS/new_back.gif">' +  '<tr>' +    '<td width="143" align="center" background="http://secure.zpets.com/zpets/GIFS/new_back.gif" height="45">' +      '<img src="GIFS/browse.gif" width="120" height="45" border="0">' +    '</td>' +    '<td width="621" align="center" valign="middle">' +       '<form name="frmBrowse" method="post" action="">' +        '<br>' +        '<table width="100%" border="0" cellpadding="0" cellspacing="0">' +          '<tr>' +             '<td valign="middle" colspan="2" align="center">' +               '<select name="lstSubcategories" onChange="relate(this,m,1)">' +                '<option>Select Category</option>' +                 getDefaultListItems() +               '</select>' +            '</td>' +            '<td valign="middle" width="50%" align="left">' +               '<select name="lstProducts" onChange="search(this, cart)">' +                '<option>Select Product</option>' +                 getDefaultListItems() +              '</select>' +            '</td>' +          '</tr>' +        '</table>' +      '</form>' +    '</td>' +  '</tr>' + '</table>'; return browseHTML;}function array_push( a ) {  for(var i=0;i<a.length;i++)  { this[this.length] = a[i]; }  return this.length;}Array.prototype.push = array_push;