// javascript for "First Course in Linear Algebra" website

function news_flash(){
    // Include leading space after rednew graphic
    flash = '<p><img alt="New" src="graphics/rednew.gif"></a> Web presentation on open math textbooks, 3:00 PM (Pacific Time), Wed Nov 18<br><a href="http://bit.ly/open-textbook-20091118">http://bit.ly/open-textbook-20091118</a>.</p><p><img alt="New" src="graphics/rednew.gif"></a> Follow the book on <a href="http://twitter.com/">Twitter</a> @ <a href="http://twitter.com/FCLAbook">FCLAbook</a>.</p>'
    // Comment/uncomment next line to turn off/on
    document.write(flash)
}

function nav_links( thispage ){
    // key, href, text for visible link, boolean to open in new page
    pages = [
        ['index', 'index.html', 'Home', false],
        ['about', 'about.html', 'About', false],
        ['download', 'download.html', 'Download', false],
        ['online', 'online.html', 'Online Viewing', false],
        ['fcladiscuss', 'http://groups.google.com/group/fcla-discuss', 'Forum', true],
        ['adoption', 'adoption.html', 'Course Adoption', false],
        ['roadmap', 'roadmap.html', 'Road Map', ],
        ['purchase', 'purchase.html', 'Purchase Book', false],
        ['donate', 'donate.html', 'Donate', false],
        ['helping', 'helping.html', 'How Can I Help?', false],
        ['rss', 'rss.html', 'RSS Feed', false],
        ['sage', 'sage-fcla.html', 'Sage and FCLA', false],
        ['aata', 'http://abstract.ups.edu', 'Abstract Algebra', true],
        ['curriculum', 'curriculum.html', 'Open Math Curriculum', false],
        ['opentexts', 'opentexts.html', 'Open-Source Textbooks', false],
        ['contact', 'contact.html', 'Contact', false]
    ]
    document.write('<ul class="navmenu">')
    for (var i = 0; i < pages.length; i++){
        if (thispage == pages[i][0]){
            linkstyle = 'thislink'
            nav_item = '<li class="thislink">' + pages[i][2] + '</li>'
        } else {
            linkstyle = 'hotlink'
            nav_item = '<li class="hotlink"><a href="' + pages[i][1] + '"'
            if (pages[i][3]){
                nav_item = nav_item + ' target=_blank'
            }
            nav_item = nav_item + '">' + pages[i][2] + '</a></li>'
        }
        document.write(nav_item)
    }
    document.write('</ul>')
}

function side_graphics(){
    pdfcast = '<div class="rssfeed"> <a href="fcla_rss_feed.xml" title="Copy this link and add to your RSS aggregator"> <img src="graphics/orange_xml.png"></a> <a href="fcla_rss_feed.xml">PDFcast</a> </div>'

    // Open Access Week (Oct 2009)
    openaccess = '<div class="oaweek"> <a href="http://www.openaccessweek.org/" title="Open Access Week, October 19-23, 2009"> <img src="graphics/open-access.jpg" width="120" height="240"></a> </div>'

    // Front cover image, links to purchase.html
    cover_buy = '<div class="covericon"> <a href="purchase.html" title="Print Copies"><img src="graphics/waldron.jpg"></a> </div>'

    // Lulu buy button, links to storefront
    lulu_buy = '<div class="luluicon"> <a href="http://www.lulu.com/linearalgebra" title="Buy this book"><img src="graphics/lulu_buy.gif"></a> </div>'

    // fcla-discuss 
    fcla_discuss = '<div class="google-group"> <table cellspacing=0> <tr><td> <!-- size was 26x132 --> <img src="http://groups.google.com/groups/img/3nb/groups_bar.gif" width=120 alt="Google Groups"> </td></tr> <tr><td style="font-size: 100%"> <b>Visit and Join</b> <tr><td style="font-size: 100%"> <b><a href="http://groups.google.com/group/fcla-discuss">fcla-discuss</a></b> </td></tr> </table> </div>'

    // SAGE
    sage = '<div class="sageicon"> <a href="http://sagemath.org" title="SAGE - Open Source Math Software"> <img src="graphics/sage_logo_v3_scaled.png" width="120" height="31"></a> </div>'

    // Affordable textbook campaign
    affordable = '<div class="affordable"> <a href="http://www.maketextbooksaffordable.org/statement.asp?id2=37614" title="Open Content Textbooks"> <img src="graphics/affordable-campaign.png" width="175" height="175"></a> </div>'

    document.write(pdfcast)
    document.write(openaccess)
    document.write(cover_buy)
    document.write(lulu_buy)
    document.write(fcla_discuss)
    document.write(sage)
    document.write(affordable)
}
