var awardsList, newsList, displayItem;


function getNews(id){
	//getNewsXML("/jsp/docView.do?id="+id);
	//change to download in new window
	//nWin = window.open("/jsp/docView.do?id="+id, "News");
    //nWin.creator = self;
}

function getAward(id){
	//getNewsXML("/jsp/getAward.do?id="+id);
	//window.location.href = "/jsp/about_us.jsp?awdId="+id;
	var n = getById("newsholder");
	var d = getById("currentitem");
	var html = "<h2>"+awardsList[id][1]+"</h2>";
	html += htmldecode(awardsList[id][2]);
	var c = htmlTag("div",html);
	c.id ="currentitem";
	n.replaceChild(c,d);
}

function handleNewsParse(){
	var n = getById("newsholder");
	var d = getById("currentitem");
	var c = htmlTag("div",displayItem.content);
	c.id ="currentitem";
	n.replaceChild(c,d);
}

function handleNewsError(){
	alert ("handleNewsError");
}

/*
newsList = new Array();

<% int cNews = 0; %>
<nested:iterate property="pressReleases">
newsList[<%= cNews++ %>] = [<nested:write property="prsrId"/>, <nested:write property="prsrMddId"/>, "<nested:write property="prsrName"/>", "<nested:write property="prsrPublication"/>"]
</nested:iterate>


// [awdId, awdName, awdBody, awdAffiliation]
awardsList = new Array();

<% int cAward = 0; %>
<nested:iterate property="awards">
awardsList[<%= cAward++ %>] = [<nested:write property="awdId"/>, "<nested:write property="awdName"/>", "<nested:write property="awdBody"/>", "<nested:write property="awdAffiliation"/>"]
</nested:iterate>


*/

function init(){
	if (newsList.length > 0){
		for (var i=0; i<newsList.length; i++){
			var ni = htmlTag("a","<strong>"+newsList[i][2]+"</strong><br/>"+newsList[i][4]);
			ni.href = "/jsp/docView.do?id="+newsList[i][1];
			ni.target = "news_window";
			getById("newscontainer").appendChild(ni);	
		}
	}
	else{
		getById("newsBox").style.display = "none";
	}
	if (awardsList.length > 0){
		for (var i=0; i<awardsList.length; i++){
			var ai = htmlTag("a","<strong>"+awardsList[i][1]+"</strong><br/>"+awardsList[i][4]);
			ai.href = "javascript:getAward("+i+");";
			getById("awardscontainer").appendChild(ai);	
		}
		getAward(0);
	}
	else{
		getById("awardsBox").style.display = "none";
	}

	
}
