// pouzivano misto (v norme Strict) zakazaneho target='_blank'
function external(url) {
	win = window.open(url);
	return (typeof(win)=='object') ? false : true;
}

// otevre nove okno - url se zjisti z parametru href
// pouzivano misto (v norme Strict) zakazaneho target='_blank'
function external_link(elem) {
	if (elem.getAttribute('href')) {
		return external(elem.getAttribute('href'));
	}

	return true;
}

var indexPhoto = 1;

// rychlost animace fotky
var speedAnimate = 4000;

// animace fotek
var photo_animate;

function changePhoto()
{
    indexPhoto = indexPhoto + 1;

    if (!document.getElementById('banner-skycraper-' + indexPhoto)) {
        indexPhoto = 1;
    }
}

function runAnimate()
{
    /*
    $("#hlava div.menu-katalog div.vanilla div.image-" + indexPhoto).fadeOut("slow", function () {
        changePhoto();
        $("#hlava div.menu-katalog div.vanilla div.image-" + indexPhoto).fadeIn("slow");

        photo_animate = setTimeout(function() { runAnimate(); }, speedAnimate);
    });
    */
    $("#banner-skycraper-" + indexPhoto).fadeOut(1000);
    changePhoto();
    $("#banner-skycraper-" + indexPhoto).fadeIn(1000);
    photo_animate = setTimeout(function() { runAnimate(); }, speedAnimate);
}

$(document).ready(function() {
    if (document.getElementById('banner-skycraper-1')) {
        photo_animate = setTimeout(function() { runAnimate(); }, speedAnimate);
    }
});
