
// this function returns the copyright string
function biocCopyright ()
{
    return "<hr align=left width=800>"+
        "<table width=800 ><tr><td></td><td align=right>"+
//        "<img height=24 src='pics/logo.gif'>"+
        "<div class=\"copyright\">&copy;2005-2009 BioCompanion LLC. All rights reserved.</div>"+
        "</td></tr></table><br>";
}

// this function returns a downloadable file url and information html
// if the tgt has "func" prefix  the anchor evaluates that function (after truncating
// the prefix)  

function biocDownload(nam, hrf, siz, txt ,  tgt )
{
    allt="<li><a href='"+hrf+"' ";
    
    if( isBrws("ie")  && tgt && tgt!="") {
        if(tgt.indexOf("func")==0) allt+=" onclick='return "+tgt.substr(4)+"' ";
        else allt+=" target='"+tgt+"' ";
    }
    allt+=">"+nam+"</a><small>&nbsp;("+parseInt((siz/1024)+1)+"kb)</small>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+txt+"</li>";

    return allt;
}

// this function creates a <div>-ed sections of 'dsect' kind for toggleable 
// elements. It attaches the commented sections of the body of the divs as 
// tooltip-able links a the end of the section 
// the list of sections and the parents is maintained in secCmdLst and sectParArr
var sectIsHead=0;
var sectLastNam=""; // the last nam for which the sect is called 
var  sectParLst = new Array(); // the list of section parents 
var  sectParArr = new Array(); // the list of children for a parent 
var sectParSplitter="<br>";
var sectTitlePreFix="";
var sectTitlePostFix="";
var sectStyle="sectHid";

function biocSect( par, title, nam, newsec)
{   

    if(sectLastNam!="") { 
        // tooltip buttons for the previous section needed ? 
        txt="";
        src=gObject(sectLastNam ).innerHTML;
        for(epos=0; epos!=-1; ) {
            spos=src.indexOf("!-- %",epos) ;if(spos==-1)break;spos+=5;
            epos=src.indexOf("%", spos);if(epos==-1)break;
            part=src.substr(spos,epos-spos);
            if(txt.length)txt+=", ";
            txt+="<a href=\"javascript:biocTooltipPop('"+sectLastNam+"','"+part+"')\">"+part+"</a>" ;
        }
        if(txt.length)
            document.write("</td></tr><tr><td>"+txt);
    }   
        
        
    if(par && par.length) {
        // find a space for this parent 
        for ( i=0;i<sectParLst.length && sectParLst[i]!=par; ++i) ;
        if(i==sectParLst.length) { // a new array 
            sectParLst[i]=par;
            sectParArr[i]=new Array();
        }
        sectParArr[i][sectParArr[i].length]=nam;
        sectParArr[i][sectParArr[i].length]=title;
    }
    
    // create the next section          
    if(par!="")
        title+=sectTitlePostFix;//"&nbsp;&nbsp;<a href='javascript:showunder(\"browse\",1)'>^</a>";
    
    t="";
    
    if(sectIsHead) {
        t+="</td></tr>";
        if(newsec!="row")
            t+="</table>";
        if(newsec=="br")
            t+=sectParSplitter;
        if(newsec!="row")
            t+="</div>";            
    }
    
    if(title=="") sectIsHead=0;
    else {
        if(newsec!="row")
            t+="<div id='"+nam+"' class='"+sectStyle+"'><table border=1 class='ssect'>";
        t+="<tr><th>";
        
        t+="<a name=\""+nam+"\">"+sectTitlePreFix+title+"</a></th></tr><tr><td >";
        sectIsHead=1;
    }    
    document.write(t);
    
    // hide the new section 
    if(sectStyle=="sectHid")layerSet(nam,"-","-","-","hide","-","-");
    sectLastNam=nam;
}



// this one works in conjuction with the biocSection and pops up the body-commented tooltips
function biocTooltipPop(nam,part)
{
    // find the element
    src=gObject(nam).innerHTML;
    spos=src.indexOf("!-- %"+part+"%") ; if(spos==-1)return ;spos+=6+part.length+1;
    epos=src.indexOf("-->", spos);if(epos==-1)return ;
    
    txt=src.substr(spos,epos-spos);
    if(part=="Command")
        txt="<code>"+txt.replace(/ -/g, "<br>&nbsp;&nbsp;-")+"</code>"; // introduce the brakes             
    tooltipPop(part,txt);
}


/*
function sect(hd, nm, newsec)
{
    t="";
    if(isSectHead) {
        t+="</td></tr>";
        if(newsec!="row")
            t+="</table></div>";
    }
    if(hd=="") { isSectHead=0;return t;}
    if(newsec!="row")
        t+="<div id='"+nm+"' class='dsect'><table border=1 class='ssect'>";
    t+="<tr><th width=400>";
    
    t+="<a name=\""+nm+"\">"+hd+"</a></th></tr><tr><td width=400>";
    isSectHead=1;
    return t;
}

*/





