/**
 * 
 *  Common used functions for JQuery
 *
 */
 

function expiration(section) {
			
	var nowDate = new Date();
	
	nowDate = JSDateToExcelDate(nowDate);
	
	/*** us home, featured markets insights in center column ***/	
	if (section == "featured_market_insights"){
		
		$.ajax({
			type: "GET",
			url: "xml/exp_home_featured_market_insights.xml",
			dataType: "xml",
			success: function(xml) {
				
				/* count the number of records so we can do a different style for the last item (no divider line) */
				x = 0;
				total = $(xml).find('Expiration_Item').length;
									
				$(xml).find('Expiration_Item').each(function(){
					
					var title_text = $(this).find('Title').text();
					var date_text = $(this).find('Display_Date').text();
					var description_text = $(this).find('Description').text();
					var url_text = $(this).find('URL').text();
					var expiration_text = $(this).find('Expiration_Date').text();
					var format_text = $(this).find('Format').text();
					
				

					/* set the HTML to display or not based on exp date */
					if (nowDate < expiration_text && expiration_text != "n/a"){
						var alertStyle = "style='display: block'";
					} else if (nowDate >= expiration_text && expiration_text != "n/a") {
						alertStyle = "style='display: none'";
					} else {
						alertStyle = "style='display: block'";
					}
					
					/* 1 - chose which icon to show with what 'alt' text for that image */
					/* 2 - choose link format from whitepaper, newsletter, or webcast */
					if (format_text == "White Paper") {
						var format = "icon-whitepaper.jpg";
						var formatAlt = "whitepaper";
						var formatLink = "<a href='" + url_text + "' target='_blank' class='button-silver'>Download PDF &raquo; <img src='images/icon-pdf.gif' alt='PDF'></a>";
					}
					if (format_text == "Webcast") {
						format = "icon-webcast.jpg";
						formatAlt = "webcast";
						formatLink = "<a href='" + url_text + "' class='button-silver'>View this webcast &raquo;</a>";
					}
					if (format_text == "Newlsetter") {
						format = "icon-newsletter.jpg";
						formatAlt = "newsletter";
						formatLink = "<a href='" + url_text + "' target='_blank' class='button-silver'>Download PDF &raquo; <img src='images/icon-pdf.gif' alt='PDF'></a>";
					}	
					
					
					/* build the HTML string */
					
					x += 1;
					
					strToAppend = "<span " + alertStyle + ">" +
								"<div class='portlet-content-pic'><img src='images/" + format + "' alt='" + formatAlt + "'></div>" + 
								"<div class='portlet-content-text'>" +
								"<h2>" + title_text + "</h2>" +
								"<p><em>" + date_text + "</em></p>" +
								"<p>" + description_text + "</p>" +
								"<div class='link-wrapper'>" + formatLink + "</div>" +
								"</div>";					
											
					/* apply a different style to the last item only: get rid of divider line */
					if (x < total){
						strToAppend += "<div class='rule'></div>" +
								"<div class='spacer-15'></div>" +
								"</span>";
					}
					if (x == total){
						strToAppend += "</span>";
					}
					
					
					/* take the entire string and add it to the div on the page */
					$('#exp-featured-market-insights-items').append(strToAppend);
					/*$('#exp-featured-market-insights-items').prepend(strToAppend);*/
						 
				}); //close each(
			} //close success:			
		}); //close $.ajax(
		
	} //close if
	/*****/
	
	
	
	/*** us home, accordion ***/
	if (section == "pyramis_glance"){
		
		$.ajax({
			type: "GET",
			url: "xml/exp_home_pyramis_glance.xml",
			dataType: "xml",
			fail: function() { alert("can't find " + url); },
			success: function(xml) {

				var strToAppend_factsheet = "";
				var strToAppend_timeline = "";
				
				$(xml).find('Expiration_Item').each(function(){
					
					var title_text = $(this).find('Title').text();
					var url_text = $(this).find('URL').text();
					var expiration_text = $(this).find('Expiration_Date').text();
					
					/* expiration routine using nowDate from the top of this function */
					if (nowDate < expiration_text && expiration_text != "n/a"){
						var alertStyle = "style='display: block'";
					} else if (nowDate >= expiration_text && expiration_text != "n/a") {
						alertStyle = "style='display: none'";
					} else {
						alertStyle = "style='display: block'";
					}
					
					
					
					strToAppend_factsheet = "<span " + alertStyle + ">" +
								"<div class='link-wrapper'><a href='" + url_text + "' target='_blank' class='button-silver'>" + title_text + " &raquo; <img src='images/icon-pdf.gif' alt='PDF'></a></div>" +
								"</span>";
										
					$('#pyramis-glance-02').append(strToAppend_factsheet);
					
					
				}); //close each(
				
				strToAppend_timeline += "<div class='timeline-event y2010'><p class='marker-year'>2010</p><p class='marker-title'>Pyramis Expands to Asia</p><p>Pyramis opens distribution office in Hong Kong.</p></div>";
				strToAppend_timeline += "<div class='timeline-event y2009'><p class='marker-year'>2009</p><p class='marker-title'>Pyramis Grows Global Distribution</p><p>Pyramis adds distribution presence in Europe and the Middle East.</p></div>";
				strToAppend_timeline += "<div class='timeline-event y2008'><p class='marker-year'>2008</p><p class='marker-title'>Pyramis Expands</p><p>Pyramis opens offices in Canada and the United Kingdom.</p></div>";
				strToAppend_timeline += "<div class='timeline-event y2005'><p class='marker-year'>2005</p><p class='marker-title'>Pyramis Formed</p><p>Pyramis Global Advisors is formed to focus on institutional investing.</p></div>";
				strToAppend_timeline += "<div class='timeline-event y1981'><p class='marker-year'>1981</p><p class='marker-title'>Fidelity Management Trust Company Established</p><p>Fidelity Manageement Trust Company is established to offer trustee and investment management services to institutional clients.</p></div>";
				strToAppend_timeline += "<div class='timeline-event y1969'><p class='marker-year'>1969</p><p class='marker-title'>FIL Limited is Founded</p><p>FIL Limited, a leading asset manager in Europe and the Asia-Pacific region, is founded.</p></div>";
				strToAppend_timeline += "<div class='timeline-event y1964'><p class='marker-year'>1964</p><p class='marker-title'>Fidelity Investments Establishes FMR Investment Management Service, Inc.</p><p>Created to provide investment advisory services to large corporate pension clients.</p></div>";
				strToAppend_timeline += "<div class='timeline-event marker-first'><p class='marker-year'>1946</p><p class='marker-title'>Fidelity Investments is Founded</p><p>Established Fidelity Management &amp; Research Company (FMRCo.), which is now the investment advisor to one of the largest mutual fund companies in the US.</p></div>";
				
				$('#pyramis-glance-01').append(strToAppend_timeline);

			} //close success:			
		}); //close $.ajax(
		
	} //close XML section	
	/*****/
	
	
	
	/*** pyramis in the news ***/
	if (section == "news"){
			
		$.ajax({
			type: "GET",
			url: "xml/exp_news.xml",
			dataType: "xml",
			success: function(xml) {
				
				$(xml).find('News_Item').each(function(){
					
					var title_text = $(this).find('Title').text();
					var date_text = $(this).find('Display_Date').text();
					var description_text = $(this).find('Description').text();
					var url_text = $(this).find('URL').text();
					var expiration_text = $(this).find('Expiration_Date').text();
					
					/* expiration routine using nowDate from the top of this function */
					if (nowDate < expiration_text && expiration_text != "n/a"){
						var alertStyle = "style='display: block'";
					} else if (nowDate >= expiration_text && expiration_text != "n/a") {
						alertStyle = "style='display: none'";
					} else {
						alertStyle = "style='display: block'";
					}
					
					strToAppend = "<span " + alertStyle + ">" +
								"<h2>" + title_text + "</h2>" +
								"<p><em>" + date_text + "</em></p>" +
								"<p>" + description_text + "</p>" +
								"<div class='link-wrapper'><a href='" + url_text + "' target='_blank' class='button-silver'>Download PDF &raquo; <img src='images/icon-pdf.gif' alt='PDF'></a></div>" +
								"<div class='rule'></div>" +
								"</span>";
										
					$('#news-items').append(strToAppend);
						 
				}); //close each(
			} //close success:			
		}); //close $.ajax(
		
	} //close if
	/*****/
	
	
	/*** entire us site, pyramis news in the accordion, single item ***/
	if (section == "news_accordion"){
			
		$.ajax({
			type: "GET",
			url: "xml/exp_acc_pyramis_news.xml",
			dataType: "xml",
			success: function(xml) {
				
				$(xml).find('Expiration_Item').each(function(){
					
					var title_text = $(this).find('Title').text();
					var date_text = $(this).find('Display_Date').text();
					var description_text = $(this).find('Description').text();
					var url_text = $(this).find('URL').text();
					var expiration_text = $(this).find('Expiration_Date').text();
												
					if (nowDate < expiration_text && expiration_text != "n/a"){
						var alertStyle = "style='display: block'";
					} else if (nowDate >= expiration_text && expiration_text != "n/a") {
						alertStyle = "style='display: none'";
					} else {
						alertStyle = "style='display: block'";
					}
					
					strToAppend = "<span " + alertStyle + ">" +
								"<h2>" + title_text + "</h2>" +
								"<p><em>" + date_text + "</em></p><br>" +
								"<p>" + description_text + "</p><br>" +
								// "<div class='link-wrapper'><a href='" + url_text + "' target='_blank' class='button-silver'>Download PDF &raquo; <img src='images/icon-pdf.gif' alt='PDF'></a></div>" +
								"<div class='link-wrapper'><a href='" + url_text + "' target='_blank' class='button-silver'>View webcast &raquo; </a></div>" +
								
								"</span>";
										
					$('#news-acc-items').append(strToAppend);
						 
				}); //close each(
			} //close success:			
		}); //close $.ajax(
		
	} //close if
	/*****/
	
	
	
	/*** EQUITY - Insights & Events ***/
	if (section == "equity-insights-events"){
				
		$.ajax({
			type: "GET",
			url: "xml/exp_equity_insights_events.xml",
			dataType: "xml",
			success: function(xml) {
				
				/* count the number of records so we can do a different style for the last item (no divider line) */
				x = 0;
				total = $(xml).find('Expiration_Item').length;
									
				$(xml).find('Expiration_Item').each(function(){
					
					var title_text = $(this).find('Title').text();
					var date_text = $(this).find('Display_Date').text();
					var description_text = $(this).find('Description').text();
					var url_text = $(this).find('URL').text();
					var expiration_text = $(this).find('Expiration_Date').text();
					var format_text = $(this).find('Format').text();
					
					/* set the HTML to display or not based on exp date */
					if (nowDate < expiration_text && expiration_text != "n/a"){
						var alertStyle = "style='display: inline-block'";
					} else if (nowDate >= expiration_text && expiration_text != "n/a") {
						alertStyle = "style='display: none'";
					} else {
						alertStyle = "style='display: block'";
					}
					
					/* 1 - chose which icon to show with what 'alt' text for that image */
					/* 2 - choose link format from whitepaper, newsletter, or webcast */
					if (format_text == "White Paper") {
						var format = "icon-whitepaper.jpg";
						var formatAlt = "whitepaper";
						var formatLink = "<a href='" + url_text + "' target='_blank' class='button-silver'>Download PDF &raquo; <img src='images/icon-pdf.gif' alt='PDF'></a>";
					}
					if (format_text == "Webcast") {
						format = "icon-webcast.jpg";
						formatAlt = "webcast";
						formatLink = "<a href='" + url_text + "' class='button-silver'>View this webcast &raquo;</a>";
					}
					if (format_text == "Newsletter") {
						format = "icon-newsletter.jpg";
						formatAlt = "newsletter";
						formatLink = "<a href='" + url_text + "' target='_blank' class='button-silver'>Download PDF &raquo; <img src='images/icon-pdf.gif' alt='PDF'></a>";
					}	
					
					
					/* build the HTML string */
					
					x += 1;
					
					strToAppend = "<span " + alertStyle + ">" +
								"<img class='img-left' src='images/" + format + "' alt='" + formatAlt + "'>" + 
								"<h2>" + title_text + "</h2>" +
								"<p><em>" + date_text + "</em></p>" +
								"<br>" +
								"<p>" + description_text + "</p>" +
								"<br>" +
								"<div class='link-wrapper'>" + formatLink + "</div>";	
								
					/* apply a different style to the last item only: get rid of divider line */
					if (x < total){
						strToAppend += "<div class='rule'></div>" +
								"</span>";
					}
					if (x == total){
						strToAppend += "</span>";
					}
					
					/* take the entire string and add it to the div on the page */
					$('#exp-equity-insights-events').append(strToAppend);
						 
				}); //close each(
			} //close success:			
		}); //close $.ajax(
		
	} //close if
	/*****/



	/*** FIXED INCOME - Insights & Events ***/
	if (section == "fixed-income-insights-events"){
				
		$.ajax({
			type: "GET",
			url: "xml/exp_fixed_income_insights_events.xml",
			dataType: "xml",
			success: function(xml) {
				
				/* count the number of records so we can do a different style for the last item (no divider line) */
				x = 0;
				total = $(xml).find('Expiration_Item').length;
									
				$(xml).find('Expiration_Item').each(function(){
					
					var title_text = $(this).find('Title').text();
					var date_text = $(this).find('Display_Date').text();
					var description_text = $(this).find('Description').text();
					var url_text = $(this).find('URL').text();
					var expiration_text = $(this).find('Expiration_Date').text();
					var format_text = $(this).find('Format').text();
					
					/* set the HTML to display or not based on exp date */
					if (nowDate < expiration_text && expiration_text != "n/a"){
						var alertStyle = "style='display: inline-block'";
					} else if (nowDate >= expiration_text && expiration_text != "n/a") {
						alertStyle = "style='display: none'";
					} else {
						alertStyle = "style='display: block'";
					}
					
					/* 1 - chose which icon to show with what 'alt' text for that image */
					/* 2 - choose link format from whitepaper, newsletter, or webcast */
					if (format_text == "White Paper") {
						var format = "icon-whitepaper.jpg";
						var formatAlt = "whitepaper";
						var formatLink = "<a href='" + url_text + "' target='_blank' class='button-silver'>Download PDF &raquo; <img src='images/icon-pdf.gif' alt='PDF'></a>";
					}
					if (format_text == "Webcast") {
						format = "icon-webcast.jpg";
						formatAlt = "webcast";
						formatLink = "<a href='" + url_text + "' class='button-silver'>View this webcast &raquo;</a>";
					}
					if (format_text == "Newsletter") {
						format = "icon-newsletter.jpg";
						formatAlt = "newsletter";
						formatLink = "<a href='" + url_text + "' target='_blank' class='button-silver'>Download PDF &raquo; <img src='images/icon-pdf.gif' alt='PDF'></a>";
					}	
					
					
					/* build the HTML string */
					
					x += 1;
					
					strToAppend = "<span " + alertStyle + ">" +
								"<img class='img-left' src='images/" + format + "' alt='" + formatAlt + "'>" + 
								"<h2>" + title_text + "</h2>" +
								"<p><em>" + date_text + "</em></p>" +
								"<br>" +
								"<p>" + description_text + "</p>" +
								"<br>" +
								"<div class='link-wrapper'>" + formatLink + "</div>";
								
					/* apply a different style to the last item only: get rid of divider line */
					if (x < total){
						strToAppend += "<div class='rule'></div>" +
								"</span>";
					}
					if (x == total){
						strToAppend += "</span>";
					}					
					
					/* take the entire string and add it to the div on the page */
					$('#exp-fixed-income-insights-events').append(strToAppend);
						 
				}); //close each(
			} //close success:			
		}); //close $.ajax(
		
	} //close if
	/*****/



	/*** ASSET ALLOCATION - Insights & Events ***/
	if (section == "asset-alloc-insights-events"){
				
		$.ajax({
			type: "GET",
			url: "xml/exp_asset_alloc_insights_events.xml",
			dataType: "xml",
			success: function(xml) {
				
				/* count the number of records so we can do a different style for the last item (no divider line) */
				x = 0;
				total = $(xml).find('Expiration_Item').length;
									
				$(xml).find('Expiration_Item').each(function(){
					
					var title_text = $(this).find('Title').text();
					var date_text = $(this).find('Display_Date').text();
					var description_text = $(this).find('Description').text();
					var url_text = $(this).find('URL').text();
					var expiration_text = $(this).find('Expiration_Date').text();
					var format_text = $(this).find('Format').text();
					
					/* set the HTML to display or not based on exp date */
					if (nowDate < expiration_text && expiration_text != "n/a"){
						var alertStyle = "style='display: inline-block'";
					} else if (nowDate >= expiration_text && expiration_text != "n/a") {
						alertStyle = "style='display: none'";
					} else {
						alertStyle = "style='display: block'";
					}
					
					/* 1 - chose which icon to show with what 'alt' text for that image */
					/* 2 - choose link format from whitepaper, newsletter, or webcast */
					if (format_text == "White Paper") {
						var format = "icon-whitepaper.jpg";
						var formatAlt = "whitepaper";
						var formatLink = "<a href='" + url_text + "' target='_blank' class='button-silver'>Download PDF &raquo; <img src='images/icon-pdf.gif' alt='PDF'></a>";
					}
					if (format_text == "Webcast") {
						format = "icon-webcast.jpg";
						formatAlt = "webcast";
						formatLink = "<a href='" + url_text + "' class='button-silver'>View this webcast &raquo;</a>";
					}
					if (format_text == "Newsletter") {
						format = "icon-newsletter.jpg";
						formatAlt = "newsletter";
						formatLink = "<a href='" + url_text + "' target='_blank' class='button-silver'>Download PDF &raquo; <img src='images/icon-pdf.gif' alt='PDF'></a>";
					}	
					
					
					/* build the HTML string */
					
					x += 1;
					
					strToAppend = "<span " + alertStyle + ">" +
								"<img class='img-left' src='images/" + format + "' alt='" + formatAlt + "'>" + 
								"<h2>" + title_text + "</h2>" +
								"<p><em>" + date_text + "</em></p>" +
								"<br>" +
								"<p>" + description_text + "</p>" +
								"<br>" +
								"<div class='link-wrapper'>" + formatLink + "</div>";
								
					/* apply a different style to the last item only: get rid of divider line */
					if (x < total){
						strToAppend += "<div class='rule'></div>" +
								"</span>";
					}
					if (x == total){
						strToAppend += "</span>";
					}					
					
					/* take the entire string and add it to the div on the page */
					$('#exp-asset-alloc-insights-events').append(strToAppend);
						 
				}); //close each(
			} //close success:			
		}); //close $.ajax(
		
	} //close if
	/*****/

	
	
	/*** ALTERNATIVES - Insights & Events ***/
	if (section == "alternatives-insights-events"){
				
		$.ajax({
			type: "GET",
			url: "xml/exp_alternatives_insights_events.xml",
			dataType: "xml",
			success: function(xml) {
				
				/* count the number of records so we can do a different style for the last item (no divider line) */
				x = 0;
				total = $(xml).find('Expiration_Item').length;
									
				$(xml).find('Expiration_Item').each(function(){
					
					var title_text = $(this).find('Title').text();
					var date_text = $(this).find('Display_Date').text();
					var description_text = $(this).find('Description').text();
					var url_text = $(this).find('URL').text();
					var expiration_text = $(this).find('Expiration_Date').text();
					var format_text = $(this).find('Format').text();
					
					/* set the HTML to display or not based on exp date */
					if (nowDate < expiration_text && expiration_text != "n/a"){
						var alertStyle = "style='display: inline-block'";
					} else if (nowDate >= expiration_text && expiration_text != "n/a") {
						alertStyle = "style='display: none'";
					} else {
						alertStyle = "style='display: block'";
					}
					
					/* 1 - chose which icon to show with what 'alt' text for that image */
					/* 2 - choose link format from whitepaper, newsletter, or webcast */
					if (format_text == "White Paper") {
						var format = "icon-whitepaper.jpg";
						var formatAlt = "whitepaper";
						var formatLink = "<a href='" + url_text + "' target='_blank' class='button-silver'>Download PDF &raquo; <img src='images/icon-pdf.gif' alt='PDF'></a>";
					}
					if (format_text == "Webcast") {
						format = "icon-webcast.jpg";
						formatAlt = "webcast";
						formatLink = "<a href='" + url_text + "' class='button-silver'>View this webcast &raquo;</a>";
					}
					if (format_text == "Newsletter") {
						format = "icon-newsletter.jpg";
						formatAlt = "newsletter";
						formatLink = "<a href='" + url_text + "' target='_blank' class='button-silver'>Download PDF &raquo; <img src='images/icon-pdf.gif' alt='PDF'></a>";
					}	
					
					
					/* build the HTML string */
					
					x += 1;
					
					strToAppend = "<span " + alertStyle + ">" +
								"<img class='img-left' src='images/" + format + "' alt='" + formatAlt + "'>" + 
								"<h2>" + title_text + "</h2>" +
								"<p><em>" + date_text + "</em></p>" +
								"<br>" +
								"<p>" + description_text + "</p>" +
								"<br>" +
								"<div class='link-wrapper'>" + formatLink + "</div>";
								
					/* apply a different style to the last item only: get rid of divider line */
					if (x < total){
						strToAppend += "<div class='rule'></div>" +
								"</span>";
					}
					if (x == total){
						strToAppend += "</span>";
					}					
					
					/* take the entire string and add it to the div on the page */
					$('#exp-alternatives-insights-events').append(strToAppend);
						 
				}); //close each(
			} //close success:			
		}); //close $.ajax(
		
	} //close if
	/*****/
	
	
	/*** MARKET INSIGHTS / Newsletters ***/	
	if (section == "market_insights_newsletters"){
		
		$.ajax({
			type: "GET",
			url: "xml/exp_market_insights_newsletters.xml",
			dataType: "xml",
			success: function(xml) {
				
				/* count the number of records so we can do a different style for the last item (no divider line) */
				x = 0;
				total = $(xml).find('Expiration_Item').length;

				$(xml).find('Expiration_Item').each(function(){
					
					var title_text = $(this).find('Title').text();
					var date_text = $(this).find('Display_Date').text();
					var description_text = $(this).find('Description').text();
					var url_text = $(this).find('URL').text();
					var expiration_text = $(this).find('Expiration_Date').text();
					var format_text = $(this).find('Format').text();
					
					/* set the HTML to display or not based on exp date */
					if (nowDate < expiration_text && expiration_text != "n/a"){
						var alertStyle = "style='display: block'";
					} else if (nowDate >= expiration_text && expiration_text != "n/a") {
						alertStyle = "style='display: none'";
					} else {
						alertStyle = "style='display: block'";
					}
					
					var formatLink = "<a href='" + url_text + "' target='_blank' class='button-silver'>Download PDF &raquo; <img src='images/icon-pdf.gif' alt='PDF'></a>";
					
					/* build the HTML string */
					
					x += 1;
					
					strToAppend = "<span " + alertStyle + ">" +
								"<h2>" + title_text + "</h2>" +
								"<p><em>" + date_text + "</em></p>" +
								"<p>" + description_text + "</p>" +
								"<div class='link-wrapper'>" + formatLink + "</div>";
									
					/* apply a different style to the last item only: get rid of divider line */
					if (x < total){
						strToAppend += "<div class='rule'></div>" +
								"</span>";
					}
					if (x == total){
						strToAppend += "</span>";
					}		
										
					$('#exp-market-insights-newsletters').append(strToAppend);
						 
				}); //close each(
			} //close success:			
		}); //close $.ajax(
		
	} //close if
	/*****/

	
	/*** NEWS ***/	
	if (section == "pyramis_news"){
		
		$.ajax({
			type: "GET",
			url: "xml/exp_pyramis_news.xml",
			dataType: "xml",
			success: function(xml) {
				
				/* count the number of records so we can do a different style for the last item (no divider line) */
				x = 0;
				total = $(xml).find('Expiration_Item').length;

				$(xml).find('Expiration_Item').each(function(){
					
					var title_text = $(this).find('Title').text();
					var date_text = $(this).find('Display_Date').text();
					var description_text = $(this).find('Description').text();
					var url_text = $(this).find('URL').text();
					var expiration_text = $(this).find('Expiration_Date').text();
					var format_text = $(this).find('Format').text();
					
					/* set the HTML to display or not based on exp date */
					if (nowDate < expiration_text && expiration_text != "n/a"){
						var alertStyle = "style='display: block'";
					} else if (nowDate >= expiration_text && expiration_text != "n/a") {
						alertStyle = "style='display: none'";
					} else {
						alertStyle = "style='display: block'";
					}
					
					var formatLink = "<a href='" + url_text + "' target='_blank' class='button-silver'>Download PDF &raquo; <img src='images/icon-pdf.gif' alt='PDF'></a>";
					
					/* build the HTML string */
					
					x += 1;
					
					strToAppend = "<span " + alertStyle + ">" +
								"<h2>" + title_text + "</h2>" +
								"<p><em>" + date_text + "</em></p>" +
								"<p>" + description_text + "</p>" +
								"<div class='link-wrapper'>" + formatLink + "</div>";
									
					/* apply a different style to the last item only: get rid of divider line */
					if (x < total){
						strToAppend += "<div class='rule'></div>" +
								"</span>";
					}
					if (x == total){
						strToAppend += "</span>";
					}		
										
					$('#exp-pyramis-news').append(strToAppend);
						 
				}); //close each(
			} //close success:			
		}); //close $.ajax(
		
	} //close if
	/*****/




	/*** MARKET INSIGHTS - WHITE PAPERS ***/	
	if (section == "market_insights_whitepapers"){

			$.get('xml/exp_market_insights_whitepapers.xml', function(xml){ 
						
				var miwp = $.xml2json(xml); 

				/* count the number of records processed so we can do a different style for the last item (no divider line) */
				x = 0;
				total = miwp.Expiration_Item.length; // find number of records
				
				/* track total count of items in categories */
				var count_E = 0;
				var count_ALT = 0;
				var count_FI = 0;
				var count_AA = 0;
				var count_PPA = 0;
				var count_RM = 0;
				var count_DB = 0;
				var count_EFR = 0;
				var count_EU = 0;
				
				var strToAppend_E = "";
				var strToAppend_ALT = "";
				var strToAppend_FI = "";
				var strToAppend_AA = "";
				var strToAppend_PPA = "";
				var strToAppend_RM = "";
				var strToAppend_DB = "";
				var strToAppend_EFR = "";
				var strToAppend_EU = "";
				
				var backToTop = "<div class='back-to-top'><p>[ <a href='#tabs-2' class='back-to-top'>back to top</a> ]</p></div>";
				var msgNoResearch = "<p><em>No available research at this time</em></p><br>";
				var msgArray = new Array('E',
										 'ALT',
										 'FI',
										 'AA',
										 'PPA',
										 'RM',
										 'DB',
										 'EFR',
										 'EU');

				$.each(miwp.Expiration_Item, function(i, Expiration_Item){
					
					var basicFormat = "";
					var formatLink = "";

					var title_text = Expiration_Item.Title;
					var date_text = Expiration_Item.Display_Date;
					var description_text = Expiration_Item.Description;
					var url_text = Expiration_Item.URL;
					var expiration_text = Expiration_Item.Expiration_Date;
					var format_text = Expiration_Item.Format;
					var category_text = Expiration_Item.Category;
					
					x += 1; //count this record
					
					formatLink = "<a href='" + url_text + "' target='_blank' class='button-silver'>Download PDF &raquo; <img src='images/icon-pdf.gif' alt='PDF'></a>";
					
					/* build the HTML string  if the item is not expired */
					/* current categories are: Equity, Market Neutral, Fixed Income, Lifecycle
												PPA, Risk Management, Defined Benefit */
					if (expiration_text > nowDate) {
						
						basicFormat = 	"<h2>" + title_text + "</h2>" + "<p><em>" + date_text + "</em></p>" + "<p>" + description_text + "</p>" + "<div class='link-wrapper'>" + formatLink + "</div>" + "<div class='spacer-20'></div>";
					
						
						if (category_text == "Equity") {
							strToAppend_E += basicFormat;
							count_E += 1;
						} 
							
						if (category_text == "Alternatives") {
							strToAppend_ALT += basicFormat;
							count_ALT += 1;
						}
							
						if (category_text == "Fixed Income") {
							strToAppend_FI += basicFormat;		
							count_FI += 1;
						}
							
						if (category_text == "Asset Allocation") {
							strToAppend_AA += basicFormat;		
							count_AA += 1;
						}
							
						if (category_text == "PPA") {
							strToAppend_PPA += basicFormat;	
							count_PPA += 1;
						}
							
						if (category_text == "Risk Management") {
							strToAppend_RM += basicFormat;		
							count_RM += 1;
						}
							
						if (category_text == "Defined Benefit") {
							strToAppend_DB += basicFormat;		
							count_DB += 1;
						}
							
						if (category_text == "Endowment and Foundation Research") {
							strToAppend_EFR += basicFormat;		
							count_EFR += 1;
						}
						if (category_text == "Economic Updates") {
							strToAppend_EU += basicFormat;		
							count_EU += 1;
						}
					}
					
						
					/* at the end of xml file */
					if (x == total){
						/* at the end, if the count of a category is zero, display message */
				 		for(i=0;i<msgArray.length;i+=1){
				 			if (eval("count_" + msgArray[i]) === 0) {
								/*alert("there are no counts for " + msgArray[i]);*/
				 				eval("strToAppend_" + msgArray[i] + " += msgNoResearch");
				 			}	
				 		}
											
						/* at the end, apply a different style to the last item only: get rid of divider line */
						strToAppend_E += backToTop;
						strToAppend_ALT += backToTop;
						strToAppend_FI += backToTop;
						strToAppend_AA += backToTop;
						strToAppend_PPA += backToTop;
						strToAppend_RM += backToTop;
						strToAppend_DB += backToTop;
						strToAppend_EFR += backToTop;
						strToAppend_EU += backToTop;
										
						 $('#exp-whitepapers-e').append(strToAppend_E);
						 $('#exp-whitepapers-alt').append(strToAppend_ALT);
						 $('#exp-whitepapers-fi').append(strToAppend_FI);
						 $('#exp-whitepapers-aa').append(strToAppend_AA);
						 $('#exp-whitepapers-ppa').append(strToAppend_PPA);
						 $('#exp-whitepapers-rm').append(strToAppend_RM);
						 $('#exp-whitepapers-db').append(strToAppend_DB);
						 $('#exp-whitepapers-efr').append(strToAppend_EFR);
						 $('#exp-whitepapers-eu').append(strToAppend_EU);

					}

				}); //close each
				
			});//close $get

	} //close if
	/***** close MARKET INSIGHTS - WHITE PAPERS *****/
	
	
	
	/*** ldi white papers micro page @ http://pyramis.com/ldi-whitepapers ***/	
	if (section == "exp-campaign-ldi"){
		
		$.ajax({
			type: "GET",
			url: "../../xml/exp_campaign_ldi.xml",
			dataType: "xml",
			success: function(xml) {
									
				$(xml).find('Expiration_Item').each(function(){
					
					var title_text = $(this).find('Title').text();
					var date_text = $(this).find('Display_Date').text();
					var description_text = $(this).find('Description').text();
					var url_text = $(this).find('URL').text();
					var expiration_text = $(this).find('Expiration_Date').text();
						
					if (nowDate < expiration_text && expiration_text != "n/a"){
						var alertStyle = "style='display: block'";
					} else if (nowDate >= expiration_text && expiration_text != "n/a") {
						alertStyle = "style='display: none'";
					} else {
						alertStyle = "style='display: block'";
					}
					
					strToAppend = "<span " + alertStyle + ">" +
								"<h2>" + title_text + "</h2>" +
								"<p><em>" + date_text + "</em></p>" +
								"<p>" + description_text + "</p>" +
								"<div class='link-wrapper'><a href='" + url_text + "' target='_blank' class='button-silver'>Download PDF &raquo; <img src='../../images/icon-pdf.gif' alt='PDF'></a></div>" +
								"<div class='rule'></div>" +
								"</span>";
										
					$('#exp-campaign').append(strToAppend);
						 
				}); //close each(
			} //close success:			
		}); //close $.ajax(
		
	} //close if
	/*****/



	/*** db research micro page @ http://pyramis.com/pgadbfsheet ***/	
	if (section == "exp-db-research"){
		
		$.ajax({
			type: "GET",
			url: "../xml/exp_db_research.xml",
			dataType: "xml",
			error: function(fail) { 
				alert("Can't locate xml for " + section);
			},
			success: function(xml) {
									
				$(xml).find('Expiration_Item').each(function(){
					
					var title_text = $(this).find('Title').text();
					var date_text = $(this).find('Display_Date').text();
					var description_text = $(this).find('Description').text();
					var url_text = $(this).find('URL').text();
					var expiration_text = $(this).find('Expiration_Date').text();
					var format_text = $(this).find('Format').text();
						
					if (nowDate < expiration_text && expiration_text != "n/a"){
						var alertStyle = "style='display: block'";
					} else if (nowDate >= expiration_text && expiration_text != "n/a") {
						alertStyle = "style='display: none'";
					} else {
						alertStyle = "style='display: block'";
					}
					
					strToAppend = "<span " + alertStyle + ">" +
								"<h2>" + title_text + "</h2>" +
								"<p><em>" + date_text + "</em></p>" +
								"<p>" + description_text + "</p>" +
								"<div class='link-wrapper'><a href='" + url_text + "' target='_blank' class='button-silver'>Download PDF &raquo; <img src='../../images/icon-pdf.gif' alt='PDF'></a></div>" +
								"<div class='rule'></div>" +
								"</span>";
										
					$('#exp-db-research').append(strToAppend);
						 
				}); //close each(
			} //close success:			
		}); //close $.ajax(
		
	} //close if
	/*****/



/*** Campaign Defined Benefits ***/	
	if (section == "campaign_defined_benefits"){
		
		$.ajax({
			type: "GET",
			url: "../../xml/exp_campaign_defined_benefits.xml",
			dataType: "xml",
			success: function(xml) {
				
				/* count the number of records so we can do a different style for the last item (no divider line) */
				x = 0;
				total = $(xml).find('Expiration_Item').length;

				$(xml).find('Expiration_Item').each(function(){
					
					var title_text = $(this).find('Title').text();
					var date_text = $(this).find('Display_Date').text();
					var description_text = $(this).find('Description').text();
					var url_text = $(this).find('URL').text();
					var expiration_text = $(this).find('Expiration_Date').text();
					var format_text = $(this).find('Format').text();
					
					/* set the HTML to display or not based on exp date */
					if (nowDate < expiration_text && expiration_text != "n/a"){
						var alertStyle = "style='display: block'";
					} else if (nowDate >= expiration_text && expiration_text != "n/a") {
						alertStyle = "style='display: none'";
					} else {
						alertStyle = "style='display: block'";
					}
									
					if (format_text == "White Paper" || format_text == "Whitepaper"){
						buttonText = "Download PDF &raquo; <img src='../../images/icon-pdf.gif' alt='PDF'>";
					}
					
					if (format_text == "Webcast"){
						buttonText = "View this Webcast";
					}
										
					var formatLink = "<a href='" + url_text + "' target='_blank' class='button-silver'>" + buttonText + "</a>";
					
					/* build the HTML string */
					
					x += 1;
					
					strToAppend = "<span " + alertStyle + ">" +
								"<h2>" + title_text + "</h2>" +
								"<p><em>" + date_text + "</em></p>" +
								"<p>" + description_text + "</p>" +
								"<div class='link-wrapper'>" + formatLink + "</div>";
									
					/* apply a different style to the last item only: get rid of divider line */
					if (x < total){
						strToAppend += "<div class='rule'></div>" +
								"</span>";
					}
					if (x == total){
						strToAppend += "</span>";
					}		
										
					$('#exp-campaign').append(strToAppend);
						 
				}); //close each(
			} //close success:			
		}); //close $.ajax(
		
	} //close if
	/*****/




/*** Campaign Webcasts ***/	
	if (section == "campaign_webcasts"){
		
		$.ajax({
			type: "GET",
			url: "../../xml/exp_campaign_webcasts.xml",
			dataType: "xml",
			success: function(xml) {
				
				/* count the number of records so we can do a different style for the last item (no divider line) */
				x = 0;
				total = $(xml).find('Expiration_Item').length;

				$(xml).find('Expiration_Item').each(function(){
					
					var title_text = $(this).find('Title').text();
					var expiration_text = $(this).find('Expiration_Date').text();
					var date_text = $(this).find('Display_Date').text();
					var time_text = $(this).find('Time').text();
					var description_text = $(this).find('Description').text();
					var speaker_text = $(this).find('Speaker').text();
					var moderator_text = $(this).find('Moderator').text();
					var url_text = $(this).find('URL').text();			
					
					//alert("speaker_text: " + speaker_text);
					
					/* set the HTML to display or not based on exp date 
					if (nowDate < expiration_text && expiration_text != "n/a"){
						var alertStyle = "style='display: block'";
					} else if (nowDate >= expiration_text && expiration_text != "n/a") {
						alertStyle = "style='display: none'";
					} else {
						alertStyle = "style='display: block'";
					}*/
					
					if (nowDate < expiration_text && expiration_text != "n/a"){
						var alertStyle = "style='display: block'";
					} else if (nowDate >= expiration_text && expiration_text != "n/a") {
						alertStyle = "style='display: block'";
					} else {
						alertStyle = "style='display: block'";
					}
					
					/* NOTE: This URL thingee is only for as long as we use mailto: which is
					going away as soon as we get the new vendor with real URLs to real videos */
					url_text += "?subject=Webcast Registration for " + title_text;
					
					var formatLink = "<a href='" + url_text + "' target='_blank' class='button-silver'>Register &raquo;</a>";
					
					var backToTop = "<div class='back-to-top'><p>[ <a href='#' class='back-to-top'>back to top</a> ]</p></div>";

					/* build the HTML string */
					
					x += 1;
					
					strToAppendLinks = 	"<span " + alertStyle + ">" +
										"<ul class='standard-list'><li><a href='#" + x + "'>" + title_text + "</a></li></ul>";
								
					if (nowDate < expiration_text && expiration_text != "n/a"){
						if(speaker_text == "N/A") {
							strToAppend = 	"<span " + alertStyle + ">" +
											"<div class='campaign-col-1' id='" + x + "'>" + 
											"	<h2>" + date_text + "<br>" + time_text + "</h2>" +
											"	<div class='link-wrapper'>" + formatLink + "</div>" +
											"</div>" +
											"<div class='campaign-col-2'>" +
											"	<h2>" + title_text + "</h2>" +
											"	<p>" + description_text + "<br>" +
											//"	<strong>Speaker:</strong> " + speaker_text + "<br>" +
											"	<strong>Moderator:</strong> " + moderator_text + "</p>" +
											"	" + backToTop +
											"</div>";
						} else {
							strToAppend = 	"<span " + alertStyle + ">" +
											"<div class='campaign-col-1' id='" + x + "'>" + 
											"	<h2>" + date_text + "<br>" + time_text + "</h2>" +
											"	<div class='link-wrapper'>" + formatLink + "</div>" +
											"</div>" +
											"<div class='campaign-col-2'>" +
											"	<h2>" + title_text + "</h2>" +
											"	<p>" + description_text + "<br>" +
											"	<strong>Speaker:</strong> " + speaker_text + "<br>" +
											"	<strong>Moderator:</strong> " + moderator_text + "</p>" +
											"	" + backToTop +
											"</div>";
						}



					} else if (nowDate >= expiration_text && expiration_text != "n/a") {
						if(speaker_text == "N/A") {
							strToAppend = 	"<span " + alertStyle + ">" +
											"<div class='campaign-col-1' id='" + x + "'>" + 
											"	<h2>" + date_text + "</h2>" +
											"</div>" +
											"<div class='campaign-col-2'>" +
											"	<h2>" + title_text + "</h2>" +
											"	<p><strong>This webcast has occurred. Please visit the Market Insights page of Pyramis.com where recordings of webcasts are posted after reviews and approvals are complete.</strong></p>" +
											"	<p>" + description_text + "<br>" +
											"	<strong>Speaker:</strong> " + speaker_text + "<br>" +
											"	<strong>Moderator:</strong> " + moderator_text + "</p>" +
											"	" + backToTop +
											"</div>";
						} else {
							strToAppend = 	"<span " + alertStyle + ">" +
											"<div class='campaign-col-1' id='" + x + "'>" + 
											"	<h2>" + date_text + "</h2>" +
											"</div>" +
											"<div class='campaign-col-2'>" +
											"	<h2>" + title_text + "</h2>" +
											"	<p><strong>This webcast has occurred. Please visit the Market Insights page of Pyramis.com where recordings of webcasts are posted after reviews and approvals are complete.</strong></p>" +
											"	<p>" + description_text + "<br>" +
											"	<strong>Speaker:</strong> " + speaker_text + "<br>" +
											"	<strong>Moderator:</strong> " + moderator_text + "</p>" +
											"	" + backToTop +
											"</div>";
						}
					} 
												
					/* apply a different style to the last item only: get rid of divider line */
					if (x < total){
						strToAppend += "<div class='rule'></div><br></span>";
					}
					if (x == total){
						strToAppend += "</span>";
						strToAppendLinks += "<br><div class='rule'></div><br></span>";
					}		
										
					$('#exp-campaign-links').append(strToAppendLinks);
					$('#exp-campaign').append(strToAppend);
						 
				}); //close each(
			} //close success:			
		}); //close $.ajax(
		
	} //close if
	/*****/



	/*** Campaign - Pyramis Research ***/	
	if (section == "campaign_pyramis_research"){
		
		$.ajax({
			type: "GET",
			url: "../../xml/exp_campaign_pyramis_research.xml",
			dataType: "xml",
			success: function(xml) {
				
				/* count the number of records so we can do a different style for the last item (no divider line) */
				x = 0;
				total = $(xml).find('Expiration_Item').length;
				
				/* track total count of items in categories */
				count_DB = 0;
				count_EFR = 0;
				
				$(xml).find('Expiration_Item').each(function(){
					
					var title_text = $(this).find('Title').text();
					var date_text = $(this).find('Display_Date').text();
					var description_text = $(this).find('Description').text();
					var url_text = $(this).find('URL').text();
					var expiration_text = $(this).find('Expiration_Date').text();
					var format_text = $(this).find('Format').text();
					var category_text = $(this).find('Category').text();
					
					/* set the HTML to display or not based on exp date */
					if (nowDate < expiration_text && expiration_text != "n/a"){
						var alertStyle = "style='display: block'";
					} else if (nowDate >= expiration_text && expiration_text != "n/a") {
						alertStyle = "style='display: none'";
					} else {
						alertStyle = "style='display: block'";
					}
					
					if (format_text == "White Paper" || format_text == "Whitepaper"){
						buttonText = "Download PDF &raquo; <img src='../../images/icon-pdf.gif' alt='PDF'>";
					}
					
					if (format_text == "Webcast"){
						buttonText = "View this Webcast";
					}
										
					var formatLink = "<a href='" + url_text + "' target='_blank' class='button-silver'>" + buttonText + "</a>";
					
					var backToTop = "<div class='back-to-top'><p>[ <a href='#' class='back-to-top'>back to top</a> ]</p></div>";
					
					/* build the HTML string */
					/* current categories are: Equity, Market Neutral, Fixed Income, Lifecycle
												PPA, Risk Management, Defined Benefit */
					
					x += 1;
					
					strToAppend_DB = "";
					strToAppend_EFR = "";
										
					basicFormat = 	"<span " + alertStyle + ">" +
									"<h2>" + title_text + "</h2>" +
									"<p><em>" + date_text + "</em></p>" +
									"<p>" + description_text + "</p>" +
									"<div class='link-wrapper'>" + formatLink + "</div>" +
									"<div class='spacer-20'></div>";
	
					if (category_text == "Defined Benefit") {
						strToAppend_DB += basicFormat;		
						count_DB += 1;
					}
					
					if (category_text == "Endowment and Foundation Research") {
						strToAppend_EFR += basicFormat;		
						count_EFR += 1;
					}
					
					/* at the end, if the count of a category is zero, display message */

					var msgNoResearch = "<p><em>No available research at this time</em></p><br>";
					
					var msgArray = new Array('DB',
											 'EFR');
					
					if (x == total){
	
						for(i=0;i<msgArray.length;i+=1){
						
							if (eval("count_" + msgArray[i]) === 0) {
								eval("strToAppend_" + msgArray[i] + " += msgNoResearch");
							}	
							
						}
						
					}
									
					
					/* at the end, apply a different style to the last item only: get rid of divider line */
					
					if (x == total){
						strToAppend_DB += backToTop;
						strToAppend_EFR += backToTop;
					}		
										
					$('#exp-whitepapers-db').append(strToAppend_DB);
					$('#exp-whitepapers-efr').append(strToAppend_EFR);
						 
				}); //close each(
			} //close success:			
		}); //close $.ajax(
		
	} //close if
	/***** close SECTION *****/


	/*** CAMPAIGN - QUARTERLY CONSULTANT UPDATE ***/	
	if (section == "consultant_update"){

			$.get('../../xml/exp_campaign_consultant.xml', function(xml){ 
						
				var miwp = $.xml2json(xml); 

				/* count the number of records processed so we can do a different style for the last item (no divider line) */
				x = 0;
				total = miwp.Expiration_Item.length; // find number of records
				
				/* track total count of items in categories */
				var count_webcast = 0;
				var count_whitepaper = 0;
				var count_newsletter = 0;
				var count_performance = 1;
				var count_economic_update = 0;
				
				var strToAppend_webcast = "";
				var strToAppend_whitepaper = "";
				var strToAppend_newsletter = "";
				var strToAppend_performance = "";
				var strToAppend_economic_update = "";

				
				var backToTop = "<div class='back-to-top'><p>[ <a href='#'>back to top</a> ]</p></div>";
				var msgNoResearch = "<p><em>No available research at this time</em></p><br>";
				var msgArray = new Array('webcast',
										 'whitepaper',
										 'newsletter',
										 'performance',
										 'economic_update');

				$.each(miwp.Expiration_Item, function(i, Expiration_Item){
					
					var basicFormat = "";
					var formatLink = "";

					var title_text = Expiration_Item.Title;
					var date_text = Expiration_Item.Display_Date;
					var description_text = Expiration_Item.Description;
					var url_text = Expiration_Item.URL;
					var expiration_text = Expiration_Item.Expiration_Date;
					var format_text = Expiration_Item.Format;
					var section_text = Expiration_Item.Section;
										
					x += 1; //count this record
					
					formatLink 					= "<a href='" + url_text + "' target='_blank' class='button-silver'>Download PDF &raquo; <img src='../../images/icon-pdf.gif' alt='PDF'></a>";
					formatLink_webcast 			= "<a href='" + url_text + "' target='_blank' class='button-silver'>View Webcast</a>";
					formatLink_performance 		= "<a href='" + url_text + "' target='_blank'>" + title_text + "</a>";
					formatLink_performance_exp 	= "<span class='expired'>" + title_text + "</span>";

					
					image_webcast			= '<img class="image-acc" alt="webcast" src="../../images/icon-webcast.jpg">';
					image_whitepaper		= '<img class="image-acc" alt="whitepaper" src="../../images/icon-whitepaper.jpg">';
					image_newsletter		= '<img class="image-acc" alt="newsletter" src="../../images/icon-newsletter.jpg">';
					image_economic_update	= '<img class="image-acc" alt="economic_update" src="../../images/icon-economic-update.jpg">';

					
					/* build the HTML string  if the item is not expired */
					/* current categories are: Equity, Market Neutral, Fixed Income, Lifecycle
												PPA, Risk Management, Defined Benefit */
					if (expiration_text > nowDate) {
						
						basicFormat 			= 	"<div class='text-indent'><h4>" + title_text + "</h4>" + "<p><p>" + description_text + "</p>" + "<div class='link-wrapper'>" + formatLink + "</div></div>" + "<div class='rule'></div>";
						basicFormat_webcast 	= 	"<div class='text-indent'><h4>" + title_text + "</h4>" + "<p><p>" + description_text + "</p>" + "<div class='link-wrapper'>" + formatLink_webcast + "</div></div>" + "<div class='rule'></div>";
				
						if (section_text == "Webcast") {
							strToAppend_webcast += image_webcast + basicFormat_webcast;
							count_webcast += 1;
						} 
							
						if (section_text == "Whitepaper") {
							strToAppend_whitepaper += image_whitepaper + basicFormat;
							count_whitepaper += 1;
						}
							
						if (section_text == "Newsletter") {
							strToAppend_newsletter += image_newsletter + basicFormat;		
							count_newsletter += 1;
						}
							
						if (section_text == "Performance Review") {
							strToAppend_performance = formatLink_performance;		
							count_performance += 1;
						}
						
						if (section_text == "Economic Update") {
							strToAppend_economic_update += image_economic_update + basicFormat;		
							count_economic_update += 1;
						}
							
					}
					
					if (expiration_text <= nowDate) {
							
						if (section_text == "Performance Review") {
							strToAppend_performance = formatLink_performance_exp;		
							count_performance += 1;
						}
							
					}
					
						
					/* at the end of xml file */
					if (x == total){
						
						/* at the end, if the count of a category is zero, display message */
				 		for(i=0;i<msgArray.length;i+=1){
				 			if (eval("count_" + msgArray[i]) === 0) {
								/*alert("there are no counts for " + msgArray[i]);*/
				 				eval("strToAppend_" + msgArray[i] + " += msgNoResearch");
				 			}	
				 		}
											
						/* at the end, apply a different style to the last item only: get rid of divider line */
						strToAppend_webcast += backToTop;
						strToAppend_whitepaper += backToTop;
						strToAppend_newsletter += backToTop;
						strToAppend_economic_update += backToTop;

										
						$('#exp-campaign-webcast').append(strToAppend_webcast);
						$('#exp-campaign-whitepaper').append(strToAppend_whitepaper);
						$('#exp-campaign-newsletter').append(strToAppend_newsletter);
						$('#exp-campaign-performance').append(strToAppend_performance);
						$('#exp-campaign-economic-update').append(strToAppend_economic_update);

					}

				}); //close each
				
			});//close $get

	} //close if
	/***** close MARKET INSIGHTS - WHITE PAPERS *****/




	/*** CAMPAIGN - QUARTERLY MARKET INSIGHTS ***/	
	if (section == "quarterly_market_insights"){
		
			$.get('../../xml/exp_campaign_quarterly_market_insights.xml', function(xml){ 
						
				var xmlItems = $.xml2json(xml); 

				/* count the number of records processed so we can do a different style for the last item (no divider line) */
				x = 0;
				total = xmlItems.Expiration_Item.length; // find number of records
				
				/* track total count of items in categories */
				var count_webcast = 0;
				var count_whitepaper = 0;
				var count_newsletter = 0;
				var count_economic_update = 0;
								
				var strToAppend_webcast = "";
				var strToAppend_whitepaper = "";
				var strToAppend_newsletter = "";
				var strToAppend_economic_update = "";
				
				var backToTop = "<div class='back-to-top'><p>[ <a href='#'>back to top</a> ]</p></div>";
				var msgNoResearch = "<p><em>No available research at this time</em></p><br>";
				var msgArray = new Array('webcast',
										 'whitepaper',
										 'newsletter',
										 'economic_update');

				$.each(xmlItems.Expiration_Item, function(i, Expiration_Item){
					
					var basicFormat = "";
					var formatLink = "";

					var title_text = Expiration_Item.Title;
					var date_text = Expiration_Item.Display_Date;
					var description_text = Expiration_Item.Description;
					var url_text = Expiration_Item.URL;
					var expiration_text = Expiration_Item.Expiration_Date;
					var section_text = Expiration_Item.Section;
										
					x += 1; //count this record
					
					formatLink 					= "<a href='" + url_text + "' target='_blank' class='button-silver'>Download PDF &raquo; <img src='../../images/icon-pdf.gif' alt='PDF'></a>";
					formatLink_webcast 			= "<a href='" + url_text + "' target='_blank' class='button-silver'>View Webcast</a>";
					
					image_webcast			= '<img class="image-acc" alt="webcast" src="../../images/icon-webcast.jpg">';
					image_whitepaper		= '<img class="image-acc" alt="whitepaper" src="../../images/icon-whitepaper.jpg">';
					image_newsletter		= '<img class="image-acc" alt="newsletter" src="../../images/icon-newsletter.jpg">';
					image_economic_update	= '<img class="image-acc" alt="economic_update" src="../../images/icon-economic-update.jpg">';
					
					/* build the HTML string  if the item is not expired */
					if (expiration_text > nowDate) {
						
						basicFormat 			= 	"<div class='text-indent'><h4>" + title_text + "</h4>" + "<p><p>" + description_text + "</p>" + "<div class='link-wrapper'>" + formatLink + "</div></div>" + "<div class='rule'></div>";
						basicFormat_webcast 	= 	"<div class='text-indent'><h4>" + title_text + "</h4>" + "<p><p>" + description_text + "</p>" + "<div class='link-wrapper'>" + formatLink_webcast + "</div></div>" + "<div class='rule'></div>";
				
						if (section_text == "Webcast") {
							strToAppend_webcast += image_webcast + basicFormat_webcast;
							count_webcast += 1;
						} 
							
						if (section_text == "Whitepaper") {
							strToAppend_whitepaper += image_whitepaper + basicFormat;
							count_whitepaper += 1;
						}
							
						if (section_text == "Newsletter") {
							strToAppend_newsletter += image_newsletter + basicFormat;		
							count_newsletter += 1;
						}
							
						if (section_text == "Economic Update") {
							strToAppend_economic_update += image_economic_update + basicFormat;		
							count_economic_update += 1;
						}
							
					}
					

					
						
					/* at the end of xml file */
					if (x == total){
						
						/* at the end, if the count of a category is zero, display message */
				 		for(i=0;i<msgArray.length;i+=1){
				 			if (eval("count_" + msgArray[i]) === 0) {
								/*alert("there are no counts for " + msgArray[i]);*/
				 				eval("strToAppend_" + msgArray[i] + " += msgNoResearch");
				 			}	
				 		}
											
						/* at the end, apply a different style to the last item only: get rid of divider line */
						strToAppend_webcast += backToTop;
						strToAppend_whitepaper += backToTop;
						strToAppend_newsletter += backToTop;
						strToAppend_economic_update += backToTop;

										
						$('#exp-campaign-webcast').append(strToAppend_webcast);
						$('#exp-campaign-whitepaper').append(strToAppend_whitepaper);
						$('#exp-campaign-newsletter').append(strToAppend_newsletter);
						$('#exp-campaign-economic-update').append(strToAppend_economic_update);

					}

				}); //close each
				
			});//close $get

	} //close if
	/***** close CAMPAIGN - QUARTERLY MARKET INSIGHTS *****/

	/*** db research version 2 micro page @ http://pyramis.com/campaigns/dbresearch_v2 ***/	
	if (section == "exp-campaign-db-v2"){
		
			$.get('../../xml/exp_campaign_db_v2.xml', function(xml){ 
						
				var xmlItems = $.xml2json(xml); 

				/* count the number of records processed so we can do a different style for the last item (no divider line) */
				x = 0;
				total = xmlItems.Expiration_Item.length; // find number of records
				
				/* track total count of items in categories */
				var count_webcast = 0;
				var count_overview = 0;
				var count_press = 0;
				var count_article = 0;
								
				var strToAppend_webcast = "";
				var strToAppend_overview = "";
				var strToAppend_press = "";
				var strToAppend_article = "";
				
				var backToTop = "<div class='back-to-top'><p>[ <a href='#'>back to top</a> ]</p></div>";
				var msgNoResearch = "<p><em>No available research at this time</em></p><br>";
				var msgArray = new Array('webcast',
										 'overview',
										 'press',
										 'article');

				$.each(xmlItems.Expiration_Item, function(i, Expiration_Item){
					
					var basicFormat = "";
					var formatLink = "";

					var title_text = Expiration_Item.Title;
					var date_text = Expiration_Item.Display_Date;
					var description_text = Expiration_Item.Description;
					var url_text = Expiration_Item.URL;
					var expiration_text = Expiration_Item.Expiration_Date;
					var section_text = Expiration_Item.Section;
					//alert("Section: " + section_text);					
					x += 1; //count this record
					
					formatLink 					= "<a href='" + url_text + "' target='_blank' class='button-silver'>Download PDF &raquo; <img src='../../images/icon-pdf.gif' alt='PDF'></a>";
					formatLink_webcast 			= "<a href='" + url_text + "' target='_blank' class='button-silver'>View Webcast</a>";
					
					image_webcast			= '<img class="image-acc" alt="webcast" src="../../images/icon-webcast.jpg">';
					image_overview		= '<img class="image-acc" alt="whitepaper" src="../../images/icon-whitepaper.jpg">';
					image_press	= '<img class="image-acc" alt="economic_update" src="../../images/icon-economic-update.jpg">';
					image_article	= '<img class="image-acc" alt="whitepaper" src="../../images/icon-whitepaper.jpg">';
					
					/* build the HTML string  if the item is not expired */
					if (expiration_text > nowDate) {
						
						basicFormat 			= 	"<div class='text-indent'><h4>" + title_text + "</h4>" + "<p><p>" + description_text + "</p>" + "<div class='link-wrapper'>" + formatLink + "</div></div>" + "<div class='rule'></div>";
						basicFormat_webcast 	= 	"<div class='text-indent'><h4>" + title_text + "</h4>" + "<p><p>" + description_text + "</p>" + "<div class='link-wrapper'>" + formatLink_webcast + "</div></div>" + "<div class='rule'></div>";
				
						if (section_text == "Webcast") {
							strToAppend_webcast += image_webcast + basicFormat_webcast;
							count_webcast += 1;
						} 
							
						if (section_text == "Overview") {
							strToAppend_overview += image_overview + basicFormat;
							count_overview += 1;
						}
							
							
						if (section_text == "Press") {
							strToAppend_press += image_press + basicFormat;		
							count_press += 1;
						}
						
						if (section_text == "Article") {
							//alert("found article");
							strToAppend_article += image_article + basicFormat;		
							count_article += 1;
						}
							
					}
					

					
						
					/* at the end of xml file */
					if (x == total){
						
						/* at the end, if the count of a category is zero, display message */
				 		for(i=0;i<msgArray.length;i+=1){
				 			if (eval("count_" + msgArray[i]) === 0) {
								/*alert("there are no counts for " + msgArray[i]);*/
				 				eval("strToAppend_" + msgArray[i] + " += msgNoResearch");
				 			}	
				 		}
											
						/* at the end, apply a different style to the last item only: get rid of divider line */
						strToAppend_webcast += backToTop;
						strToAppend_overview += backToTop;
						strToAppend_press += backToTop;
						strToAppend_article += backToTop;

										
						$('#exp-campaign-webcast').append(strToAppend_webcast);
						$('#exp-campaign-overview').append(strToAppend_overview);
						$('#exp-campaign-press').append(strToAppend_press);
						$('#exp-campaign-article').append(strToAppend_article);

					}

				}); //close each
				
			});//close $get
		
	} //close if
	/***** close db research version 2 micro page *****/




	
/* end of expiration section */	
} //close $(






