/******************************************************************************
* Functions for expanding threads 
******************************************************************************/

function showAll() {
   for( i=firstInd; i<document.layers.length; i++ ) {
      whichEl = document.layers[i];
      whichEl.visibility = "show";
   }
}

function hideAll() {
   for( i=firstInd; i<document.layers.length; i++ ) {
      whichEl = document.layers[i];
      whichEl.visibility = "hidden";
   }
}

function getIndex( el ) {
   ind = null;
   for( i=0; i<document.layers.length; i++ ) {
      whichEl = document.layers[i];
      if( whichEl.id == el ) {
         ind = i;
         break;
      }
   }
   return ind;
}

function arrange() {
   nextY = document.layers[firstInd].pageY +
      document.layers[firstInd].document.height;

   for( i=firstInd+1; i<document.layers.length; i++ ) {
      whichEl = document.layers[i];
      if( whichEl.visibility != "hide" ) {
         whichEl.pageY = nextY;
         nextY += whichEl.document.height;
      }
   }
}

function initIt() {
   var parent_to_open, query;

  /// query= url_parameter.split( "=" );
  // parent_to_open= "m" + query[1];
		
   if( NS4 ) {
      for( i=0; i<document.layers.length; i++ ) {
         whichEl = document.layers[i];
         if( whichEl.id.indexOf("Child" ) != -1 ) {
        //    if( whichEl.id.indexOf( parent_to_open ) != -1 )
        //       whichEl.visibility= "show";
        //    else
               whichEl.visibility = "hide";
         }
      }
      arrange();
   } else {
      divColl = document.all.tags("DIV" );
      for( i=0; i<divColl.length; i++ ) {
         whichEl = divColl(i );
         if( whichEl.className == "child" ) {
       //     if( whichEl.id.indexOf( parent_to_open ) != -1 )
       //        whichEl.style.display = "block";
       //     else
               whichEl.style.display = "none";
         }
      }
   }
}

function hideIt( el ) {
   if( !ver4 ) return;

   if( IE4 ) {
      whichEl = eval( el + "Child" );
      whichEl.style.display = "none";
   } else {
      whichEl = eval( "document.layers." + el + "Child" );
      whichEl.visibility = "hide";
      arrange();
   }
}

function expandIt(el ) {
   if( !ver4 ) return;

   if( IE4 ) {
      whichEl = eval( el + "Child" );
      //img = eval( "i" + el );
      //img = event.srcElement;
      if( whichEl.style.display != "block" ) {
         whichEl.style.display = "block";
      } else {
         whichEl.style.display = "none";
      }
   } else {
      whichEl = eval( "document.layers." + el + "Child" );
     // whichIm = eval( "document.layers." + el +
     //    "Parent.document.images['i" + el +"']" );

      document.tags.H1.color= "red";
      if( whichEl.visibility == "hide" ) {
         whichEl.visibility = "show";
      } else {
         whichEl.visibility = "hide";
      }

      arrange();
   }
}

function expandAll() {
   newSrc = (isExpanded ) ? "img/plus.gif" : "img/minus.gif";
   newBigSrc = (isExpanded ) ? "img/bigplus.gif" : "img/bigminus.gif";

   if( NS4 ) {
      for( i=firstInd; i<document.layers.length; i++ ) {
         whichEl = document.layers[i];
         if( whichEl.id.indexOf( "Parent" ) != -1 ) {
            whichEl.document.images["imEx"].src = newSrc;
         }
         if( whichEl.id.indexOf( "End" ) != -1 ) {			
            whichEl.document.images["imBigEx"].src = newBigSrc;
         }
         if( whichEl.id.indexOf( "Child" ) != -1 ) {
            whichEl.visibility = ( isExpanded ) ? "hide" : "show";
         }
      }
      arrange();
      if( isExpanded )
         scrollTo(0,document.layers[firstInd].pageY );
   } else {
      divColl = document.all.tags( "DIV" );
      for( i=0; i<divColl.length; i++ ) {
         if( divColl( i ).className == "child" ) {
            divColl( i ).style.display = ( isExpanded ) ? "none" : "block";
         }
      }
      imColl = document.images.item( "imEx" );
      for( i=0; i<imColl.length; i++ ) {
         imColl( i ).src = newSrc;
      } 
      imBigColl = document.images.item( "imBigEx" );
      for( i=0; i<imBigColl.length; i++ ) {
         imBigColl( i ).src = newBigSrc;
      }
   }
   
   isExpanded = !isExpanded;
   
}

function hideAllBut( thisChild ) {

   if( NS4 ) {
      for( i=firstInd; i<document.layers.length; i++ ) {
         whichEl = document.layers[i];
         if( whichEl.id.indexOf( "Child" ) != -1 ) {
            if( whichEl.id.indexOf( thisChild ) == -1 ) {
               whichEl.visibility = "hide";
            }
         }
      }
      arrange();
      if( isExpanded )
         scrollTo(0,document.layers[firstInd].pageY );
   } else {
      divColl = document.all.tags( "DIV" );
      for( i=0; i<divColl.length; i++ ) {
         if( divColl( i ).className == "child" ) {
            if( divColl(i).id.indexOf( thisChild ) == -1 ) {
               divColl( i ).style.display = "none";
            }
         }
      }
   }
   
   isExpanded = !isExpanded;
   
}
