
jQuery.fn.accessNews = function( settings ) {
	settings = jQuery.extend({
		slideElements : 3
    }, settings);
    return this.each(function() {
		jQuery.fn.accessNews.run( jQuery( this ), settings );
    });
};

jQuery.fn.accessNews.run = function( $this, settings ) {
	var ul = jQuery( "ul:eq(0)", $this );
	var li = ul.children();
	if ( li.length == settings.slideElements ) {
        jQuery(".description").hide();
        var firstimg = jQuery( "ul li:eq(0) img", $this );
	img = jQuery('<img></img>')
        img.appendTo("#container");
        img.attr('src', firstimg.attr('src'));
	img.attr('width', 411).attr('height', 253);
			
        para = jQuery('<div></div>');
        para.appendTo("#container");
        var firstli = jQuery( "#zmieniak_in ul li:eq(0)");
        
        para.html("<h2 id='sl_news_title'>" +  jQuery('a.title', firstli ).text() + "</h2>" + "<p id='sl_news_text'>" + jQuery('p.description', firstli).html() + "</p>");
			
        firstli.addClass('selected');
			 
        li.hover(
            function () {
                li.removeClass('selected')
                var current = jQuery(this);
                current.addClass('selected');
                img.attr('src', current.find('img').attr('src'));
		$("#zmieniak_in #container img").attr("width", 117).attr("height",67);
		img.attr('width', 411).attr('height', 253);	//removeAttr('height');
                para.html("<h2 id='sl_news_title'>" +  jQuery('.title', current).text() + "</h2>" + "<p id='sl_news_text'>" + jQuery('.description', current).html() + "</p>");
            },
            function () {
  		        //current.parent().css('backgroundColor', 'transparent');
        });
    }
};
