function buildEdHTML(divid, firstn, lastn, excerpts, newwin, aid) {
if(divid == null) { divid = "ZapEdStories"; }
if(firstn == null) { firstn = 1; }
if(lastn == null) { lastn = 10; }
if(excerpts == null) { excerpts = 0; }
if(newwin == null) { newwin = 0; }
if(aid == null) { aid = "zap2it"; }

var ZapEdHeadlines = [];
var ZapEdHeadlinesAff = [];
var ZapEdExcerpts = [];
var maxentries = 0;


ZapEdHeadlines[1] = '<div class="ZEheadline"><a href="http://blog.zap2it.com/pop2it/2012/02/bobby-brown-beyond-devastated-about-whitney-houstons-death.html"';
if(newwin == 1) { ZapEdHeadlines[1] += ' target="_blank"'; }
ZapEdHeadlines[1] += '>Bobby Brown \'beyond devastated\' about Whitney Houston\'s death</a></div>';
ZapEdExcerpts[1] = '<div class="ZEexcerpt">While performing on stage he says, \"I love you, Whitney\" before blowing a kiss skyward.</div>';
ZapEdHeadlinesAff[1] = '<div class="ZEheadline"><a href="http://affiliate.zap2it.com/tvlistings/ZCTVHome.do?method=getArticle&aid='+aid+'&index=1&link=';
ZapEdHeadlinesAff[1] += 'http://blog.zap2it.com/pop2it/2012/02/bobby-brown-beyond-devastated-about-whitney-houstons-death.rss"';
if(newwin == 1) { ZapEdHeadlinesAff[1] += ' target="_blank"'; }
ZapEdHeadlinesAff[1] += '>Bobby Brown \'beyond devastated\' about Whitney Houston\'s death</a></div>';
maxentries = 1;
ZapEdHeadlines[2] = '<div class="ZEheadline"><a href="http://blog.zap2it.com/pop2it/2012/02/whitney-houston-found-in-bathtub-pres\cription-drugs-in-room----report.html"';
if(newwin == 1) { ZapEdHeadlines[2] += ' target="_blank"'; }
ZapEdHeadlines[2] += '>Whitney Houston found in bathtub, pres\cription drugs in room -- report</a></div>';
ZapEdExcerpts[2] = '<div class="ZEexcerpt">Members of Houston\'s entourage reportedly became concerned after Houston had been in the bathroom for more than an hour.</div>';
ZapEdHeadlinesAff[2] = '<div class="ZEheadline"><a href="http://affiliate.zap2it.com/tvlistings/ZCTVHome.do?method=getArticle&aid='+aid+'&index=1&link=';
ZapEdHeadlinesAff[2] += 'http://blog.zap2it.com/pop2it/2012/02/whitney-houston-found-in-bathtub-prescription-drugs-in-room----report.rss"';
if(newwin == 1) { ZapEdHeadlinesAff[2] += ' target="_blank"'; }
ZapEdHeadlinesAff[2] += '>Whitney Houston found in bathtub, pres\cription drugs in room -- report</a></div>';
maxentries = 2;
ZapEdHeadlines[3] = '<div class="ZEheadline"><a href="http://blog.zap2it.com/pop2it/2012/02/jennifer-hudson-set-for-whitney-houston-tribute-at-the-grammys.html"';
if(newwin == 1) { ZapEdHeadlines[3] += ' target="_blank"'; }
ZapEdHeadlines[3] += '>Jennifer Hudson set for Whitney Houston tribute at the Grammys</a></div>';
ZapEdExcerpts[3] = '<div class="ZEexcerpt">Grammy producer Ken Ehrlich said Saturday evening that plans were under way to have Jennifer Hudson sing a \"respectful musical tribute\" to Houston.</div>';
ZapEdHeadlinesAff[3] = '<div class="ZEheadline"><a href="http://affiliate.zap2it.com/tvlistings/ZCTVHome.do?method=getArticle&aid='+aid+'&index=1&link=';
ZapEdHeadlinesAff[3] += 'http://blog.zap2it.com/pop2it/2012/02/jennifer-hudson-set-for-whitney-houston-tribute-at-the-grammys.rss"';
if(newwin == 1) { ZapEdHeadlinesAff[3] += ' target="_blank"'; }
ZapEdHeadlinesAff[3] += '>Jennifer Hudson set for Whitney Houston tribute at the Grammys</a></div>';
maxentries = 3;
ZapEdHeadlines[4] = '<div class="ZEheadline"><a href="http://blog.zap2it.com/pop2it/2012/02/whitney-houston-five-of-our-favorite-songs.html"';
if(newwin == 1) { ZapEdHeadlines[4] += ' target="_blank"'; }
ZapEdHeadlines[4] += '>Whitney Houston: Five of our favorite songs</a></div>';
ZapEdExcerpts[4] = '<div class="ZEexcerpt">These five songs never fail to stick in our heads when we hear them.</div>';
ZapEdHeadlinesAff[4] = '<div class="ZEheadline"><a href="http://affiliate.zap2it.com/tvlistings/ZCTVHome.do?method=getArticle&aid='+aid+'&index=1&link=';
ZapEdHeadlinesAff[4] += 'http://blog.zap2it.com/pop2it/2012/02/whitney-houston-five-of-our-favorite-songs.rss"';
if(newwin == 1) { ZapEdHeadlinesAff[4] += ' target="_blank"'; }
ZapEdHeadlinesAff[4] += '>Whitney Houston: Five of our favorite songs</a></div>';
maxentries = 4;
ZapEdHeadlines[5] = '<div class="ZEheadline"><a href="http://blog.zap2it.com/pop2it/2012/02/whitney-houston-mourned-by-the-music-world-rihanna-mariah-carey-and-more-react.html"';
if(newwin == 1) { ZapEdHeadlines[5] += ' target="_blank"'; }
ZapEdHeadlines[5] += '>Whitney Houston mourned by the music world: Rihanna, Mariah Carey and more react</a></div>';
ZapEdExcerpts[5] = '<div class="ZEexcerpt">Whitney Houston\'s death Saturday sent shock waves through the music world.\n</div>';
ZapEdHeadlinesAff[5] = '<div class="ZEheadline"><a href="http://affiliate.zap2it.com/tvlistings/ZCTVHome.do?method=getArticle&aid='+aid+'&index=1&link=';
ZapEdHeadlinesAff[5] += 'http://blog.zap2it.com/pop2it/2012/02/whitney-houston-mourned-by-the-music-world-rihanna-mariah-carey-and-more-react.rss"';
if(newwin == 1) { ZapEdHeadlinesAff[5] += ' target="_blank"'; }
ZapEdHeadlinesAff[5] += '>Whitney Houston mourned by the music world: Rihanna, Mariah Carey and more react</a></div>';
maxentries = 5;
ZapEdHeadlines[6] = '<div class="ZEheadline"><a href="http://blog.zap2it.com/pop2it/2012/02/whitney-houston-dead-at-48-circumstances-unknown.html"';
if(newwin == 1) { ZapEdHeadlines[6] += ' target="_blank"'; }
ZapEdHeadlines[6] += '>Whitney Houston confirmed dead at 48, circumstances unknown</a></div>';
ZapEdExcerpts[6] = '<div class="ZEexcerpt">Houston is survived by her 18-year-old daugher, Bobbi Kristina Houston Brown, with ex-husband Bobby Brown. She was dating singer Ray-J and was seen out with him one week prior to her death.</div>';
ZapEdHeadlinesAff[6] = '<div class="ZEheadline"><a href="http://affiliate.zap2it.com/tvlistings/ZCTVHome.do?method=getArticle&aid='+aid+'&index=1&link=';
ZapEdHeadlinesAff[6] += 'http://blog.zap2it.com/pop2it/2012/02/whitney-houston-dead-at-48-circumstances-unknown.rss"';
if(newwin == 1) { ZapEdHeadlinesAff[6] += ' target="_blank"'; }
ZapEdHeadlinesAff[6] += '>Whitney Houston confirmed dead at 48, circumstances unknown</a></div>';
maxentries = 6;
ZapEdHeadlines[7] = '<div class="ZEheadline"><a href="http://blog.zap2it.com/pop2it/2012/02/meet-jeremy-lin-knicks-guard-from-harvard-has-new-york-suffering-from-lin-sanity.html"';
if(newwin == 1) { ZapEdHeadlines[7] += ' target="_blank"'; }
ZapEdHeadlines[7] += '>Meet Jeremy Lin: Knicks guard from Harvard has New York suffering from Lin-sanity</a></div>';
ZapEdExcerpts[7] = '<div class="ZEexcerpt">Lin has risen from a few-minutes-a-game bench player to the toast of the league over the past seven days. Not bad for a guy from Harvard.</div>';
ZapEdHeadlinesAff[7] = '<div class="ZEheadline"><a href="http://affiliate.zap2it.com/tvlistings/ZCTVHome.do?method=getArticle&aid='+aid+'&index=1&link=';
ZapEdHeadlinesAff[7] += 'http://blog.zap2it.com/pop2it/2012/02/meet-jeremy-lin-knicks-guard-from-harvard-has-new-york-suffering-from-lin-sanity.rss"';
if(newwin == 1) { ZapEdHeadlinesAff[7] += ' target="_blank"'; }
ZapEdHeadlinesAff[7] += '>Meet Jeremy Lin: Knicks guard from Harvard has New York suffering from Lin-sanity</a></div>';
maxentries = 7;
ZapEdHeadlines[8] = '<div class="ZEheadline"><a href="http://blog.zap2it.com/pop2it/2012/02/see-a-scene-from-twilight-breaking-dawn-part-2-playing-on-tv-screens-inside-a-target.html"';
if(newwin == 1) { ZapEdHeadlines[8] += ' target="_blank"'; }
ZapEdHeadlines[8] += '>See a scene from \'Twilight: Breaking Dawn Part 2\' (playing on TV screens inside a Target)</a></div>';
ZapEdExcerpts[8] = '<div class="ZEexcerpt">The video and sound aren\'t great. But if you\'re a serious Twihard, that may be an acceptable tradeoff to get a glimpse of the final installment of the movie franchise.</div>';
ZapEdHeadlinesAff[8] = '<div class="ZEheadline"><a href="http://affiliate.zap2it.com/tvlistings/ZCTVHome.do?method=getArticle&aid='+aid+'&index=1&link=';
ZapEdHeadlinesAff[8] += 'http://blog.zap2it.com/pop2it/2012/02/see-a-scene-from-twilight-breaking-dawn-part-2-playing-on-tv-screens-inside-a-target.rss"';
if(newwin == 1) { ZapEdHeadlinesAff[8] += ' target="_blank"'; }
ZapEdHeadlinesAff[8] += '>See a scene from \'Twilight: Breaking Dawn Part 2\' (playing on TV screens inside a Target)</a></div>';
maxentries = 8;
ZapEdHeadlines[9] = '<div class="ZEheadline"><a href="http://blog.zap2it.com/pop2it/2012/02/the-vow-and-safe-house-both-open-big-at-the-box-office.html"';
if(newwin == 1) { ZapEdHeadlines[9] += ' target="_blank"'; }
ZapEdHeadlines[9] += '>\'The Vow\' and \'Safe House\' both open big at the box office</a></div>';
ZapEdExcerpts[9] = '<div class="ZEexcerpt">Both movies are on pace to make well above $30 million for the weekend.</div>';
ZapEdHeadlinesAff[9] = '<div class="ZEheadline"><a href="http://affiliate.zap2it.com/tvlistings/ZCTVHome.do?method=getArticle&aid='+aid+'&index=1&link=';
ZapEdHeadlinesAff[9] += 'http://blog.zap2it.com/pop2it/2012/02/the-vow-and-safe-house-both-open-big-at-the-box-office.rss"';
if(newwin == 1) { ZapEdHeadlinesAff[9] += ' target="_blank"'; }
ZapEdHeadlinesAff[9] += '>\'The Vow\' and \'Safe House\' both open big at the box office</a></div>';
maxentries = 9;
ZapEdHeadlines[10] = '<div class="ZEheadline"><a href="http://blog.zap2it.com/pop2it/2012/02/sydney-spies-fight-over-sexy-yearbook-photo-going-to-school-board.html"';
if(newwin == 1) { ZapEdHeadlines[10] += ' target="_blank"'; }
ZapEdHeadlines[10] += '>Sydney Spies: Fight over \'sexy\' yearbook photo going to school board</a></div>';
ZapEdExcerpts[10] = '<div class="ZEexcerpt">\"Sydney feels very bullied, by the entire school, basically. The school has been awful and the kids have been awful,\" her mother says.</div>';
ZapEdHeadlinesAff[10] = '<div class="ZEheadline"><a href="http://affiliate.zap2it.com/tvlistings/ZCTVHome.do?method=getArticle&aid='+aid+'&index=1&link=';
ZapEdHeadlinesAff[10] += 'http://blog.zap2it.com/pop2it/2012/02/sydney-spies-fight-over-sexy-yearbook-photo-going-to-school-board.rss"';
if(newwin == 1) { ZapEdHeadlinesAff[10] += ' target="_blank"'; }
ZapEdHeadlinesAff[10] += '>Sydney Spies: Fight over \'sexy\' yearbook photo going to school board</a></div>';
maxentries = 10;

var ZapEdContent = '';
ZapEdContent = '<div class="ZEheadlinelist"><ul class="ZElist">';

for(i = 1; i<=lastn && i<=maxentries; i++) {
	if(i >= firstn) {
		ZapEdContent += '<li class="ZElistel">';
		if(aid == "zap2it") {
			ZapEdContent += ZapEdHeadlines[i];
		} else {
			ZapEdContent += ZapEdHeadlinesAff[i];
		}
		if(i <= excerpts) { ZapEdContent += ZapEdExcerpts[i]; }
		ZapEdContent += '</li>';
	}
}

ZapEdContent += '</ul></div>';
document.getElementById(divid).innerHTML = ZapEdContent;
}



