
//Get Cobrand detail--------------
//This requires UtilityScripts.js to be include in page
    cobrandCookieReadWrite();

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Function Name : renderFooter()
/// Parameters :
///     Name                      Values  
///     ----------------------    -----------------------------     
///     displayBBBOnlineLogo      true/false, default=true
///     displayBFSLink            true/false, default=true
///     showDisclaimer            DisclaimerKey's defined in getDisclaimerValueByKey seperated by "^^" sign
///     additionalStandardText    If additional text to be displayed along with standard ShareBuilder footer text
///     cobrandSpecificText       If any specific footer text for Cobrand, otherwise default(ShareBuilder is not affiliated with " + cobrand).
///     showDowJonesDisclaimer    true/false, default=false
///     applyStyle                Name of the Class to apply
///     isDivTagRequired          If isDivTagRequired , true/false, default=true 
/// Description : If no parameter value is set, the default copyright text will appear along with BBBOnline logo, BFSLink within a Div tag.
///               Individual Parameters can be set as per the possible values specified above to customize the footer display.
///     eg: 
///         1. For displaying default Copyright footer, call renderFooter() function as- 
///                 renderFooter(displayBBBOnlineLogo, false, showDisclaimer, additionalStandardText, cobrandSpecificText, showDowJonesDisclaimer, applyStyle, isDivTagRequired, displayMarketingFees, true, displayNotNot, displayCopyright)
///         2. Changing display - Set parameter as- eg: for hiding BBBOnline logo and applying different stylesheet which is local to that page say "Style1" -  
///                  
///                 displayBBBOnlineLogo = false;
///                 applyStyle = "Style1";
///                 renderFooter(displayBBBOnlineLogo, displayBFSLink, showDisclaimer, additionalStandardText, cobrandSpecificText, showDowJonesDisclaimer, applyStyle )
///   
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

//--Parameters declarations for renderFooter() function
var displayBBBOnlineLogo;      
var displayBFSLink;             
var showDisclaimer;             
var additionalStandardText;    
var cobrandSpecificText;        
var showDowJonesDisclaimer;     
var applyStyle;                 
var applyPStyle;
var isDivTagRequired;
var displayNotNot;
var displayMFNotNot;
var displayCopyright;
var displayStandardFees;
var displayMarketingFees;
var displayMoneyOffer;
var OfferAmount;
var FootNote;
var displayFreeTrial;
var displayFacebookWidget;
var displayMotley;

    
function renderFooter(displayBBBOnlineLogo, displayBFSLink, showDisclaimer, additionalStandardText, cobrandSpecificText, showDowJonesDisclaimer, applyStyle, isDivTagRequired, displayMarketingFees, displayStandardFees, displayNotNot, displayCopyright, displayMoneyOffer, displayFreeTrial, displayFacebookWidget)
{
    additionalStandardText = (additionalStandardText == null || additionalStandardText == "") ? "" : additionalStandardText;
    applyStyle = (applyStyle == null || applyStyle == "") ? "NoticeText" : applyStyle;
    cobrandSpecificText = (cobrandSpecificText == null || cobrandSpecificText == "") ? "default" : cobrandSpecificText;
	displayBBBOnlineLogo = (displayBBBOnlineLogo == null ) ? false : true;
    displayBFSLink = (displayBFSLink == null ) ? true : false;
	displayCopyright = (displayCopyright == null ) ? true : false;
    displayFacebookWidget = (displayFacebookWidget == null ) ? false : true;
	displayFreeTrial = (displayFreeTrial == null ) ? false : true;
	displayMarketingFees = (displayMarketingFees == null ) ? false : true;
	displayMFNotNot = (displayMFNotNot == null ) ? false : true;
	displayMoneyOffer = (displayMoneyOffer == null ) ? false : true;	
	//displayMotley = (displayMotley == null ) ? false : true;
	displayNotNot = (displayNotNot == null ) ? true : false;                     
	displayStandardFees = (displayStandardFees == null ) ? false : true;
    isDivTagRequired = (isDivTagRequired == null ) ? true : false;	
    showDisclaimer = (showDisclaimer == null || showDisclaimer == "") ? "none" : showDisclaimer;	
    showDowJonesDisclaimer = (showDowJonesDisclaimer == null || showDowJonesDisclaimer == "") ? false : true;	
	
    //Set cobrand disclaimer text
    if ( cobrand.toLowerCase() == "sharebuilder")
        cobrandSpecificText = "";            
        
    if ( cobrand.toLowerCase() != "sharebuilder" && cobrandSpecificText == "default" )
    {
        cobrandSpecificText = ""; //"ShareBuilder is not affiliated with " + cobrand +"."; 
    }

	//Set copy variables
	var applyPStyle = "<p class=\""+ applyStyle +"\">";
    var bbbOnlineLogo = "";    
    var bfsLink     =  "<a href='http://content.sharebuilder.com/mgdcon/core/financials/index.htm' onclick='popup.OpenPopUpMedium(this);return false;'>Brokerage Financial Statement</a>";
	var d = new Date();
	var currYear = d.getFullYear();
    var copyrightText = "&copy; 2006 - " + currYear + " ShareBuilder Corporation. ShareBuilder is a registered trademark of ShareBuilder Corporation.";
    var facebookWidgetText = "While each customer story is a true experience of an actual customer, ING DIRECT INVESTING does not represent or imply that every consumer has had or will have a similar experience.  Results can and do vary.  Sharing these stories should not be considered investment or tax advice, or a guarantee of future performance or success.";
	var FreeTrialText = "The Standard Program monthly subscription charge of $12 is waived for the first month of your subscription. You will be charged a $12 per month subscription charge after your free trial month if you remain subscribed to the Standard Investing Program.";		
    var ingInvestStandardText = "ShareBuilder is a service of ING DIRECT Investing, Inc. Securities products are offered by ING DIRECT Investing Inc., a registered broker-dealer and Member ";
    var ingStandardText = "ING DIRECT Investing is a subsidiary of ING Bank, fsb.";                    
	var MarketingFeesText = "For complete information, see our <a href=\"http://www.sharebuilder.com/affiliates/?PC=md&SID=MARKETINGDEFAULT&SBPAGE=fees&cm_sp=WEB-_-LP-_-Fees\" target='_blank'>Pricing & Rates</a>.";
	var MFNotNotText = "<strong>Mutual fund products are: Not FDIC insured &bull; Not bank guaranteed &bull; May lose value</strong>";
	var MoneyOfferText = FootNote + "You must open a new ShareBuilder Account and purchase at least one security to receive this offer. Please note the $" + OfferAmount + " credit will post to your account approximately 4 weeks after the first transaction executes. Not valid with IRA or Education Savings Accounts. Not valid with any other offers. Valid only for first time account holders with ShareBuilder. ShareBuilder reserves the right to terminate this offer at any time.";
	//var MotleyText = "The content provided in The Motley Fool \"10 Core Stocks for Your Portfolio\" is for educational purposes only and was produced solely by The Motley Fool. Any securities or investment strategies discussed in the report are not recommendations by ING DIRECT Investing. ING DIRECT Investing is not affiliated with The Motley Fool.";
	var NotNotText = "<strong>Securities products are: Not FDIC insured &bull; Not bank guaranteed &bull; May lose value</strong>";
    var sipcFinraLink = "<a href='http://www.finra.org/index.htm\' target='_blank'>FINRA</a>/<a href=\"http://www.sipc.org\" target='_blank'>SIPC</a>. "
	//onclick=\"popup.OpenPopUpLarge(this);return true;\" to open a new window for SIPC
	var StandardFeesText = "For complete information, see our <a href=\"http://www.sharebuilder.com/" + cobrand + "/Fees/Default.aspx\" target='_blank'>Pricing & Rates</a>.";
    var txtFooter = "";


    //Start creating footer
    if(isDivTagRequired)
        txtFooter += "<div class=\"FooterBottom\">";


    //Add code to display disclaimers
	if(displayStandardFees)
		txtFooter += applyPStyle + StandardFeesText +"</p>";
	
	if(displayMarketingFees)
		txtFooter += applyPStyle + MarketingFeesText +"</p>";
	
	if(displayMoneyOffer)
		txtFooter += applyPStyle + MoneyOfferText +"</p>";
		
	if(displayFreeTrial)
		txtFooter += applyPStyle + FreeTrialText +"</p>";
				
	if(displayFacebookWidget)
		txtFooter += applyPStyle + facebookWidgetText +"</p>";	 
	
    if(showDisclaimer!="none")
    {
        var disclaimer = getDisclaimerText(showDisclaimer, applyStyle);
        txtFooter += disclaimer;
    }
	
    if(!displayBFSLink)     
		bfsLink = "";
	
	//if(displayMotley)
	//txtFooter += applyPStyle + MotleyText +"</p>";
	
	txtFooter += applyPStyle;
    txtFooter += ingInvestStandardText 
                 + sipcFinraLink
                 + ingStandardText
				 + bfsLink;
            
    if(additionalStandardText != "")       
            txtFooter += additionalStandardText;  
                                     
    if(cobrandSpecificText!="") 
        txtFooter += applyPStyle + cobrandSpecificText +"</p>";
        
    txtFooter += "</p>";

	if(displayNotNot)
		txtFooter += applyPStyle + NotNotText +"</p>";
		
	if(displayMFNotNot)
		txtFooter += applyPStyle + MFNotNotText +"</p>";

	if(displayCopyright)
		txtFooter += applyPStyle + copyrightText +"</p>";
		
    if(displayBBBOnlineLogo)
        txtFooter += bbbOnlineLogo
		
	//if(displayFacebookWidget)
     //   txtFooter += facebookWidgetText;	
    
    if(showDowJonesDisclaimer)
        txtFooter += getDisclaimerText("DowJones", applyStyle);

    if(isDivTagRequired)    
        txtFooter += "</div>";

    //Display footer
    document.write(txtFooter);  
}

function getDisclaimerText(strDisclaimerCodes, applyStyle)
{        
    var disclaimerText = "";
    var arrDisclaimerCodes = strDisclaimerCodes.split("^^");
    for(i=0;i<arrDisclaimerCodes.length;i++)
    {
        disclaimerText += applyPStyle + getDisclaimerValueByKey(arrDisclaimerCodes[i]) +"</p>";        
     }   
    return disclaimerText;
}
    
var DisclaimerDictionary; 
function getDisclaimerValueByKey(disclaimerKey)
{
    if(DisclaimerDictionary == null)
    {        
        DisclaimerDictionary = new Object;        
        DisclaimerDictionary["Options"] = "* Options involve risk and are not suitable for all investors. Before investing in options, please read the "
                                          + "<a href=\"http://www.theocc.com/publications/risks/riskchap1.jsp\" onclick=\"popup.TargetNewWindow(this);return false;\">Characteristics and Risks of Standardized Options</a>.";        
                                          
        DisclaimerDictionary["DowJones"] = "The Dow Jones Indexes<sup>SM</sup> are proprietary to and distributed by Dow Jones & Company, Inc., and have been licensed for use.";
    }        
    return (DisclaimerDictionary[disclaimerKey] == undefined ? "" : DisclaimerDictionary[disclaimerKey]);
}


function writeDate(exp) {

  expirationDate = "";

  switch (exp) {
    case "90days":
       var now=new Date();
       var newdate=new Date();
       var newtimems=newdate.getTime()+(21*24*60*60*1000);
       newdate.setTime(newtimems);

       var exp_date = newdate.getDate();
       var exp_month = newdate.getMonth();
       exp_month++;
       var exp_year =  newdate.getFullYear();      

       expirationDate =  exp_month + "/" + exp_date + "/" + exp_year;
       break;
    case "25Bonus":
       expirationDate = "12/31/2011";

	   break;
    case "30Bonus":
      
	   expirationDate = "12/31/2011";
       break;    
    case "50Bonus":
      
	   expirationDate = "12/31/2011";
       break;
  }

  document.write(expirationDate);
}

var BonusOffer25_90day = '<p><span>**</span> You must open a new ShareBuilder account and deposit $25 or more to be eligible for this promotion. Initial deposit must be completed by ' + '<sc' + 'ript' + ' type="text/javascript"' + ' language="JavaScript">' + 'writeDate("90days");' + '</sc'+'ript>' + '. ING DIRECT Investing will deposit a $25 bonus approximately 4-6 weeks after your first $25 deposit. The $25 bonus offer is available for Individual, Joint and Custodial accounts only. Offer not valid for IRAs or ESAs. The $25 bonus from ING DIRECT Investing is not available for withdrawal for 90 days after it is awarded to your account. This offer is not valid with any other offers and is non-transferrable. Limit one ShareBuilder account bonus per unique customer or custodial beneficiary. We reserve the right to terminate this offer at any time and to refuse or recover any promotion award if we determine that it was obtained under wrongful or fraudulent circumstances, that inaccurate or incomplete information was provided in opening the account, or that any terms of our Account Agreement have been violated.  Offer expires ' + '<sc' + 'ript' + ' type="text/javascript"' + ' language="JavaScript">' + 'writeDate("90days");' + '</sc'+'ript>' + '.<\/p>';

var BonusOffer25 = '<p><span>**<\/span> You must open a new ShareBuilder account and deposit $25 or more to be eligible for this promotion. Initial deposit must be completed by ' + '<sc' + 'ript' + ' type="text/javascript"' + ' language="JavaScript">' + 'writeDate("25Bonus");' + '</sc'+'ript>' + '. ING DIRECT Investing will deposit a $25 bonus approximately 4-6 weeks after your first $25 deposit. The $25 bonus offer is available for Individual, Joint and Custodial accounts only. Offer not valid for IRAs or ESAs. The $25 bonus from ING DIRECT Investing is not available for withdrawal for 90 days after it is awarded to your account. This offer is not valid with any other offers and is non-transferrable. Limit one ShareBuilder account bonus per unique customer or custodial beneficiary. We reserve the right to terminate this offer at any time and to refuse or recover any promotion award if we determine that it was obtained under wrongful or fraudulent circumstances, that inaccurate or incomplete information was provided in opening the account, or that any terms of our Account Agreement have been violated. Offer expires ' + '<sc' + 'ript' + ' type="text/javascript"' + ' language="JavaScript">' + 'writeDate("25Bonus");' + '</sc'+'ript>' + '.<\/p>';

var BonusOffer25_2 = '<p><span>**<\/span> You must open a new ShareBuilder account and purchase at least one security to receive this offer. Please note the $25 account bonus will post to your account approximately 4 weeks after the first transaction executes. Offer not valid for IRAs or ESAs. Not valid with any other offers. Valid only for first time account holders with ING DIRECT Investing. We reserve the right to terminate this offer at any time and to refuse or recover any promotion award if we determine that it was obtained under wrongful or fraudulent circumstances, that inaccurate or incomplete information was provided in opening the account, or that any terms of our Account Agreement have been violated.  Offer expires ' + '<sc' + 'ript' + ' type="text/javascript"' + ' language="JavaScript">' + 'writeDate("25Bonus");' + '</sc'+'ript>' + '.<\/p>';

var BonusOffer30 = '<p><span>**<\/span> You must open a new ShareBuilder account and deposit $30 or more to be eligible for this promotion. Initial deposit must be completed by  ' + '<sc' + 'ript' + ' type="text/javascript"' + ' language="JavaScript">' + 'writeDate("30Bonus");' + '</sc'+'ript>' + '. ING DIRECT Investing will deposit a $30 bonus approximately 4-6 weeks after your first $30 deposit. The $30 bonus offer is available for Individual, Joint and Custodial accounts only. Offer not valid for IRAs or ESAs. The $30 bonus from ING DIRECT Investing is not available for withdrawal for 90 days after it is awarded to your account. This offer is not valid with any other offers and is non-transferrable. Limit one ShareBuilder account bonus per unique customer or custodial beneficiary. We reserve the right to terminate this offer at any time and to refuse or recover any promotion award if we determine that it was obtained under wrongful or fraudulent circumstances, that inaccurate or incomplete information was provided in opening the account, or that any terms of our Account Agreement have been violated. Offer expires ' + '<sc' + 'ript' + ' type="text/javascript"' + ' language="JavaScript">' + 'writeDate("30Bonus");' + '</sc'+'ript>' + '.<\/p>';

var BonusOffer50 = '<p><span>**<\/span> You must open a new ShareBuilder account and deposit $50 or more to be eligible for this promotion. Initial deposit must be completed by ' + '<sc' + 'ript' + ' type="text/javascript"' + ' language="JavaScript">' + 'writeDate("50Bonus");' + '</sc'+'ript>' + '. ING DIRECT Investing will deposit a $50 bonus approximately 4-6 weeks after your first $50 deposit. The $50 bonus offer is available for Individual, Joint and Custodial accounts only. Offer not valid for IRAs or ESAs. The $50 bonus is not available for withdrawal for 90 days after it is awarded to your account. This offer is not valid with any other offers and is non-transferrable. Limit one ShareBuilder account bonus per unique customer or custodial beneficiary. We reserve the right to terminate this offer at any time and to refuse or recover any promotion award if we determine that it was obtained under wrongful or fraudulent circumstances, that inaccurate or incomplete information was provided in opening the account, or that any terms of our Account Agreement have been violated. Offer expires ' + '<sc' + 'ript' + ' type="text/javascript"' + ' language="JavaScript">' + 'writeDate("50Bonus");' + '</sc'+'ript>' + '.<\/p>';



var BonusOffer50_2 = '<p><span>**<\/span> You must open a new ShareBuilder account and purchase at least one security to receive this offer. Please note the $50 account bonus will post to your account approximately 4 weeks after the first transaction executes. Offer not valid for IRAs or ESAs. Not valid with any other offers. Valid only for first time account holders with ING DIRECT Investing. We reserve the right to terminate this offer at any time and to refuse or recover any promotion award if we determine that it was obtained under wrongful or fraudulent circumstances, that inaccurate or incomplete information was provided in opening the account, or that any terms of our Account Agreement have been violated.  Offer expires ' + '<sc' + 'ript' + ' type="text/javascript"' + ' language="JavaScript">' + 'writeDate("50Bonus");' + '</sc'+'ript>' + '.<\/p>';

function renderBonusText(bonusOffer) {

document.write(bonusOffer);

}
