var informer_id = 469;var ALLNEWS_SETTINGS = new Array();ALLNEWS_SETTINGS[informer_id] = {};ALLNEWS_SETTINGS[informer_id]['divname'] = 'informer' + informer_id;ALLNEWS_SETTINGS[informer_id]['site_id'] = 378;ALLNEWS_SETTINGS[informer_id]['descr_class'] = 'allnewsdescr469';ALLNEWS_SETTINGS[informer_id]['title_class'] = 'allnewstitle469';ALLNEWS_SETTINGS[informer_id]['allnews_url'] = 'http://all-news.net.ua/';ALLNEWS_SETTINGS[informer_id]['informer_url'] = ALLNEWS_SETTINGS[informer_id]['allnews_url'] +'informers/' + informer_id + '/';ALLNEWS_SETTINGS[informer_id]['images_url'] =   ALLNEWS_SETTINGS[informer_id]['allnews_url'] + 'img/storage/';ALLNEWS_SETTINGS[informer_id]['image_size'] = 'big';ALLNEWS_SETTINGS[informer_id]['head_template'] = '<table style="width:590px; background-color:#ffffff;" align=\"center\" cellspacing=\"3\" cellspacing=\"3\"><tr>{items}</tr></table>';ALLNEWS_SETTINGS[informer_id]['items_template'] = '<td width=\"165\" class=\"inf-image\" align=\"center\"><div class=\"all-news-inf123\" style=\"width:90px;height:90px;overflow:hidden;\" >{image}</div><div class=\"inf-horiz\">{title}</div></td>';ALLNEWS_SETTINGS[informer_id]['globalstyles'] = '.inf-image{border: 1px solid #cdcaa9;}.all-news-inf123 a img{width:90px;height:90px;} .inf-horiz{ padding:3px;} .inf-horiz a{font-weight: bold;font-size:12px !important;font-family: arial, sans-serif !important;text-decoration:none !important;}.inf-image img{width:90px !important;height:90px !important;}';ALLNEWS_SETTINGS[informer_id]['styles'] = {'.allnewstitle469' : '{color:#000000;}','.allnewsdescr469' : '{color:#000000;};'};ALLNEWS_SETTINGS[informer_id]['datasources'] = {data1: ALLNEWS_SETTINGS[informer_id]['informer_url']+'data1.js',data2: ALLNEWS_SETTINGS[informer_id]['informer_url']+'data2.js',data3: ALLNEWS_SETTINGS[informer_id]['informer_url']+'data3.js',data4: ALLNEWS_SETTINGS[informer_id]['informer_url']+'data4.js',data5: ALLNEWS_SETTINGS[informer_id]['informer_url']+'data5.js',data6: ALLNEWS_SETTINGS[informer_id]['informer_url']+'data6.js',data7: ALLNEWS_SETTINGS[informer_id]['informer_url']+'data7.js'};function setStyles(css){
	document.write('<style type="text/css">'+css+'<'+'/style>');
}
function importCSS(path){
	document.write('<li'+'nk rel="style'+'sheet" type="text/css" href="'+path+'" />');
}
function importScript(scr){
	document.write('<scr'+'ipt language="javascript" type="text/javascript" src="'+scr+'"><'+'/scr'+'ipt>');
}
function loadData(){
	var cname='all_news_informer';
	var cookie=getCookie(cname);
	var result=new Array();
	for(var key in ALLNEWS_SETTINGS[informer_id]['datasources']){
		if(key!=cookie){result[result.length]=key;}
	}
	var len=result.length;
	var key=result[parseInt(Math.random()*len)];setCookie(cname,key,'','/');
	importScript(ALLNEWS_SETTINGS[informer_id]['datasources'][key]);
}
function getCookie(name){
	var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0){return null;}}else{begin+=2;}var end=dc.indexOf(";",begin);if(end==-1){end=dc.length;}return unescape(dc.substring(begin+prefix.length,end));
}
function setCookie(name,value,expires,path,domain,secure){
	document.cookie=name+"="+escape(value)+((expires)?";expires="+expires.toGMTString():"")+((path)?";path="+path:"")+((domain)?";domain="+domain:"")+((secure)?";secure":"");
}
function ALLNEWS(settings){
	this.inf_content='';
	this.settings=settings;
	this.MakeItem=function(title,id,descr,image){
		template = this.settings['items_template'];
		if(title.length>80){
				title=title.substr(0,80);
				title = title + ' ...';
		};
		if (template.indexOf('{title}')!=-1){
			
			res='<a target="_blank" href="'+
				this.settings['allnews_url']+
				'show.php?id='+id+'&sid='+this.settings['site_id']+'"'+
				(this.settings['title_class']?' class="'+this.settings['title_class']+'"':'')+
				'>'+title+'<'+'/a>';
			template = template.replace('{title}', res);
		};
		
		if((this.settings['image_size']) && (template.indexOf('{image}')!=-1)){
			res='<a target="_blank" href="'+
					this.settings['allnews_url']+
					'show.php?id='+id+'&sid='+
					this.settings['site_id']+'">'+
					'<img src="'+this.settings['images_url']+
					this.settings['image_size']+'/'+image+'" alt="'+
					title+'" title="'+title+'"'+' border="0" '+
					(this.settings['image_class']?' class="'+this.settings['image_class']+'"':'')
					+' '+(this.settings['image_align']?' align="'+
					this.settings['image_align']+'"':'')+'/>'+'<'+'/a'+'>';
			template = template.replace('{image}', res);
		};
		if (template.indexOf('{description}')!=-1){
			if(descr.length>80){
				descr=descr.substr(0,80);
			};
			descr=descr+'...';
			res = '<a target="_blank" href="'+this.settings['allnews_url']+
					'show.php?id='+id+'&sid='+this.settings['site_id']+'"'+
					(this.settings['descr_class']?' class="'+this.settings['descr_class']+'"':'')+
					'> '+descr+'<'+'/a>';
			template = template.replace('{description}', res);
		};
		
		this.inf_content=this.inf_content+template;
		return res;
	};
	this.getInformer=function(){
		head_template = this.settings['head_template'];
		result = head_template.replace('{items}', this.inf_content);
		result = '<style>' + this.settings['globalstyles'] + '</style>' + result;
		return result;
	};
	this.setInformer=function(id){
		var styles='';
		for(var key in this.settings['styles']){
			styles = styles + key + this.settings['styles'][key];
		}
		setStyles(styles);
		contentdiv = document.getElementById(id);
		if (contentdiv!=null){
			contentdiv.innerHTML=this.getInformer();
		}
	};
}
loadData();

