newsItemPoster=function(form){
	this.form=form;
	this.src=false;
	this.onsucces=false;
	this.url=false;
	this.title=false;
	title=false;
	var params=this.form.getElementsByTagName('input');
	for(var i=0;i<params.length;i++){
		param=params[i];
		name=param.getAttribute('name');
		value=param.getAttribute('value');
		type=param.getAttribute('type');
		if (type=='hidden'){
			switch(name){
				case 'src':
					this.src=value;
					break;
				case 'succes':
					this.onsucces=value;
					break;
				case 'url':
					this.url=value;
					break;
			}
		}else if(type=='text' && name=='title'){
			title=param;
		}
	}
	if(!this.src){
		new BLError(SL_ERROR_ERROR,'No news source defined');
	}else{
		if(!this.url){
			new BLError(SL_ERROR_ERROR,'newsposter url not found');
		}else{
			this.text=encodeText(this.form.getElementsByTagName('textarea').item(0).value);
			if(!this.text){
				new BLError(SL_ERROR_WARNING,'enter text first');
			}else{
				this.title=encodeText(title.value);
				if(!this.title){
					new BLError(SL_ERROR_WARNING,'enter title first');
				}else{
					param="&text="+this.text+"&title="+this.title+"&src="+this.src;
					this.loader=new BLXMLLoader(this)
					this.loader.setMethod("post")
					this.loader.setCallBack(this.parseResponse)
					this.loader.load(this.url+param);
				}
			}
		}
	}
}

newsItemPoster.prototype={
	parseResponse:function(req){
		response=req.responseText;
		if(response=='succes'){
			if(this.onsucces){
				eval(this.onsucces);
			}
			this.form.disabled=true;
		}else{
			new BLError(SL_ERROR_ERROR,'can\'t post news, '+response);
		}
	}
}