﻿$(document).ready(function() {


    //Check if this is a chart page
    if ($('.imgBigChart').length) {
        //next hover
        $('#ctl00_ctl00_MainContent_ContentPlaceHolder1_chart1_hypNext').hover(

        function() {
            $('.superFooter #highlights li:nth-child(2n) img').clone().prependTo('#ctl00_ctl00_MainContent_ContentPlaceHolder1_chart1_hypNext');
        },
        function() {
            $('#ctl00_ctl00_MainContent_ContentPlaceHolder1_chart1_hypNext img').remove();
        }
        );
        //back hover
        $('#ctl00_ctl00_MainContent_ContentPlaceHolder1_chart1_hypBack').hover(

        function() {
            $('.superFooter #highlights li:first-child img').clone().prependTo('#ctl00_ctl00_MainContent_ContentPlaceHolder1_chart1_hypBack');
        },
        function() {
            $('#ctl00_ctl00_MainContent_ContentPlaceHolder1_chart1_hypBack img').remove();
        }
        );


        //disable right click on big chart image
        $('#ctl00_ctl00_MainContent_ContentPlaceHolder1_chart1_imgBigChart').bind("contextmenu", function(e) {
            return false;
        });

    } //end of "if ($('.imgBigChart')) {"

    //Check if this is a chart page
    if ($('#ctl00_ctl00_MainContent_ContentPlaceHolder1_chart1_imgBigChart').length) {
        var i = 0;
        var keyArray = new Array();
        keyArray[0] = "Adjusted gross income";
        keyArray[1] = "Alternative Minimum Tax";
        keyArray[2] = "Appropriation";
        keyArray[3] = "Baby boomers";
        keyArray[4] = "Budget deficit";
        keyArray[5] = "Budget surplus";
        keyArray[6] = "Capital gains tax";
        keyArray[7] = "CBO baseline";
        keyArray[8] = "Consumer Price Index";
        keyArray[9] = "Continuing resolution";
        keyArray[10] = "Corporate income tax";
        keyArray[11] = "Discretionary spending";
        keyArray[12] = "Dividend tax rates";
        keyArray[13] = "Earmarks";
        keyArray[14] = "Entitlements";
        keyArray[15] = "Gross domestic product";
        keyArray[16] = "Mandatory spending";
        keyArray[17] = "Marginal tax rate";
        keyArray[18] = "Median income";
        keyArray[19] = "Medicaid";
        keyArray[20] = "Medicare";
        keyArray[21] = "Nominal";
        keyArray[22] = "Outlays";
        keyArray[23] = "Progressive income tax";
        keyArray[24] = "Publicly held debt";
        keyArray[25] = "Real";
        keyArray[26] = "Scored";
        keyArray[27] = "Social Security";
        keyArray[28] = "TARP";
        keyArray[29] = "Tax receipts";
        keyArray[30] = "GDP";
        keyArray[31] = "earmarks";
        keyArray[32] = "entitlement";
        keyArray[33] = "nominal";
        keyArray[34] = "tax receipts";
        keyArray[35] = "adjusted gross income";
        keyArray[36] = "baby boomers";
        keyArray[37] = "entitlements";
        keyArray[38] = "continuing resolution";
        keyArray[39] = "mandatory spending";
        keyArray[40] = "budget deficit";
        keyArray[41] = "AMT";
        keyArray[42] = "publicly held debt";
        keyArray[43] = "scored";
        keyArray[44] = "median income";

        var descriptionArray = new Array();
        descriptionArray[0] = "<a class='tooltip' href='#' title='Total income (before subtracting deductions or taxes) minus deductions'>Adjusted gross income</a>";
        descriptionArray[1] = "<a class='tooltip' href='#' title='Parallel income tax system increasingly falling on the middle class'>Alternative Minimum Tax</a>";
        descriptionArray[2] = "<a class='tooltip' href='#' title='A law that governs annual budget authority and authorizes funds for a given purpose'>Appropriation</a>";
        descriptionArray[3] = "<a class='tooltip' href='#' title='Approximately 80 million Americans born between 1946 and 1964'>Baby boomers</a>";
        descriptionArray[4] = "<a class='tooltip' href='#' title='The amount by which government spending exceeds revenue in a year. Government bonds and securities must be issued to cover the difference'>Budget deficit</a>";
        descriptionArray[5] = "<a class='tooltip' href='#' title='The amount by which the government revenue exceeds spending in a given fiscal year'>Budget surplus</a>";
        descriptionArray[6] = "<a class='tooltip' href='#' title='Tax on increase in value of an investment'>Capital gains tax</a>";
        descriptionArray[7] = "<a class='tooltip' href='#' title='The Congressional Budget Office’s projection of spending or taxes under current law'>CBO baseline</a>";
        descriptionArray[8] = "<a class='tooltip' href='#' title='An index of the cost of living measuring how consumer prices change'>Consumer Price Index</a>";
        descriptionArray[9] = "<a class='tooltip' href='#' title='Temporary authority for agencies to receive funding at current levels, typically used if full-year appropriations legislation is delayed'>Continuing resolution</a>";
        descriptionArray[10] = "<a class='tooltip' href='#' title='Tax on profits made by corporations'>Corporate income tax</a>";
        descriptionArray[11] = "<a class='tooltip' href='#' title='Spending voted on each year by Congress via the appropriations process; accounts for less than 40 percent of total federal spending'>Discretionary spending</a>";
        descriptionArray[12] = "<a class='tooltip' href='#' title='Tax on distributions of income from a corporation to a shareholder'>Dividend tax rates</a>";
        descriptionArray[13] = "<a class='tooltip' href='#' title='A location-specific authorization or appropriation by Congress or the President'>Earmarks</a>";
        descriptionArray[14] = "<a class='tooltip' href='#' title='Program providing guaranteed benefits to eligible parties, such as retirees; funding levels grow automatically'>Entitlements</a>";
        descriptionArray[15] = "<a class='tooltip' href='#' title='Total value of goods and services produced in the United States'>Gross domestic product</a>";
        descriptionArray[16] = "<a class='tooltip' href='#' title='Spending provided by formulas or other criteria set forth in authorizing legislation. Spending is automatic and not voted on by Congress'>Mandatory spending</a>";
        descriptionArray[17] = "<a class='tooltip' href='#' title='As income levels, so do tax rates; the marginal tax rate is the rate that applies to the next dollar of earned income'>Marginal tax rate</a>";
        descriptionArray[18] = "<a class='tooltip' href='#' title='The income level at which half of earners make more and half make less'>Median income</a>";
        descriptionArray[19] = "<a class='tooltip' href='#' title='Federal health care program for low-income individuals and families with children'>Medicaid</a>";
        descriptionArray[20] = "<a class='tooltip' href='#' title='Federal health care program for retirees; includes inpatient and outpatient care and drug coverage'>Medicare</a>";
        descriptionArray[21] = "<a class='tooltip' href='#' title='Current dollar value. Not adjusted for inflation'>Nominal</a>";
        descriptionArray[22] = "<a class='tooltip' href='#' title='Spending to pay a federal obligation'>Outlays</a>";
        descriptionArray[23] = "<a class='tooltip' href='#' title=' A tax system that increases tax rates as the income levels rise'>Progressive income tax</a>";
        descriptionArray[24] = "<a class='tooltip' href='#' title='Debt issued in the form of treasury securities; unlike government-held debt that is issued from one part of the U.S. government to another'>Publicly held debt</a>";
        descriptionArray[25] = "<a class='tooltip' href='#' title='Adjusted for inflation'>Real</a>";
        descriptionArray[26] = "<a class='tooltip' href='#' title='Calculation of the cost of a proposed piece of legislation'>Scored</a>";
        descriptionArray[27] = "<a class='tooltip' href='#' title=' Federal social insurance program that provides income for retirees and the disabled'>Social Security</a>";
        descriptionArray[28] = "<a class='tooltip' href='#' title='$700 billion federal program originally intended to purchase assets and equity from financial institutions'>TARP</a>";
        descriptionArray[29] = "<a class='tooltip' href='#' title='Money collected by the government in the form of taxes'>Tax receipts</a>";
        descriptionArray[30] = "<a class='tooltip' href='#' title='Gross domestic product is the total value of goods and services produced in the United States'>GDP</a>";
        descriptionArray[31] = "<a class='tooltip' href='#' title='A location-specific authorization or appropriation by Congress or the President'>earmarks</a>";
        descriptionArray[32] = "<a class='tooltip' href='#' title='Program providing guaranteed benefits to eligible parties, such as retirees; funding levels grow automatically'>entitlement</a>";
        descriptionArray[33] = "<a class='tooltip' href='#' title='Current dollar value. Not adjusted for inflation'>nominal</a>";
        descriptionArray[34] = "<a class='tooltip' href='#' title='Money collected by the government in the form of taxes'>tax receipts</a>";
        descriptionArray[35] = "<a class='tooltip' href='#' title='Total income (before subtracting deductions or taxes) minus deductions'>adjusted gross income</a>";
        descriptionArray[36] = "<a class='tooltip' href='#' title='Approximately 80 million Americans born between 1946 and 1964'>baby boomers</a>";
        descriptionArray[37] = "<a class='tooltip' href='#' title='Program providing guaranteed benefits to eligible parties, such as retirees; funding levels grow automatically'>entitlements</a>";
        descriptionArray[38] = "<a class='tooltip' href='#' title='Temporary authority for agencies to receive funding at current levels, typically used if full-year appropriations legislation is delayed'>continuing resolution</a>";
        descriptionArray[39] = "<a class='tooltip' href='#' title='Spending provided by formulas or other criteria set forth in authorizing legislation. Spending is automatic and not voted on by Congress'>mandatory spending</a>";
        descriptionArray[40] = "<a class='tooltip' href='#' title='The amount by which government spending exceeds revenue in a year. Government bonds and securities must be issued to cover the difference'>budget deficit</a>";
        descriptionArray[41] = "<a class='tooltip' href='#' title='Parallel income tax system increasingly falling on the middle class'>AMT</a>";
        descriptionArray[42] = "<a class='tooltip' href='#' title='Debt issued in the form of treasury securities; unlike government-held debt that is issued from one part of the U.S. government to another'>publicly held debt</a>";
        descriptionArray[43] = "<a class='tooltip' href='#' title='Calculation of the cost of a proposed piece of legislation'>scored</a>";
        descriptionArray[44] = "<a class='tooltip' href='#' title='The income level at which half of earners make more and half make less'>median income</a>";
        while (i < 45) {
            var finda = keyArray[i];
            var replacea = descriptionArray[i];

            if ($('#ctl00_ctl00_MainContent_ContentPlaceHolder1_chart1_lblParagraph').length) {
                var fulltexta = $('#ctl00_ctl00_MainContent_ContentPlaceHolder1_chart1_lblParagraph').html();
                $('#ctl00_ctl00_MainContent_ContentPlaceHolder1_chart1_lblParagraph').html(fulltexta.replace(new RegExp(finda, 'g'), replacea));
            }
            i++;
        }

    } //end of: "if ($('.imgBigChart').length)"



});





