$(document).ready(function () {
	stripeTableByRel();
	externalLinks();
	selector = "#index img";
	pocet = $(selector).length;
	if (pocet>1) interval = setInterval("fading()",6000);
	else $(selector).show();
	$("#hMenu ul li ul li:first").addClass("first");
});

var i = 0;
var pocet = 0;
function fading() {
	if (i==pocet) i = 0;
	selector = "#img" + i;
	$(selector).fadeOut(2000)
	i++;
	if (i==pocet) i = 0;
	selector = "#img" + i;
	$(selector).fadeIn(2000);
	
}

function stripeTable(t) {
	var i, odd = true;
	for (i=0; i<t.rows.length; i++) {
		t.rows[i].className += odd ? ' odd' : ' even';
		odd = !odd;
	}
}
function stripeTableById(id) {
	var t = document.getElementById(id);
	if (t) stripeTable(t);
}

function stripeTableByRel() {
	var t = document.getElementsByTagName('TABLE');
	for (var i=0; i<t.length; i++) {
			if (t[i].getAttribute("rel")=="stripes") stripeTable(t[i]);
	}
}

function stripeAllTables() {
	var t = document.getElementsByTagName('TABLE');
	for (var i=0; i<t.length; i++) stripeTable(t[i])
}

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";
		}
	} 
}

