// utf-8 !
function odstranDiakritiku(str1)
{
var i,j, str2;
str2 = '';
for(i = 0; i < str1.length; i++)
	{
	j = DIAKRITIKA[0].indexOf(str1.charAt(i));
	if (j!==-1)
		{
		str2 += DIAKRITIKA[1].charAt(j);
		}
	else	{
		str2 += str1.charAt(i);
		}
	}
return str2;
}

function textToFileName(str)
{
return odstranDiakritiku(str).toLowerCase().replace(new RegExp('[^a-z0-9]+','g'),'_').replace(new RegExp('(^_)|(_$)','g'),'');
}

var DIAKRITIKA = [
"áäàãâćčďéěëèêíïìîĺľńňñóôòõöőŕřśšťúùůüũûýźžÁÄÀÃÂĆČĎÉĚËÈÊÍÏÌÎĹĽŃŇÑÓÔÒÕÖŐŔŘŚŠŤÚÙŮÜŨÛÝŹŽ",
"aaaaaccdeeeeeiiiillnnnoooooorrsstuuuuuuyzzAAAAACCDEEEEEIIIILLNNNOOOOOORRSSTUUUUUUYZZ"
];

/*
var DIAKRITIKA_UTF8 = [
'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖÙÚÛÜÝßàáâãäåçèéêëìíîïñòóôõöùúûüýÿĀāĂăĄąĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪīĬĭĮįİıĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇňŉŊŋŌōŎŏŐőŔŕŖŗŘřŚśŜŝŞşŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſ';
'AAAAAACEEEEIIIINOOOOOUUUUYsaaaaaaceeeeiiiinooooouuuuyyAaAaAaCcCcCcCcDdDdEeEeEeEeEeGgGgGgGgHhHhIiIiIiIiIiKkkLlLlLlLlLlNnNnNnNnNOoOoOoRrRrRrSsSsSsSsTtTtTtUuUuUuUuUuUuWwYyYZzZzZzs';
];
*/
//"áäàãâćčďéěëèêíïìîĺľńňñóôòõöőŕřśšťúùůüũûýźžÁÄÀÃÂĆČĎÉĚËÈÊÍÏÌÎĹĽŃŇÑÓÔÒÕÖŐŔŘŚŠŤÚÙŮÜŨÛÝŹŽ",
//"aaaaaccdeeeeeiiiillnnnoooooorrsstuuuuuuyzzAAAAACCDEEEEEIIIILLNNNOOOOOORRSSTUUUUUUYZZ"

