/* 
   File: upper_murdock2.js
   Sigrid Illes */

/* Removes text from table cells, td or th...*/
function clear( cellRef )
{
   var cellRefLen =cellRef.childNodes.length;
   for( var i = 0; i < cellRefLen; i++)
   {
       cellRef.removeChild(cellRef.childNodes[0]);
   }
}    

/* Builds new text and markup for the lower cell (breadcrumbs
   cell).
   Netscape 6+ does not support 
   document.getElementById(id).innerText so we
   do this build the W3C DOM-compliant way.*/
function buildTxt( cellRef, bc )
{
    var bcAry = bc.split(";");
    var len = bcAry.length;
    // len should be odd
    if( len % 2 != 1) {return;}
    for( var i=0; i < len; i++ )
    {
        if( len >= 3 && i < len - 2 )
        {
            // Create a text node with the abreviated title of this doc...
            var aText=self.document.createTextNode( bcAry[i + 1] );
            // Create a link element...
            var a = self.document.createElement('a');
            // Add href and target attributes to the link object...
            a.href = bcAry[ i ];
            a.target = "murdock_main_frame";
            // Append the text object to the link object...
            a.appendChild( aText );
            // Append link object to right-cell object...
            cellRef.appendChild( a );
            // Create text object for the " \ "...
            var tdText2=self.document.createTextNode( '\u00a0\\\u00a0' );
            // Append the " \ " to the right-cell object...
            cellRef.appendChild( tdText2 );
            i++;
        }
        else
        {
            var tdText1=self.document.createTextNode( bcAry[ i ] );
            cellRef.appendChild( tdText1 );
        }   
    }
}


/* This function is called by documents loaded into the
   murdock_main_frame as the onLoad-event handler. The  first
   argument is an anachronism... 
   The second argument is a semicolon delimited string
   bearing location bread crumb information. The latter is a series of
   pairs (relative url and abbreviated title) representing ancestral documents
   in a hierarchal document tree. The first url-title pair belongs to
   the head document for the tree. Each of these pairs is turned into a link
   and displayed in the lower cell (the banner bar). The last item
   in the delimited string is the abbreviated title of the current
   document which is displayed without turning it into a link.
*/
function change_path( widen, bc )
{
    var etd = self.document.getElementById("one_dn");
    // Clear the cell...
    clear( etd );
    // Rebuild text...
    buildTxt( etd, bc );
}       


