$(document).ready(function()  {
	$('#container-1 ul').tabs();
	$('#container-2 ul').tabs();
	$('.entries > .line:eq(0) > .entry').addClass('nb');
	$('#comentlist > .entries > .entry:eq(0)').css('border','none');
	
	detectResolution();
	
// tabs

	jQuery('#rss-box .tabs li a').click(function() {

		jQuery(this).parent().siblings().removeClass("active");
		jQuery(this).parent().addClass("active");

		var divname0 = jQuery(this).attr("href");
		var divname = divname0.substring(1, divname0.length);

		jQuery(this).parent().parent().parent().children('.rss-wr').children('div.tab-container').hide();

		if(divname == 'country2') {
			
			jQuery('#rss_wsj').hide();
			jQuery('#rss_nyt').hide();
			jQuery('#rss_fb').hide();
			jQuery('#rss_cnn').hide();
			jQuery('#rss_upi').hide();
			
			jQuery('#country2 .loading').show();

			$.ajax({
				type: "POST",
				url: "/rss/show/2",
				success: function(xml){

					var mixedSourceLayer = jQuery('#rss_wsj');
					mixedSourceLayer.html('');
					mixedSourceLayer.append('<div class="source-hd"><img class="source-logo" src="/img/rss/wall_street_journal.gif" alt="Wall Street Journal" /></div>');

					var iItemsCount = xml.getElementsByTagName('item_wsj').length;

					for (i = 0; i < 8; i++) {
						var mixedCurrentItem = xml.getElementsByTagName('item_wsj')[i];

						var licz = 210 + i;
						
						if(i > 2) {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '" style="display: none;">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
						else {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
					}
					
					var mixedSourceLayer = jQuery('#rss_nyt');
					mixedSourceLayer.html('');
					mixedSourceLayer.append('<div class="source-hd"><img class="source-logo" src="/img/rss/nytimes.gif" alt="New York Times" /></div>');

					var iItemsCount = xml.getElementsByTagName('item_nyt').length;

					for (i = 0; i < 8; i++) {
						var mixedCurrentItem = xml.getElementsByTagName('item_nyt')[i];

						var licz = 220 + i;
						
						if(i > 2) {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '" style="display: none;">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
						else {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
					}
					
					var mixedSourceLayer = jQuery('#rss_fb');
					mixedSourceLayer.html('');
					mixedSourceLayer.append('<div class="source-hd"><img class="source-logo" src="/img/rss/forbes.gif" alt="Forbes" /></div>');

					var iItemsCount = xml.getElementsByTagName('item_fb').length;

					for (i = 0; i < 8; i++) {
						var mixedCurrentItem = xml.getElementsByTagName('item_fb')[i];

						var licz = 230 + i;
						
						if(i > 2) {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '" style="display: none;">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
						else {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
					}
					
					var mixedSourceLayer = jQuery('#rss_cnn');
					mixedSourceLayer.html('');
					mixedSourceLayer.append('<div class="source-hd"><img class="source-logo" src="/img/rss/cnnmoney.gif" alt="CNN Money" /></div>');

					var iItemsCount = xml.getElementsByTagName('item_cnn').length;

					for (i = 0; i < 8; i++) {
						var mixedCurrentItem = xml.getElementsByTagName('item_cnn')[i];

						var licz = 240 + i;
						
						if(i > 2) {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '" style="display: none;">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
						else {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
					}

					var mixedSourceLayer = jQuery('#rss_upi');
					mixedSourceLayer.html('');
					mixedSourceLayer.append('<div class="source-hd"><img class="source-logo" src="/img/rss/upi.gif" alt="UPI" /></div>');

					var iItemsCount = xml.getElementsByTagName('item_upi').length;

					for (i = 0; i < 8; i++) {
						var mixedCurrentItem = xml.getElementsByTagName('item_upi')[i];

						var licz = 260 + i;
						
						if(i > 2) {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '" style="display: none;">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
						else {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
					}

					jQuery('#country2 .loading').hide();
					jQuery('#rss_wsj').show();
					jQuery('#rss_nyt').show();
					jQuery('#rss_fb').show();
					jQuery('#rss_cnn').show();
					jQuery('#rss_upi').show();
				}
			});
		}
		else if(divname == 'country3') {
			
			jQuery('#rss_re').hide();
			jQuery('#rss_gu').hide();
			jQuery('#rss_ec').hide();
			jQuery('#rss_to').hide();
			jQuery('#rss_in').hide();
			
			jQuery('#country3 .loading').show();
			
			$.ajax({
				type: "POST",
				url: "/rss/show/3",
				success: function(xml){

					var mixedSourceLayer = jQuery('#rss_re');
					mixedSourceLayer.html('');
					mixedSourceLayer.append('<div class="source-hd"><img class="source-logo" src="/img/rss/reuters.gif" alt="Reuters" /></div>');

					var iItemsCount = xml.getElementsByTagName('item_re').length;

					for (i = 0; i < 8; i++) {
						var mixedCurrentItem = xml.getElementsByTagName('item_re')[i];

						var licz = 320 + i;
						
						if(i > 2) {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '" style="display: none;">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
						else {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
					}
					
					var mixedSourceLayer = jQuery('#rss_gu');
					mixedSourceLayer.html('');
					mixedSourceLayer.append('<div class="source-hd"><img class="source-logo" src="/img/rss/guardian.gif" alt="Guardian" /></div>');

					var iItemsCount = xml.getElementsByTagName('item_gu').length;

					for (i = 0; i < 8; i++) {
						var mixedCurrentItem = xml.getElementsByTagName('item_gu')[i];
						var cos = mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data;
						var length = cos.length;
						
						if(length > 100) {
							cos = cos.substr(0, 140) + '... ';
						}

						var licz = 330 + i;

						if(i > 2) {
							
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '" style="display: none;">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + cos + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
						else {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + cos + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
					}
					
					var mixedSourceLayer = jQuery('#rss_ec');
					mixedSourceLayer.html('');
					mixedSourceLayer.append('<div class="source-hd"><img class="source-logo" src="/img/rss/economist.gif" alt="Economist" /></div>');

					var iItemsCount = xml.getElementsByTagName('item_ec').length;

					for (i = 0; i < 8; i++) {
						var mixedCurrentItem = xml.getElementsByTagName('item_ec')[i];

						var licz = 340 + i;
						
						if(i > 2) {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '" style="display: none;">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
						else {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
					}
					
					var mixedSourceLayer = jQuery('#rss_to');
					mixedSourceLayer.html('');
					mixedSourceLayer.append('<div class="source-hd"><img class="source-logo" src="/img/rss/times.gif" alt="Times" /></div>');

					var iItemsCount = xml.getElementsByTagName('item_to').length;

					for (i = 0; i < 8; i++) {
						var mixedCurrentItem = xml.getElementsByTagName('item_to')[i];

						var licz = 350 + i;
						
						if(i > 2) {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '" style="display: none;">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
						else {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
					}
					
					var mixedSourceLayer = jQuery('#rss_in');
					mixedSourceLayer.html('');
					mixedSourceLayer.append('<div class="source-hd"><img class="source-logo" src="/img/rss/indepedent.gif" alt="Indepedent" /></div>');

					var iItemsCount = xml.getElementsByTagName('item_in').length;

					for (i = 0; i < 8; i++) {
						var mixedCurrentItem = xml.getElementsByTagName('item_in')[i];

						var licz = 360 + i;
						
						if(i > 2) {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '" style="display: none;">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
						else {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
					}

					jQuery('#country3 .loading').hide();
					jQuery('#rss_ft').show();
					jQuery('#rss_re').show();
					jQuery('#rss_gu').show();
					jQuery('#rss_ec').show();
					jQuery('#rss_to').show();
					jQuery('#rss_in').show();
				}
			});
		}
		else if(divname == 'country4') {
			
			jQuery('#rss_lf').hide();
			jQuery('#rss_li').hide();
			jQuery('#rss_lt').hide();
			jQuery('#rss_lm').hide();
			
			jQuery('#country4 .loading').show();
			
			$.ajax({
				type: "POST",
				url: "/rss/show/4",
				success: function(xml){

					var mixedSourceLayer = jQuery('#rss_lf');
					mixedSourceLayer.html('');
					mixedSourceLayer.append('<div class="source-hd"><img class="source-logo" src="/img/rss/lefigaro.gif" alt="Lefigaro" /></div>');

					var iItemsCount = xml.getElementsByTagName('item_lf').length;

					for (i = 0; i < 8; i++) {
						var mixedCurrentItem = xml.getElementsByTagName('item_lf')[i];

						var licz = 410 + i;
						
						if(i > 2) {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '" style="display: none;">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
						else {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
					}
					
					var mixedSourceLayer = jQuery('#rss_li');
					mixedSourceLayer.html('');
					mixedSourceLayer.append('<div class="source-hd"><img class="source-logo" src="/img/rss/liberation.gif" alt="Liberation" /></div>');

					var iItemsCount = xml.getElementsByTagName('item_li').length;

					for (i = 0; i < 8; i++) {
						var mixedCurrentItem = xml.getElementsByTagName('item_li')[i];

						var licz = 420 + i;
						
						if(i > 2) {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '" style="display: none;">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
						else {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
					}
					
					var mixedSourceLayer = jQuery('#rss_lt');
					mixedSourceLayer.html('');
					mixedSourceLayer.append('<div class="source-hd"><img class="source-logo" src="/img/rss/latribune.gif" alt="Latribune" /></div>');

					var iItemsCount = xml.getElementsByTagName('item_lt').length;

					for (i = 0; i < 8; i++) {
						var mixedCurrentItem = xml.getElementsByTagName('item_lt')[i];

						var licz = 430 + i;
						
						if(i > 2) {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '" style="display: none;">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
						else {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
					}
					
					var mixedSourceLayer = jQuery('#rss_lm');
					mixedSourceLayer.html('');
					mixedSourceLayer.append('<div class="source-hd"><img class="source-logo" src="/img/rss/lemonde.gif" alt="Lemonde" /></div>');

					var iItemsCount = xml.getElementsByTagName('item_lm').length;

					for (i = 0; i < 8; i++) {
						var mixedCurrentItem = xml.getElementsByTagName('item_lm')[i];

						var licz = 440 + i;
						
						if(i > 2) {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '" style="display: none;">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
						else {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
					}

					jQuery('#country4 .loading').hide();
					jQuery('#rss_lf').show();
					jQuery('#rss_li').show();
					jQuery('#rss_lt').show();
					jQuery('#rss_lm').show();
				}
			});
		}
		else if(divname == 'country5') {
			jQuery('#rss_fz').hide();
			jQuery('#rss_wt').hide();
			jQuery('#rss_zt').hide();
			jQuery('#rss_sd').hide();
			
			jQuery('#country5 .loading').show();
			
			$.ajax({
				type: "POST",
				url: "/rss/show/5",
				success: function(xml){

					var mixedSourceLayer = jQuery('#rss_fz');
					mixedSourceLayer.html('');
					mixedSourceLayer.append('<div class="source-hd"><img class="source-logo" src="/img/rss/faz.gif" alt="Faz" /></div>');

					var iItemsCount = xml.getElementsByTagName('item_fz').length;

					for (i = 0; i < 8; i++) {
						var mixedCurrentItem = xml.getElementsByTagName('item_fz')[i];

						var licz = 510 + i;
						
						if(i > 2) {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '" style="display: none;">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
						else {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
					}
					
					var mixedSourceLayer = jQuery('#rss_wt');
					mixedSourceLayer.html('');
					mixedSourceLayer.append('<div class="source-hd"><img class="source-logo" src="/img/rss/welt.gif" alt="Welt" /></div>');

					var iItemsCount = xml.getElementsByTagName('item_wt').length;

					for (i = 0; i < 8; i++) {
						var mixedCurrentItem = xml.getElementsByTagName('item_wt')[i];

						var licz = 520 + i;
						
						if(i > 2) {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '" style="display: none;">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
						else {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
					}
					
					var mixedSourceLayer = jQuery('#rss_zt');
					mixedSourceLayer.html('');
					mixedSourceLayer.append('<div class="source-hd"><img class="source-logo" src="/img/rss/zeit.gif" alt="Zeit" /></div>');

					var iItemsCount = xml.getElementsByTagName('item_zt').length;

					for (i = 0; i < 8; i++) {
						var mixedCurrentItem = xml.getElementsByTagName('item_zt')[i];

						var licz = 530 + i;
						
						if(i > 2) {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '" style="display: none;">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
						else {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
					}
					
					var mixedSourceLayer = jQuery('#rss_sd');
					mixedSourceLayer.html('');
					mixedSourceLayer.append('<div class="source-hd"><img class="source-logo" src="/img/rss/sueddeutsche.gif" alt="Sueddeutsche" /></div>');

					var iItemsCount = xml.getElementsByTagName('item_sd').length;

					for (i = 0; i < 8; i++) {
						var mixedCurrentItem = xml.getElementsByTagName('item_sd')[i];

						var licz = 540 + i;
						
						if(i > 2) {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '" style="display: none;">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
						else {
							mixedSourceLayer.append(
								'<div class="entry" id="rss_' + licz + '">' + 
									'<span class="date">' + mixedCurrentItem.getElementsByTagName('data')[0].firstChild.data + '</span>' +
									'<strong class="title"><a href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '" target="_blank" rel="nofollow">' + mixedCurrentItem.getElementsByTagName('tytul')[0].firstChild.data + '</a></strong>' +
									'<p>' + mixedCurrentItem.getElementsByTagName('tekst')[0].firstChild.data + '<a target="_blank" rel="nofollow" href="' + mixedCurrentItem.getElementsByTagName('link')[0].firstChild.data + '">&raquo;</a></p>' +
								'</div>');
						}
					}

					jQuery('#country5 .loading').hide();
					jQuery('#rss_fz').show();
					jQuery('#rss_wt').show();
					jQuery('#rss_zt').show();
					jQuery('#rss_sd').show();
				}
			});
		}
		
		jQuery(this).parent().parent().parent().children('.rss-wr').children('div#'+divname).show();
		
		return false;
	});
	
	
	jQuery('#hide-rss-box').click(function() {
		jQuery('#rss-box').hide();
		jQuery('#container-main').removeAttr('style');
		jQuery('#show-rss-box').show();
	});

	jQuery('#show-rss-box').click(function() {
		jQuery('#rss-box').show();
		jQuery('#container-main').css({width:'1250px'});
		jQuery('#show-rss-box').hide();
	});
	
	
	jQuery('#select_rss_feed_c1').change(function() { 
		var iId = parseInt(jQuery(this).val());
		showRss('pl', iId);
	});
	
	jQuery('#select_rss_feed_c2').change(function() { 
		var iId = parseInt(jQuery(this).val());
		showRss('us', iId);
	});
	
	jQuery('#select_rss_feed_c3').change(function() { 
		var iId = parseInt(jQuery(this).val());
		showRss('uk', iId);
	});
	
	jQuery('#select_rss_feed_c4').change(function() { 
		var iId = parseInt(jQuery(this).val());
		showRss('fr', iId);
	});
	
	jQuery('#select_rss_feed_c5').change(function() { 
		var iId = parseInt(jQuery(this).val());
		showRss('de', iId);
	});
});

function detectResolution() {
	if(screen.width >= 1280) {
		jQuery('#container-main').css({width:'1250px'});
		jQuery('#show-rss-box').hide();
		jQuery('#rss-box').show();
	}
}