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/frominsidethebox/2012/02/cougar-town-cast-pitches-new-equally-lame-titles-for-the-show.html"';
if(newwin == 1) { ZapEdHeadlines[1] += ' target="_blank"'; }
ZapEdHeadlines[1] += '>\'Cougar Town\' cast pitches new, equally lame titles for the show</a></div>';
ZapEdExcerpts[1] = '<div class="ZEexcerpt">The results of the cast\'s brainstorming session were ... less than auspicious.</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/frominsidethebox/2012/02/cougar-town-cast-pitches-new-equally-lame-titles-for-the-show.rss"';
if(newwin == 1) { ZapEdHeadlinesAff[1] += ' target="_blank"'; }
ZapEdHeadlinesAff[1] += '>\'Cougar Town\' cast pitches new, equally lame titles for the show</a></div>';
maxentries = 1;
ZapEdHeadlines[2] = '<div class="ZEheadline"><a href="http://blog.zap2it.com/frominsidethebox/2012/02/sons-of-anarchy-season-6-now-guaranteed-as-creator-kurt-sutter-signs-new-deal.html"';
if(newwin == 1) { ZapEdHeadlines[2] += ' target="_blank"'; }
ZapEdHeadlines[2] += '>\'Sons of Anarchy\' Season 6 now guaranteed as creator Kurt Sutter signs new deal</a></div>';
ZapEdExcerpts[2] = '<div class="ZEexcerpt">\"There\'s a part of me that does see being able to tell this story in seven seasons, but there\'s a part of me that doesn\'t want to say, \'That\'s it,\'\" Sutter says.</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/frominsidethebox/2012/02/sons-of-anarchy-season-6-now-guaranteed-as-creator-kurt-sutter-signs-new-deal.rss"';
if(newwin == 1) { ZapEdHeadlinesAff[2] += ' target="_blank"'; }
ZapEdHeadlinesAff[2] += '>\'Sons of Anarchy\' Season 6 now guaranteed as creator Kurt Sutter signs new deal</a></div>';
maxentries = 2;
ZapEdHeadlines[3] = '<div class="ZEheadline"><a href="http://blog.zap2it.com/frominsidethebox/2012/02/spartacus-vengeance-lucy-lawless-on-nude-scenes-crazy-lucretia.html"';
if(newwin == 1) { ZapEdHeadlines[3] += ' target="_blank"'; }
ZapEdHeadlines[3] += '>\'Spartacus: Vengeance\': Lucy Lawless on nude scenes, crazy Lucretia</a></div>';
ZapEdExcerpts[3] = '<div class="ZEexcerpt">Lucy Lawless gives us a peek at what it\'s like to play crazy (or not so crazy) Lucretia in \"Spartacus: Vengeance.\" </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/frominsidethebox/2012/02/spartacus-vengeance-lucy-lawless-on-nude-scenes-crazy-lucretia.rss"';
if(newwin == 1) { ZapEdHeadlinesAff[3] += ' target="_blank"'; }
ZapEdHeadlinesAff[3] += '>\'Spartacus: Vengeance\': Lucy Lawless on nude scenes, crazy Lucretia</a></div>';
maxentries = 3;
ZapEdHeadlines[4] = '<div class="ZEheadline"><a href="http://blog.zap2it.com/frominsidethebox/2012/02/fringe-jasika-nicole-on-meeting-alternate-astrid.html"';
if(newwin == 1) { ZapEdHeadlines[4] += ' target="_blank"'; }
ZapEdHeadlines[4] += '>\'Fringe:\' Jasika Nicole on meeting Alternate Astrid</a></div>';
ZapEdExcerpts[4] = '<div class="ZEexcerpt">\"Fringe\" star Jaiska Nicole talks about tonight\'s (Feb. 3) episode and the meeting of the two Astrids.</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/frominsidethebox/2012/02/fringe-jasika-nicole-on-meeting-alternate-astrid.rss"';
if(newwin == 1) { ZapEdHeadlinesAff[4] += ' target="_blank"'; }
ZapEdHeadlinesAff[4] += '>\'Fringe:\' Jasika Nicole on meeting Alternate Astrid</a></div>';
maxentries = 4;
ZapEdHeadlines[5] = '<div class="ZEheadline"><a href="http://blog.zap2it.com/frominsidethebox/2012/02/anger-management-charlie-sheens-new-show-casts-selma-blair-shawnee-smith.html"';
if(newwin == 1) { ZapEdHeadlines[5] += ' target="_blank"'; }
ZapEdHeadlines[5] += '>\'Anger Management\': Charlie Sheen\'s new show casts Selma Blair, Shawnee Smith</a></div>';
ZapEdExcerpts[5] = '<div class="ZEexcerpt">Blair will play his therapist while Smith will play his ex-wife.</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/frominsidethebox/2012/02/anger-management-charlie-sheens-new-show-casts-selma-blair-shawnee-smith.rss"';
if(newwin == 1) { ZapEdHeadlinesAff[5] += ' target="_blank"'; }
ZapEdHeadlinesAff[5] += '>\'Anger Management\': Charlie Sheen\'s new show casts Selma Blair, Shawnee Smith</a></div>';
maxentries = 5;
ZapEdHeadlines[6] = '<div class="ZEheadline"><a href="http://blog.zap2it.com/frominsidethebox/2012/02/supernatural-creators-revolution-comes-to-nbc-jamie-bamber-joins-tnt-pilot.html"';
if(newwin == 1) { ZapEdHeadlines[6] += ' target="_blank"'; }
ZapEdHeadlines[6] += '>\'Supernatural\' creator\'s \'Revolution\' comes to NBC; Jamie Bamber joins TNT pilot</a></div>';
ZapEdExcerpts[6] = '<div class="ZEexcerpt">Plus, \"Lost\" alum Ken Leung tries his hand at comedy and NBC\'s \"Munsters\" reboot gets a new name.</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/frominsidethebox/2012/02/supernatural-creators-revolution-comes-to-nbc-jamie-bamber-joins-tnt-pilot.rss"';
if(newwin == 1) { ZapEdHeadlinesAff[6] += ' target="_blank"'; }
ZapEdHeadlinesAff[6] += '>\'Supernatural\' creator\'s \'Revolution\' comes to NBC; Jamie Bamber joins TNT pilot</a></div>';
maxentries = 6;
ZapEdHeadlines[7] = '<div class="ZEheadline"><a href="http://blog.zap2it.com/frominsidethebox/2012/02/castle-watch-the-first-11-minutes-of-the-blue-butterfly-1940s-film-noir-episode.html"';
if(newwin == 1) { ZapEdHeadlines[7] += ' target="_blank"'; }
ZapEdHeadlines[7] += '>\'Castle\': Watch the first 11 minutes of \'The Blue Butterfly\' 1940s film noir episode</a></div>';
ZapEdExcerpts[7] = '<div class="ZEexcerpt">The \"Castle\" gang travels back in time on Monday, Feb. 6 for the much-anticipated (by us, at least) film noir episode \"The Blue Butterfly,\" in which the cast members get decked out in their 1940s best for some ultra-fun flashback scenes.</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/frominsidethebox/2012/02/castle-watch-the-first-11-minutes-of-the-blue-butterfly-1940s-film-noir-episode.rss"';
if(newwin == 1) { ZapEdHeadlinesAff[7] += ' target="_blank"'; }
ZapEdHeadlinesAff[7] += '>\'Castle\': Watch the first 11 minutes of \'The Blue Butterfly\' 1940s film noir episode</a></div>';
maxentries = 7;
ZapEdHeadlines[8] = '<div class="ZEheadline"><a href="http://blog.zap2it.com/frominsidethebox/2012/02/portia-de-rossi-and-ellen-degeneres-sell-pilot-to-abc.html"';
if(newwin == 1) { ZapEdHeadlines[8] += ' target="_blank"'; }
ZapEdHeadlines[8] += '>Portia de Rossi and Ellen DeGeneres sell pilot to ABC</a></div>';
ZapEdExcerpts[8] = '<div class="ZEexcerpt">The comedy is about a successful woman goes to work for her less-brainy but more popular sister.</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/frominsidethebox/2012/02/portia-de-rossi-and-ellen-degeneres-sell-pilot-to-abc.rss"';
if(newwin == 1) { ZapEdHeadlinesAff[8] += ' target="_blank"'; }
ZapEdHeadlinesAff[8] += '>Portia de Rossi and Ellen DeGeneres sell pilot to ABC</a></div>';
maxentries = 8;
ZapEdHeadlines[9] = '<div class="ZEheadline"><a href="http://blog.zap2it.com/frominsidethebox/2012/02/fox-launches-breaking-in-season-2-in-tuesday-night-comedy-block-gives-glee-a-2-month-vacation.html"';
if(newwin == 1) { ZapEdHeadlines[9] += ' target="_blank"'; }
ZapEdHeadlines[9] += '>FOX launches \'Breaking In\' Season 2 in Tuesday night comedy block, gives \'Glee\' a 2-month vacation</a></div>';
ZapEdExcerpts[9] = '<div class="ZEexcerpt">FOX\'s new two-hour comedy block of \"Raising Hope,\" \"I Hate My Teenage Daughter,\" \"New Girl\" and \"Breaking In\" starts March 10, shelving \"Glee\" from the end of February until April.</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/frominsidethebox/2012/02/fox-launches-breaking-in-season-2-in-tuesday-night-comedy-block-gives-glee-a-2-month-vacation.rss"';
if(newwin == 1) { ZapEdHeadlinesAff[9] += ' target="_blank"'; }
ZapEdHeadlinesAff[9] += '>FOX launches \'Breaking In\' Season 2 in Tuesday night comedy block, gives \'Glee\' a 2-month vacation</a></div>';
maxentries = 9;
ZapEdHeadlines[10] = '<div class="ZEheadline"><a href="http://blog.zap2it.com/frominsidethebox/2012/02/breaking-ins-megan-mullally-glad-the-very-talented-cast-of-will-grace-keeps-working.html"';
if(newwin == 1) { ZapEdHeadlines[10] += ' target="_blank"'; }
ZapEdHeadlines[10] += '>\'Breaking In\'s\' Megan Mullally glad the \'very talented\' cast of \'Will & Grace\' keeps working</a></div>';
ZapEdExcerpts[10] = '<div class="ZEexcerpt">\"We might have all been pretty good to begin with, but we came out a lot better,\" Mullally says of her \"Will & Grace\" co-stars.</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/frominsidethebox/2012/02/breaking-ins-megan-mullally-glad-the-very-talented-cast-of-will-grace-keeps-working.rss"';
if(newwin == 1) { ZapEdHeadlinesAff[10] += ' target="_blank"'; }
ZapEdHeadlinesAff[10] += '>\'Breaking In\'s\' Megan Mullally glad the \'very talented\' cast of \'Will & Grace\' keeps working</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;
}



