// (c) 2002 BGv support group

var sChordIndent = '&nbsp;';
var sChordsYes = 'chords=1';
var bChords=0;
if (window.location.search.match(sChordsYes)) {bChords=1;}


function HRef(sURI, sTitle)
{
    var sTag = '<a href="'+ sURI+(bChords ? '?' + sChordsYes : '') + '">' + sTitle + '</a>';
    document.write(sTag);
}


function SwitchMode(sURI)
{
    var sTag = '<a href="' + sURI + (bChords ? '' : '?' + sChordsYes) + '">' + (bChords ? 'Скрыть' : 'Показать') +  ' аккорды</a>';
    document.write(sTag);
}


function BR()
{
    if (bChords)
        document.write('<br>');
}


function Chord(sText, bIndentLeft, bIndentRight, iDoubt)
{
    if(bChords)
    {
        var sIndentLeft  = bIndentLeft ? sChordIndent : '';
        var sIndentRight = bIndentRight ? sChordIndent : '';
        var sClass;

        if (0 == iDoubt)        // no doubt
            sClass = 'chord';
        else if (1 == iDoubt)   // doubtful chord
            sClass = 'chodd';
        else if (2 == iDoubt)   // doubtful chord position
            sClass = 'chorp';

        var sChord = '<span class='+sClass+'>'+sText+'</span>';
        document.write(sIndentLeft + sChord + sIndentRight);
    }
}
