﻿/// <reference name="MicrosoftAjax.js"/>
Type.registerNamespace("GreyHelp");


GreyHelp.BehaviourID = "";
GreyHelp.TitleID = "helpTitle";
GreyHelp.MsgID = "greyHelpMsg";

GreyHelp.Show = function(title, msg) {
    GreyHelp.ClearContent();
    GreyHelp.SetContent(GreyHelp.TitleID, title);
    GreyHelp.SetContent(GreyHelp.MsgID, msg);
    $find(GreyHelp.BehaviourID).show();
}

GreyHelp.Hide = function() {
    GreyHelp.ClearContent();
    $find(GreyHelp.BehaviourID).hide();
}

GreyHelp.SetContent = function(id, msg) {
    $get(id).innerHTML = msg;
}

GreyHelp.ClearContent = function() {
    GreyHelp.SetContent(GreyHelp.TitleID, '');
    GreyHelp.SetContent(GreyHelp.MsgID, '');
}

GreyHelp.CharitableSpendOnSearchTitle = "";
GreyHelp.CharitableSpendOnSearchText = "<span style='color:green;'>Charitable Spend</span> - The percentage of funds the charity dedicates to " +
    "supplying goods or services to meet the needs of its beneficiaries, including support costs or grants " +
    "made to meet the needs of the charity’s beneficiaries, displayed as a proportion compared to the funds " +
    "spent on fundraising and governance."
    
GreyHelp.SmallCharityTitle = "";
GreyHelp.SmallCharityText = "This is a small charity for which we do not have a financial details breakdown.";

GreyHelp.SetForSerchResult = function() 
{
    $('.CharitableHelp').click(function() {
        GreyHelp.Show(GreyHelp.CharitableSpendOnSearchTitle, GreyHelp.CharitableSpendOnSearchText);
    });
    $('.smallCharity').click(function() {
        GreyHelp.Show(GreyHelp.SmallCharityTitle, GreyHelp.SmallCharityText);
    });
}

GreyHelp.SecurityCodeHelpID = "";
GreyHelp.SecurityCodeHelpTitle = "Security code";
GreyHelp.SecurityCodeHelpText = "This is the small three digit number on the back of your debit/credit card. "+
"It is usually located there in the top right hand corner of the signature strip.";

GreyHelp.FillForPayment = function() {
    GreyHelp.BindContent(GreyHelp.SecurityCodeHelpID, GreyHelp.SecurityCodeHelpTitle, GreyHelp.SecurityCodeHelpText);
}

GreyHelp.EmployeesHelpID = "";
GreyHelp.EmployeesHelpTitle = "Employees";
GreyHelp.EmployeesHelpText = "The average number of employees during the year expressed as full-time equivalents.";

GreyHelp.TotalSpendID = "";
GreyHelp.TotalSpendTitle = "The total annual expenditure of the charity";
GreyHelp.TotalSpendText = "<span style='color:green;'>Income:</span> The total annual income received by the charity.<br/><br/>" +
    "<span style='color:#660000;'>Spending:</span> The total annual expenditure of the charity.";

GreyHelp.TotalID = "";
GreyHelp.TotalTitle = "Total";
GreyHelp.TotalText = "<span style='color:green;'>Income:</span> The total annual income received by the charity.<br/><br/>" +
    "<span style='color:#660000;'>Spending:</span> The total annual expenditure of the charity. ";

GreyHelp.CharitableID = "";
GreyHelp.CharitableTitle = "Charitable Activities";
GreyHelp.CharitableText = "<span style='color:green;'>Income:</span> Income received as fees or grants specifically for goods and " +
    "services supplied by the charity to meet the needs of its beneficiaries.<br/><br/>" +
    "<span style='color:#660000;'>Spending:</span> The funds the charity dedicates to supplying goods or services " +
    "to meet the needs of its beneficiaries or grants made to meet the needs of the charity’s beneficiaries.";

GreyHelp.GovernanceID = "";
GreyHelp.GovernanceTitle = "Governance Costs";
GreyHelp.GovernanceText = "Costs associated with running the charity itself (e.g. costs of trustee meetings, internal and " +
    "external audit costs and legal advice relating to governance matters).";

GreyHelp.InvestmentID = "";
GreyHelp.InvestmentTitle = "Investment";
GreyHelp.InvestmentText = "<span style='color:green;'>Income:</span> Income from investments including dividends, interest and rents but " +
     "excluding changes (realised and unrealised gains) in the capital value of the investment portfolio.<br/><br/>" +
     "<span style='color:#660000;'>Spending:</span> Costs incurred in managing the charity’s investments, including " +
     "portfolio and property management costs and investment advice.";

GreyHelp.DonationsID = "";
GreyHelp.DonationsTitle = "Donations";
GreyHelp.DonationsText = "<span style='color:green;'>Income:</span> Gifts, donations and legacies from the public and grants from " +
    "Government and other charitable foundations which provide core funding or are of a general nature.<br/><br/>" +
    "<span style='color:#660000;'>Spending:</span> Costs incurred in encouraging other parties to make grants, gifts " +
    "or legacies to the charity (e.g. mailshots, collection costs, assembling funding applications). " +
    "This is also referred to as 'Fundraising Costs'.";

GreyHelp.ExpenditureHelpID = "";
GreyHelp.ExpenditureHelpTitle = "Pie Chart";
GreyHelp.ExpenditureHelpText = "<span style='color:green;'>Charitable Spend</span> - The funds the charity dedicates to supplying goods or services " +
        "to meet the needs of its beneficiaries or grants made to meet the needs of the charity’s beneficiaries.<br/><br/>" +
        "<span style='color:#b5cc7d;'>Support Costs</span> - Costs associated with undertaking charitable work (e.g. senior management and human resources). " +
        "This is often classed as charitable work.<br/><br/>" +
        "<span style='color:black' >Governance Costs</span> - Costs associated with running the charity itself (e.g. costs of trustee meetings, internal " +
        "and external audit costs and legal advice relating to governance matters).<br/><br/>" +
        "<span style='color:red;'>Fundraising Costs</span> - Costs incurred in encouraging other parties to make grants, " +
        "gifts or legacies to the charity (e.g. mailshots, collection costs, assembling funding applications).<br/><br/>" +
        "<i>NB: the percentage figures are displayed as proportional representations of the amount of funds spent in each of these key areas.</i>";

GreyHelp.OtherHelpID = "";
GreyHelp.OtherHelpTitle = "Other";
GreyHelp.OtherHelpText = "<span style='color:green;'>Income:</span> This category includes gains on the disposal of own " +
    "use assets (i.e. fixed assets not held as investments), but otherwise is only used exceptionally " +
    "for very unusual transactions that cannot be accounted for in the categories above.<br/><br/>" +
    "<span style='color:#660000;'>Spending:</span> This category is only used very exceptionally for items " +
    "that don’t fit within one of the categories above.";

GreyHelp.TradingHelpID = "";
GreyHelp.TradingHelpTitle = "Trading";
GreyHelp.TradingHelpText = "<span style='color:green;'>Income:</span> Income from trading, by providing goods and services to the public, where the main " +
        "motive is raising funds for the charity rather than directly meeting the needs of beneficiaries.<br/><br/>" +
        "<span style='color:#660000;'>Spending:</span> Costs associated with providing goods and services to the public, where the main motive is to " +
        "raise funds for the charity rather than providing goods or services to meet the needs of its beneficiaries. " +
        "(eg charity shops, fundraising dinners etc.).";

GreyHelp.VolunteersHelpID = "";
GreyHelp.VolunteersHelpTitle = "Other";
GreyHelp.VolunteersHelpText = "The trustees' estimate of the number of people who undertook " +
       "voluntary work in the UK for the charity during the year. The number shown is a head " +
      "count and not expressed as full time equivalents.";

GreyHelp.FillContentForDetailsPage = function() 
{
    GreyHelp.BindContent(GreyHelp.EmployeesHelpID, GreyHelp.EmployeesHelpTitle, GreyHelp.EmployeesHelpText);
    GreyHelp.BindContent(GreyHelp.TotalSpendID, GreyHelp.TotalSpendTitle, GreyHelp.TotalSpendText);
    GreyHelp.BindContent(GreyHelp.TotalID, GreyHelp.TotalTitle, GreyHelp.TotalText);
    GreyHelp.BindContent(GreyHelp.CharitableID, GreyHelp.CharitableTitle, GreyHelp.CharitableText);
    GreyHelp.BindContent(GreyHelp.GovernanceID, GreyHelp.GovernanceTitle, GreyHelp.GovernanceText);
    GreyHelp.BindContent(GreyHelp.InvestmentID, GreyHelp.InvestmentTitle, GreyHelp.InvestmentText);
    GreyHelp.BindContent(GreyHelp.DonationsID, GreyHelp.DonationsTitle, GreyHelp.DonationsText);
    GreyHelp.BindContent(GreyHelp.ExpenditureHelpID, GreyHelp.ExpenditureHelpTitle, GreyHelp.ExpenditureHelpText);
    GreyHelp.BindContent(GreyHelp.OtherHelpID, GreyHelp.OtherHelpTitle, GreyHelp.OtherHelpText);
    GreyHelp.BindContent(GreyHelp.TradingHelpID, GreyHelp.TradingHelpTitle, GreyHelp.TradingHelpText);

}

GreyHelp.BindContent = function(id, title, text) {
lnk = $get(id);
if (lnk != null && lnk != undefined)
    $addHandler(lnk, "click", function() 
    {
        GreyHelp.Show(title,text);
    });
}

if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
