// turboTax2003: Generateds Turbo Tax markup for the 2003 tax year
// link: where the end user should be directed when clicking the logo
// optionalTextLink: for FIs who want to add their own text links below 
//                   the logo
// Note: add "<START-HERE>" and "<END-HERE>" around the part of your text in optionalTextLink 
//       that you want to make "hot"
//     
//              example: turboTax2003("./go-here.html", "<START-HERE>do your taxes<END-HERE>");
//
// Note: use the following javascript to include the function
//			
// 	 	<script type="text/javascript" src="turbotax-2003/turbotax-2003.js"></script>
//
// Preconditions: should have associated graphic files in same directory as turbotax.html
// Postconditions: dynamic markup written to current document, depending on input
//                 param's and current date

function turboTax2003(link, optionalTextLink)
{
	var november = new Date();
	var february15th = new Date();
	var october16th = new Date();
	var now = new Date();
	var url = new String('<a href="LINK" target="_blank"><img src="IMAGE-FILE" border="0" /></a>');
	var urlTextLink = new String('<br />TEXT');
	var linkAnchorOpen = '<a href="LINK" target="_blank">';
	var linkAnchorClose = '</a>';
	var img2003 = "turbotax-2003/early_mid_120x90.gif";
	var img2004 = "turbotax-2003/mid_late120x90.gif";
	var imgTextLink = "turbotax-2003/ttw150x52.gif";
	var markup = "turbo tax logo here";

	// Set up dates.

	november.setFullYear(2003);
	november.setMonth(10);
	november.setDate(1);
	february15th.setFullYear(2004);
	february15th.setMonth(1);
	february15th.setDate(15);
	october16th.setFullYear(2004);
	october16th.setMonth(10);
	october16th.setDate(16);

	// Set up the link.

	markup = new String(url.replace("LINK", link));

	// Determine which kind of logo to use.  Chooses between seasonal logos or a special logo if 
	// an optional text link is provided.

	if ("undefined" == typeof(optionalTextLink))
		optionalTextLink = "";

	if ("" != optionalTextLink || (now.getTime() < november.getTime()))
	{
		var temp;

		markup = markup.replace("IMAGE-FILE", imgTextLink);

		// Now add text link.

		markup += urlTextLink.replace("LINK", link); // sets up anchor for image
		markup = new String(markup).replace("TEXT",  linkAnchorOpen + optionalTextLink + linkAnchorClose);
		while (-1 != markup.indexOf("START-HERE"))
			markup = new String(markup.replace("<START-HERE>", linkAnchorOpen));
		while (-1 != markup.indexOf("END-HERE"))
			markup = new String(markup.replace("<END-HERE>", linkAnchorClose));
		while (-1 != markup.indexOf("LINK"))
			markup = new String(markup.replace("LINK", link)); // sets up anchor for text
	}
	else if (now.getTime() >= november.getTime() && now.getTime() < february15th.getTime())
		markup = markup.replace("IMAGE-FILE", img2003);
	else if (now.getTime() >= february15th.getTime())
		markup = markup.replace("IMAGE-FILE", img2004);
	else
		markup = markup.replace("IMAGE-FILE", imgTextLink); // should never go here, but just in case

	// Apply styles and center.

	if (now.getTime() <= october16th.getTime())
		markup = '<div class="ficontent" style="text-align: center;">' + markup + '</div>';
	else
		markup = ""; // ceases to generate markup for turbotax
	return markup;	
}

// Same as the other, except for wider and shorter image.
function turboTax2003banner(link, optionalTextLink)
{
	var markup = turboTax2003(link, optionalTextLink);
	markup = new String(markup).replace("early_mid_120x90.gif", "early_mid_468X60.gif");
	markup = new String(markup).replace("mid_late120x90.gif", "mid_late_468X60.gif");
	return markup;
}
