﻿function FixPrintFonts(tagname)
{
    // only do this if we're not in full-chapter mode
    if (document.location.href.toUpperCase().indexOf('FULL=TRUE') == -1)
    {
        var tags = document.getElementsByTagName(tagname);
        for (var i = 0; i < tags.length; i++)
        {
            tags[i].style.color = 'black';
            tags[i].style.fontFamily = 'arial';
            tags[i].style.fontSize = '9pt';
        }
    }
    else
    {
        var tags = document.getElementsByTagName('h1');
        // skipping the [0] element on purpose
        for (var i = 1; i < tags.length; i++)
        {
            tags[i].style.fontSize = '9pt';
            tags[i].style.fontFamily = 'arial';
        }
    }
}

$(function()
{
    $('a[id$=lnkLanguage]')
    .css({ 'color': 'black', 'text-decoration': 'none', 'cursor': 'default', 'font-size': 'smaller' })
    .text('[No disponible en español]');

    $('#printVersionLink').click(function()
    {
        // this is tricky - another click function
        // will have already switched the innerHTML
        // so I've commented the following

        if (this.innerHTML == "Print Version")
        {
            // The user is looking at Graphic Version

            // reload the page to get the
            // nav and banner back
            document.location.href = document.location.href;

            // so put things back the way they were
            //            $('a').css({ 'text-decoration': '' });
            //            $('h1').css({ 'color': '', 'font-family': '', 'font-size': '' });
            //            $('h2').css({ 'color': '', 'font-family': '', 'font-size': '' });
            //            $('a[id$=hlRCWs]').show();
            //            $('#divChapterDispoLinks').show();
            //            $('div[id$=pnlPrevNext]').show();
            //            $('#divBreadCrumb').show();
        }
        else
        {
            // The user is looking at Print Version

            // so modify some styles
            $('a').css({ 'text-decoration': 'none' });
            $('a[id$=lnkLanguage]').css({ 'text-decoration': 'none' });
            $('h1').css({ 'color': '#000000', 'font-family': 'arial', 'font-size': '9pt' });
            $('h2').css({ 'color': '#000000', 'font-family': 'arial', 'font-size': '9pt' });
            $('a[id$=hlRCWs]').hide(250);
            $('#divChapterDispoLinks').hide(250);

            $('div[id$=pnlPrevNext]').hide(250);
            $('#divBreadCrumb').hide(250);
            $('h3').css({'font-family':'arial','font-weight':'bold'});
            // completely remove these so select-all copy
            // doesn't grab the nav, etc.
            $('#divNav').remove();
            $('#divSearch').remove();
            $('#divBanner').remove();
        }
    });
});