function parseIntoNewsItems(el) {

		$(el).find('a').slice(0,3).each(
        function (ind, el) {
            var href = $(el).attr('href');
            var linktext = $(el).text();
    				
            if (href != '' && linktext != '') {
                $('<li><span>&gt;</span><a href="' + href + '">' + linktext + '</a></li>').appendTo('#news ul');
            
						}
        }
    );
}

$(document).ready(function() {
	$("a#brief").click(function() {
		$.fancybox({
				'padding'		: 0,
				'autoScale'		: false,
				'transitionIn'	: 'none',
				'transitionOut'	: 'none',
				'title'			: this.title,
				'width'		: 764,
				'height'		: 428,
				'href'			: this.href,
				'type'			: 'swf',
				'swf'			: {
				  'wmode'		: 'transparent',
					'allowfullscreen'	: 'true',
					'flashVars' : 'targetPath=/en/assets/swf/',
					'width' : '764',
					'height' : '428'
				}
			});

		return false;
	});
	
	
	/*$("a#brief").click(function() {
		$.fancybox({
			'type' : 'swf',
			'swf' : {
				'wmode'		: 'transparent',
				'allowfullscreen'	: 'true',
				'flashVars' : 'targetPath=/assets/swf/'
			}
		});
		return false;
	});*/
	
	var news = $('<div></div>').load(
          '/on-elisa/corporate/press/ #porssitiedotteet dd', '', 
          
          function(responseText, textStatus, XMLHttpRequest) {
              if (textStatus == 'success') {
              	parseIntoNewsItems($(this));
              }
          }
  );
});

