//var prevL;

$(document).ready(function() {
	//$('.numer').height(110);

	//$('.numer').each(function(i) {
	//	var obrazek = $(this).children('.okl_obrazek').children('.okladka').attr('src');
	//	$(this).css('background',  'url('+obrazek+') top left no-repeat' );
	//});
	
	//$('.numer').opacity(.7);

	$('.numer').hoverIntent({
				sensitivity: 3, 
				interval: 100, 
				over: poka, 
				timeout: 500, 
				out: ukryj
			});
		$('#spisik').append($('.archiwum .numer:first').children('.spist').clone())
		$('#spisik .spist').css('visibility', 'visible');
		$('#spisik .spist').show();
		$('#spisik .spist .article').css('visibility', 'visible');
		$('#spisik .spist .article').show();
});

$.fn.opacity = function(amount) {
        if (amount > 1) amount = 1;
        if (amount < 0) amount = 0;
        if ($.browser.msie) {
                amount = (parseFloat(amount) * 100);
                this.css('filter', 'alpha(opacity='+amount+')');
        } else {
                this.css('opacity', amount);
                this.css('-moz-opacity', amount);
        }
        return this;
}

function poka(){
		$(this).opacity(1);
		//prevL.ukryj();
		//prevL = $(this);
		$('#spisik').empty();
		$('#spisik').append($(this).children('.spist').clone())
		$('#spisik .spist').fadeIn('slow');
		$('#spisik .spist').css('visibility', 'visible');
		$('#spisik .spist .article').fadeIn('slow');
		$('#spisik .spist .article').css('visibility', 'visible');
		$(this).children('.okl_obrazek').fadeIn('slow');
		//$(this).children('.okl_obrazek').css('visibility', 'visible');
}

function ukryj(){
		$(this).opacity(.7);
    //$(this).children('.okl_obrazek').hide();
}

sfHover = function() {	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
	sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		};
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");

		};
	};
};
if (window.attachEvent) window.attachEvent("onload", sfHover);

