function targetBlank()
{
	var url_match = null;
	var target_domain = null;
	var this_domain = window.location.hostname;
 
	// funkce vrátí doménu z odkazu
	var get_hostname_from_url = function(url)
	{
		if (typeof url == "undefined")
		{
			return null;
		}
 
		url_match = url.match(/:\/\/(.[^/]+)/);
 
		if (url_match != null)
		{
			return url_match[1];
		}
 
		return null;
	}
 
	// vybereme všechny odkazy
	$("a").click(function(event)
	{
		var href = $(this).attr("href");
 
		// získáme doménu cíle odkazu
		target_domain = get_hostname_from_url(href);
 
		// odstraní se www ze začátku odkazu, pokud existuje
		if (target_domain != null && target_domain.indexOf("www.") != -1)
		{
			target_domain = target_domain.substr(4);
		}
 
		// pokud je doména jiná než aktuální, nebo je nastaveno class="targetBlank", otevřeme v novém
		if ($(this).hasClass("targetBlank") == true || (target_domain != null && target_domain != this_domain))
		{
			window.open($(this).attr("href"), "");
			event.preventDefault();
			return false;
		}
	});
}

$(document).ready(function(){ 
// 	targetBlank();
});
