window.onload = function()
{
	externalLinks();
	emailLinks();
}

function addFavorite(addURL, addTitle)
{
	if (document.all && !window.opera)
	{
		window.external.AddFavorite(addURL, addTitle);
		return false;
	}
	else if (window.opera && window.print)
	{
		linkObj.title = addTitle;
		return true;
	}
	else if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function'))
	{
		if (window.confirm('Přidat oblíbenou stránku jako nový panel?'))
		{
			window.sidebar.addPanel(addTitle,addUrl,'');
			return false;
		}
	}
	window.alert('Po potvrzení stiskněte CTRL-D,\nstránka bude přidána k vašim oblíbeným odkazům.');
	return false; 
}

function externalLinks()
{
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++)
	{
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") anchor.target = "_blank";
	}
}

function emailLinks()
{
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++)
	{
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("href").search("mailto") != -1)
		{
			anchor.href = anchor.getAttribute("href").replace("[at]", "@");
			anchor.href = anchor.getAttribute("href").replace("[dot]",".");
			anchor.href = anchor.getAttribute("href").replace("[zavinac]", "@");
			anchor.href = anchor.getAttribute("href").replace("[tecka]", ".");
			if (anchor.getAttribute("title"))
			{
				anchor.title = anchor.getAttribute("title").replace("[at]", "@");
				anchor.title = anchor.getAttribute("title").replace("[dot]",".");
				anchor.title = anchor.getAttribute("title").replace("[zavinac]", "@");
				anchor.title = anchor.getAttribute("title").replace("[tecka]", ".");
			}
			anchor.innerHTML = anchor.innerHTML.replace("[at]", "@");
			anchor.innerHTML = anchor.innerHTML.replace("[dot]",".");
			anchor.innerHTML = anchor.innerHTML.replace("[zavinac]", "@");
			anchor.innerHTML = anchor.innerHTML.replace("[tecka]", ".");
		}
	}
}

function goLink(url)
{
	window.location.href=url;
}

function objGet(x)
{
	if (Boolean(document.getElementById)) return document.getElementById(x);
	else if (Boolean(document.all)) return eval('document.all.'+x);
	else if (Boolean(document.ids)) return eval('document.ids.'+x);
	else return null;
}

function showMakers(group)
{
	objGet(group).style.display='block';
	return false;
}

function fvalidate(f)
{
	regEx = /^[a-zA-Z0-9_\-\.]+@[a-zA-Z0-9_\-]+(\.[a-zA-Z0-9_\-]+)+$/;
	if (f.name.value.length<2) {window.alert('Vyplňte prosím Vaše jméno.');f.name.focus();}
	else if (!regEx.test(f.email.value)) {window.alert('Vyplňte prosím Vaši e-mailovou adresu.');f.email.focus();}
	else if (f.text.value.length<5) {window.alert('Chybí text Vášeho dotazu.');f.text.focus();}
	else return(true);
	return(false);
}
