$(document).ready(function(){
	
	if($("#page.print").length > 0) {
		if(confirm("Přejete si vytisknout tuto stránku?")) {
			window.print();
		}
	}
	
	
	if($("#header .txt").css("display") == "none") {
		return false;
	}
	//lightboxes();
	
	$("#articlewrap, #article .content").corner("rounded 25px");
	$("#article").corner("rounded 13px");
	//$("#ulnav").corner("bl br rounded 25px");
	$(".block").corner("tl bl rounded 25px");
	
	$(".block").animate({ 
        opacity: 0.9
      }, 500 );
	
	$("#backBtn").click(function(){ history.back(); return false;});
	//$(".block").css({opacity: 0.5});
	$(".bContent").jScrollPane({
			scrollbarWidth: 5,
			scrollbarMargin: 20,
			showArrows: true
	});
	
	galleryfader();
	
});

this.lightboxes = function() {
	
	// lb musi byt <a rel="lightbox-galerie"..
	
	str = '';
	$('a[rel^=lightbox]').each(function(){
		uq = $(this).attr("rel").substr(9);
		if(str.indexOf("<" + uq + ">") == -1) {
			str += "<" + uq + ">";
		}
	});
	gals = str.substr(1, str.length-2).split("><");
	for(i = 0; i < gals.length; i++) {
		$("a[rel=lightbox-" + gals[i] + "]").lightBox({
			containerResizeSpeed: 400,
			txtImage: "Obrázek / Image :",
			txtOf: "/",
			imageLoading: "/img/lb-loading.gif",
			imageBtnClose: "/img/lb-btn-close.gif",
			imageBtnPrev: "/img/lb-btn-prev.gif",
			imageBtnNext: "/img/lb-btn-next.gif"
		});
	}

}

this.galleryfader = function() {

	if($(".fadein img").length < 2) {
		return false;
	}
	
	$('.fadein img:gt(0)').hide();
	setInterval(function(){
		$('.fadein :first-child').fadeOut(2000)
		.next('img').fadeIn(2000)
		.end().appendTo('.fadein');}, 
	3000);

}
