function setExternalLinks() {
	$("a[rel*=external], a[rel*=link-external]").click( function() {
		this.title	= "otwiera nowe okno";
        window.open(this.href);
        return false;
    });
}


function loadDropDownMenuForiOSDevices() {
	// Apple iPhone, iPad
	$('#layer-top ul li h3').live('touchend', function(e) {
		var oDivParent	= $('#layer-menu');
		var oLiParent		= $(this).parent();
		var oThisUL		= $("ul", oLiParent);
		var oThisULCurrent	= oThisUL.css("display");
		// Schowaj pozostale rozwijane menu
		$("ul ul", oDivParent).css("display", "none");
		// Rozwin biezace menu
		if (oThisULCurrent == "block") {
			oThisUL.css("display", "none");
		} else {
			oThisUL.css("display", "block");
		}
	});
}


function setPrintLink() {
	$("#action-print").click(function() {
		window.print();
		$(this).removeAttr("href");	// Firefox would use the href attribute if we left it here.
		$(this).css("cursor", "pointer");	// But without href, browser does not change the cursor to the "hand" icon.
		return false;
	});
}


function setHomeLink() {
	$("#layer-link-home").css("cursor", "pointer");
	$("#layer-link-home").attr("title", "Powrót do strony głównej");
	$("#layer-link-home").click(function() {
		location.href	="/";
	});
}



// All functions gathered in this file are fired up when page is loaded.
$(document).ready(function() {
	setExternalLinks();
	loadDropDownMenuForiOSDevices();
	setHomeLink();
//	setPrintLink();
});

