var news=new Array();

var obj=new Object();
obj.collection='EVENTS';
obj.date='07/02/2008';
obj.title='just testing';
obj.description='just testing';
obj.html='';
news[news.length]=obj;
var obj=new Object();
obj.collection='NEWS';
obj.date='07/02/2008';
obj.title='test';
obj.description='just testing';
obj.html='';
news[news.length]=obj;

function displayNews(collection) {
	for (var i=0;i<news.length;i++) {
		var obj=news[i];
		if (obj.collection==collection) {
			document.write('<h1>');
			document.write(obj.title);
			document.write('</h1>');
			document.write('<h2>');
			document.write(obj.date);
			document.write('</h2>');
			document.write(obj.html);
		}
	}

}

function displayShortNews(att,collection,title,link) {
	if (arguments.length>4) maxNo=arguments[4];
	else maxNo=false;
	var currentIndex=0;
	var el=document.createElement('h5');
	el.innerHTML=title;
	att.appendChild(el);
	for (var i=0;i<news.length;i++) {
		var obj=news[i];
		if (obj.collection==collection) {
			var el=document.createElement('p');
			el.className='date';
			el.innerHTML=obj.date;
			att.appendChild(el);
			var el=document.createElement('p');
			el.innerHTML=('<a href="index.php?page='+link+'">'+obj.description+'</a>');
			att.appendChild(el);
			currentIndex++;
		}
		if (maxNo && currentIndex==maxNo) return true;
	}
}
