newsItemLoader=function(form){
	this.form=form
	this.table=form.parentNode
	this.formRow=null
	while (this.table.tagName!='TBODY'){
		this.formRow=this.table
		this.table=this.table.parentNode
	}
	this.where="";
	inputs=form.getElementsByTagName('input');
	for (var i=0;i<inputs.length;i++){
		input=inputs[i];
		if (input.getAttribute('name')=='shownCounter'){
			this.item=parseInt(input.getAttribute('value'));
			this.showCounter=input;
		}else if(input.getAttribute('name')=='newsSrc'){
			this.src=input.getAttribute('value');
			this.newsSrc=input;
		}else if(input.getAttribute('name')=='newsWhere'){
			this.where=input.getAttribute('value');
			this.newsWhere=input;
		}else if(input.getAttribute('name')=='moreUrl'){
			this.url=input.getAttribute('value');
			this.moreUrl=input;
		}else if(input.getAttribute('name')=='noMore'){
			this.noMore=input.getAttribute('value');
		}else if(input.getAttribute('type')=='button'){
			this.button=input
		}else if(input.getAttribute('type')=='showtime'){
			this.showtime=input.getAttribute('value');
		}else if(input.getAttribute('type')=='showauthor'){
			this.showauthor=input.getAttribute('value');
		}
	}
	param="&item="+this.item+"&src="+this.src+"&where="+this.where;
	this.loader=new BLXMLLoader(this)
	this.loader.setMethod("post")
	this.loader.setCallBack(this.parseItem)
	this.loader.load(this.url+param)
}

newsItemLoader.prototype={
	parseItem:function(req){
		response=req.responseXML;
		if (response.getElementsByTagName("title").length>0){
			var title=response.getElementsByTagName("title").item(0).childNodes.item(0).data
			var time=response.getElementsByTagName("time").item(0).childNodes.item(0).data
			var author=response.getElementsByTagName("author").item(0).childNodes.item(0).data
			var content=response.getElementsByTagName("content").item(0).childNodes.item(0).data
			var rowSplit=document.createElement('tr')
			rowSplit.className='news_viewer_splitter';
			rowSplit.setAttribute('class','news_viewer_splitter');
			var colSplit=document.createElement('td')
			rowSplit.appendChild(colSplit)
			colSplit.className='news_viewer_splitter';
			colSplit.setAttribute('class','news_viewer_splitter');
			this.table.insertBefore(rowSplit,this.formRow)
			var table=document.createElement('table')
			rowHead=document.createElement('tr')
			rowHead.className='news_viewer_head';
			rowHead.setAttribute('class','news_viewer_head');
			var colTitle=document.createElement('td');
			titleText=title;
			if(this.showauthor){
				titleText+=" by "+author;
			}
			colTitle.appendChild(document.createTextNode(titleText))
			colTitle.className='news_viewer_title';
			colTitle.setAttribute('class','news_viewer_title');
			rowHead.appendChild(colTitle)
			if(this.showTime){
				var colTime=document.createElement('td')
				colTime.appendChild(document.createTextNode(time))
				colTime.className='news_viewer_time';
				colTime.setAttribute('class','news_viewer_time')
				rowHead.appendChild(colTime)
			}
			var rowBody=document.createElement('tr')
			rowBody.className='news_viewer_body';
			rowBody.setAttribute('class','news_viewer_body');
			var colBody=document.createElement('td')
			rowBody.appendChild(colBody);
			if(document.documentElement.innerHTML){
				colBody.innerHTML=content;
			}else{
				colBody.appendChild(document.createTextNode(content))
			}
			colBody.className='news_viewer_body';
			colBody.setAttribute('class','news_viewer_body');
			colBody.colSpan=2;
			colBody.setAttribute('colspan','2');
			tableBody=document.createElement('tbody')
			tableBody.appendChild(rowHead);
			tableBody.appendChild(rowBody);
			table.appendChild(tableBody);
			table.className='news_viewer_item';
			table.setAttribute('class','news_viewer_item');
			tableRow=document.createElement('tr')
			tableCol=document.createElement('td')
			tableRow.appendChild(tableCol)
			tableCol.appendChild(table)
			this.table.insertBefore(tableRow,this.formRow)
			this.showCounter.setAttribute('value',this.item+1)
			if (response.getElementsByTagName("first").length!=0){
				row=document.createElement('tr')
				col=document.createElement('td')
				this.button.setAttribute('value',this.noMore)
				this.button.setAttribute('disabled','true')
			}
		}else{
			row=document.createElement('tr')
			col=document.createElement('td')
			this.button.setAttribute('value',this.noMore)
			this.button.setAttribute('disabled','true')
		}
	}
}