var BLIP_SITE_URL = "http://blip.tv"; 
var OUTPUT_METHOD = "document_write";

var posts = [{ "Post" : {
	"title":"Headline DS #73 - Pig Farmers Fear Stigma From Flu",
	"adminTitle":"Headline DS #73 - Pig Farmers Fear Stigma From Flu",
	"description":"\"Pig Farmers Fear Stigma From Flu\" is from the April 29, 2009 edition of the Express. Even though this particular strain of swine flu cannot be transmitted by eating pork products of any kind, pork sales are down. It\'s such an unfortunate name. Come on people, pork is a tasty treat! In the words of Vincent Vega, \"Bacon tastes good. Pork chops taste good!\" Distributed by Tubemogul.",
	"tags":["swine","flu","pigs"],
	"datestamp":"04-29-09 09:04am",
	"datestampUnixtime":"1241010266",
	"datestampDate":"2009-04-29",
	"datestampText":"Apr 29, 2009",
    
		
	"postsId":2061175,
	"postsGuid":"4481A828-34BE-11DE-BA9E-B8BF7A856DA7",
	"itemType":"file",
	"itemId":2050814,
	"url":"http://blip.tv/file/2050814",
	"mediaUrl":"http://blip.tv/file/get/Headlineds-HeadlineDS73PigFarmersFearStigmaFromFlu958.mp4?source=2",
	"thumbnailUrl":"http://a.images.blip.tv/Headlineds-HeadlineDS73PigFarmersFearStigmaFromFlu348.jpg",
	"thumbnail120Url":"http://a.images.blip.tv/Headlineds-HeadlineDS73PigFarmersFearStigmaFromFlu348-368.jpg",
    "thumbnailFilename": "Headlineds-HeadlineDS73PigFarmersFearStigmaFromFlu348.jpg",
	"login":"headlineds",
	"userId":306642,
	"showName":"Headline DS",
	"blogUrl":"http://www.headlineds.com",
	"conversions": [
		
		  ],
	"media":{
		"url":"http://blip.tv/file/get/Headlineds-HeadlineDS73PigFarmersFearStigmaFromFlu958.mp4?source=2",
		"mimeType":"video/vnd.objectvideo",
		"duration":37,
		"width":640,
		"height":480
	},
	"contentRating":"TV-UN",
	"advertising":"",

	/* Version 1 implementation, please supply version=2 in the future */
	"Title":"Headline DS #73 - Pig Farmers Fear Stigma From Flu",
	"posts_id":"2061175",
	"item_type":"file",
	"item_id":"2050814",
	"posts_url":"http://blip.tv/file/2050814",
	
	"media_src":"blip.tv/file/get/Headlineds-HeadlineDS73PigFarmersFearStigmaFromFlu958.mp4?source=2",
	
	
	"Thumbnail":{
		"Url":"http://a.images.blip.tv/Headlineds-HeadlineDS73PigFarmersFearStigmaFromFlu348.jpg"
	},
	
	"User":"headlineds"
}},{ "Post" : {
	"title":"Headline DS #72 - Genome of Cow Mapped",
	"adminTitle":"Headline DS #72 - Genome of Cow Mapped",
	"description":"\"Genome of Cow Mapped\" is from the April 24, 2009 edition of the Express. Now that we know the tasty gene, we can make more tasty cows! We win at science! Distributed by Tubemogul.",
	"tags":["cow","genome","science"],
	"datestamp":"04-24-09 08:33am",
	"datestampUnixtime":"1240576430",
	"datestampDate":"2009-04-24",
	"datestampText":"Apr 24, 2009",
    
		
	"postsId":2041534,
	"postsGuid":"2A1F6ECA-30CC-11DE-AC68-B7DEFECE81E6",
	"itemType":"file",
	"itemId":2031263,
	"url":"http://blip.tv/file/2031263",
	"mediaUrl":"http://blip.tv/file/get/Headlineds-HeadlineDS72GenomeOfCowMapped210.mp4?source=2",
	"thumbnailUrl":"http://a.images.blip.tv/Headlineds-HeadlineDS72GenomeOfCowMapped685.jpg",
	"thumbnail120Url":"http://a.images.blip.tv/Headlineds-HeadlineDS72GenomeOfCowMapped685-613.jpg",
    "thumbnailFilename": "Headlineds-HeadlineDS72GenomeOfCowMapped685.jpg",
	"login":"headlineds",
	"userId":306642,
	"showName":"Headline DS",
	"blogUrl":"http://www.headlineds.com",
	"conversions": [
		
		  ],
	"media":{
		"url":"http://blip.tv/file/get/Headlineds-HeadlineDS72GenomeOfCowMapped210.mp4?source=2",
		"mimeType":"video/vnd.objectvideo",
		"duration":45,
		"width":640,
		"height":480
	},
	"contentRating":"TV-UN",
	"advertising":"",

	/* Version 1 implementation, please supply version=2 in the future */
	"Title":"Headline DS #72 - Genome of Cow Mapped",
	"posts_id":"2041534",
	"item_type":"file",
	"item_id":"2031263",
	"posts_url":"http://blip.tv/file/2031263",
	
	"media_src":"blip.tv/file/get/Headlineds-HeadlineDS72GenomeOfCowMapped210.mp4?source=2",
	
	
	"Thumbnail":{
		"Url":"http://a.images.blip.tv/Headlineds-HeadlineDS72GenomeOfCowMapped685.jpg"
	},
	
	"User":"headlineds"
}}
];



	
		var html; 
var container;
if(OUTPUT_METHOD == "dom") {
	container = document.createElement('div');
	container.className = 'bliptv_sidebar';
	container.style.width = '110px';
	container.style.border = '1px solid black';
	container.style.padding = '5px';
	
	var c = document.createElement('center');
	container.appendChild(c);

	var title = document.createElement('span');
	title.style.fontFamily = 'arial';
	title.style.fontSize = '7.5pt';
	title.style.fontWeight = 'bold';
	title.innerHTML = 'Now on Headline DS';
	c.appendChild(title);
	c.appendChild(document.createElement('br'));
	c.appendChild(document.createElement('br'));
} else {
	html = '<div class="bliptv_sidebar" style="width: 110px; border: 1px solid black; padding: 5px;"><center>';
	html += '<span style="font-family: arial; font-size: 7.5pt; font-weight: bold;">Now on Headline DS</span><br /><br />'; 
}

for(var i = 0; i < posts.length; i++) {
	if(posts[i]['Post']['Thumbnail']) {
		if(OUTPUT_METHOD == "dom") {
			var anchor = document.createElement('a');
			anchor.href = BLIP_SITE_URL + '/' + posts[i]['Post']['item_type'] + '/'+ posts[i]['Post']['item_id'];

			var img = document.createElement('img');
			img.src = posts[i]['Post']['Thumbnail']['Url'];
			img.width = '90';
			img.height = '75';
			img.border = '0';
			img.title = posts[i]['Post']['Title'];

			anchor.appendChild(img);
			c.appendChild(anchor);
			c.appendChild(document.createElement('br'));
			c.appendChild(document.createElement('br'));
		} else {
			html += '<a href="' + BLIP_SITE_URL + '/' + posts[i]['Post']['item_type'] + '/'+ posts[i]['Post']['item_id'] + '"><img src="' + posts[i]['Post']['Thumbnail']['Url'] + '" width="90" height="75" style="border: 0px;" title="' + posts[i]['Post']['Title'] + '"/></a><br /><br />';
		}
	}
}

if(OUTPUT_METHOD == "dom") {
	c.appendChild(document.createElement('br'));
	var anchor = document.createElement('a');
	anchor.href = BLIP_SITE_URL;
	
	var img = document.createElement('img');
	img.src = BLIP_SITE_URL  + '/skin/blipcast/blip.tv.share.button.gif';
	img.border = 0;

	anchor.appendChild(img);
	c.appendChild(anchor);

	document.getElementById('blip_sidebar_container').appendChild(container);
	
} else {
	html += '<br /><a href="' + BLIP_SITE_URL + '"><img src="' + BLIP_SITE_URL  + '/skin/blipcast/blip.tv.share.button.gif" border="0" /></a>'; 
	html += '</center></div>';
	document.write(html);
}

	

