function change_front(id, continue_slide){
	if (!continue_slide && SLIDESHOW_ID){
		clearTimeout ( SLIDESHOW_ID );
		SLIDESHOW_ID= setInterval ( "continue_slideshow()", 15000 );
		CURRENT_ITEM_FRONT_SLIDESHOW=id;
	}

	for (var i=1; i<SLIDE_ROWS_LENGTH; i++){
		$('.nn_front_'+i)[0].style.display = 'none';
	}	
	$('.nn_front_'+id)[0].style.display = '';
	
	clear_new_colors();
	$(SLIDE_SHOW_DIV+id+' .views-field-title .field-content a')[0].style.color = "#ff0000";
}

CURRENT_ITEM_FRONT_SLIDESHOW=1;
SLIDESHOW_ID = '';
SLIDE_SHOW_DIV_NAJNOWSZE = '.view-10-najnowsze-artykuly-redakcyjne .view-content .views-row-';
SLIDE_SHOW_DIV_LUBIANE = '.view-10-najchetniej-czytanych .view-content .views-row-';
SLIDE_SHOW_DIV = '';
SLIDE_ROWS_LENGTH = 0;

function clear_new_colors(){
	for (var i=1; i<SLIDE_ROWS_LENGTH;i++){
		$(SLIDE_SHOW_DIV+i+' .views-field-title .field-content a')[0].style.color = "";
	}
}

function front_slide_show(){
	$(SLIDE_SHOW_DIV+CURRENT_ITEM_FRONT_SLIDESHOW+' .topten')[0].style.color = "";
	CURRENT_ITEM_FRONT_SLIDESHOW++;
	if (CURRENT_ITEM_FRONT_SLIDESHOW==SLIDE_ROWS_LENGTH) CURRENT_ITEM_FRONT_SLIDESHOW=1;
	$(SLIDE_SHOW_DIV+CURRENT_ITEM_FRONT_SLIDESHOW+' .topten .views-field-title .field-content')[0].style.color = "#be0000";
	change_front(CURRENT_ITEM_FRONT_SLIDESHOW, true);
}

function main_art_click(id){
	this.location.href = $('.nn_front_' + id + ' .topten')[0].href;
}

function continue_slideshow(){
	clearTimeout ( SLIDESHOW_ID );
	SLIDESHOW_ID= setInterval ( "front_slide_show()", 5000 );
}

$(document).ready(function() {	

	if (SLIDE_SHOW_DIV==SLIDE_SHOW_DIV_LUBIANE)
		SLIDE_ROWS_LENGTH=13;	
	else
		SLIDE_ROWS_LENGTH=13;

	$('.view-10-najchetniej-czytanych .view-content .views-row').length
	SLIDESHOW_ID= setInterval ( "front_slide_show()", 5000 );
	$(SLIDE_SHOW_DIV+1+' .topten .views-field-title .field-content')[0].style.color = "#ff0000";
});


function resize_front_1_banner(width){
	var element = $('#front_left_1_banner')[0];
	element.style.marginLeft = "-300px";
	element.style.position = "relative";
	element.style.width = "420px";
	element = $('#front_left_1_banner #Advertisement')[0];
	element.style.width = '420px';
}

function reset_front_1_banner(){
	var element = $('#front_left_1_banner')[0];
	element.style.marginLeft = "0";
	element.style.position = "none";
	element.style.width = "120px";
	element = $('#front_left_1_banner #Advertisement')[0];
	element.style.width = '120px';
}


