// randomFeature.js

function getFeatures() {
	var feature = [
		{"image":"images/homepage/adlerbook.gif","heading":"Matthew D. Adler & Eric A. Posner","url":"http://www.amazon.com/Foundations-Cost-Benefit-Analysis-Matthew-Adler/dp/0674022793/ref=sr_1_1?ie=UTF8&s=books&qid=1231356136&sr=8-1","titletext":"New Foundations of Cost-Benefit Analysis","published":"(Harvard, 2006)","blurb":"Penn Law Professor Matthew Adler (with Eric A. Posner) reconceptualizes cost-benefit analysis with many practical implications for government agencies."},
		{"image":"images/homepage/coglianreport.gif","heading":"Cary Coglianese et al.","url":"http://www.law.upenn.edu/blogs/news/archives/2008/10/task_force_to_federal_regulato.html","titletext":"Transparency and Public Participation in the Rulemaking Process","published":"(George Wash. Univ. L. Rev., 2009)","blurb":"Professor Coglianese leads nonpartisan task force offering regulatory reform recommendations for the new  Administration."},
		{"image":"images/homepage/coglianbook.gif","heading":"Cary Coglianese, Adam Finkel, & David Zaring","url":"http://www.amazon.com/Safety-Regulatory-Governance-Global-Economy/dp/081224222X/ref=sr_1_1?ie=UTF8&s=books&qid=1254802757&sr=8-1","titletext":" Import Safety: Regulatory Governance in the Global Economy","published":"(2009)","blurb":"New book by PPR editors and authors analyzes the challenges of protecting consumers from harmful products in an era of increasing global trade."},
		{"image":"images/homepage/finkel.gif","heading":"Adam Finkel","url":"http://www.nap.edu/catalog.php?record_id=12209","titletext":"National Research Council, Science and Decisions: Advancing Risk Assessment","published":"(2008)","blurb":"PPR Executive Director Adam Finkel serves on NRC panel that recently issued risk assessment recommendations"},
		{"image":"images/homepage/hornik.gif","heading":"Robert Hornik et al.","url":"http://www.asc.upenn.edu/news/PressReleasesDetail.aspx?id=31","titletext":"Effects of the National Youth Anti-Drug Media Campaign on Youths","published":"(Am J Public Health, Dec 2008)","blurb":"Professor Hornik leads study finding U.S. anti-drug campaign was ineffective and possibly even counterproductive."}
	];
	return feature;
}

function buildFeature(feature) {
	var f = '';
	f += '<div id="featureImage"><img src="';
	f += feature.image;
	f += '" width="74" height="86"><\/div><div id="title"><b>';
	f += feature.heading;
	f += ',<\/b> <a href="';
	f += feature.url;
	f += '">';
	f += feature.titletext;
	f += '<\/a><i> ' + feature.published;
	f += '</i><\/div><div id="blurb">';
	f += feature.blurb;
	f += '<\/div>';
	return f;
}


function displayRandomFeature() {
	var feature = getFeatures();
	var selection = Math.floor(Math.random() * feature.length);
	if (document.getElementById('feature')) document.getElementById('feature').innerHTML += buildFeature(feature[selection]);
}
