var popup;
function imagePopup(src, title, width, height) {
    if (popup) popup.close();
    var p = 'toolbar=no,menubar=no,location=no,directories=no,scrollbars=no,resizable=no,status=no,width=' + width + ',height=' + height + ',left=' + (screen.availWidth / 2 - width / 2) + ',top=' + (screen.availHeight / 2 - height / 2);
    popup = window.open('', 'imagePopupTarget', p);
    with (popup) {
        focus();
        document.writeln('<?xml version="1.0" encoding="Windows-1250"?>');
        document.writeln('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
        document.writeln('<html xmlns="http://www.w3.org/1999/xhtml">');
        document.writeln('<head>');
        document.writeln('<meta http-equiv="content-type" content="text/html;charset=Windows-1250" />');
        document.writeln('<meta http-equiv="imagetoolbar" content="no" />');
        document.writeln('<title>' + title + '</title>');
        document.writeln('<style>');
        document.writeln('body { margin: 0; padding: 0; }');
        document.writeln('img { border: none; cursor: pointer; }');
        document.writeln('</style>');
        document.writeln('</head>');
        document.writeln('<body>');
        document.writeln('<div id="page"><img onclick="window.close()" src="' + src + '" width="' + width + '" height="' + height + '" alt="' + title + '" title="klikn�te pro zav�en� tohoto okna" /></div>');
        document.writeln('</body></html>');
        }
    return false;
}
function pagePopup(src, width, height) {
    var p = 'toolbar=no,menubar=no,location=no,directories=no,scrollbars=yes,resizable=yes,status=yes,width=' + width + ',height=' + height + ',left=' + (screen.availWidth / 2 - width / 2) + ',top=' + (screen.availHeight / 2 - height / 2);
    var popup = window.open(src, 'pagePopupTarget', p);
    popup.focus();
    return false;
}
function runMessenger(path) {
    window.open(path + "/Online-Recepce.html", "messenger", "status=0,toolbar=0,location=0,directories=0,scrollbars=0,width=310,height=430");
}
// Function that return a number between 0 and "nums - 1"
function getRandom(nums) {
    var ranNum = Math.round(Math.random() * nums);
    return ranNum;
}
function switchBanners() {    
    var randomBanner = getRandom(3);
    $('#bannerEshop a')
    .fadeOut('fast')
    .css('background-position', '0px -' + randomBanner * 65 + 'px')
    .fadeIn('fast');
}
function switchBannerText(){
    var cText1 = $('.active .centerText1');
    var cText2 = $('.active .centerText2');

    if(cText1.hasClass('active')){
        cText1.fadeOut();
        cText1.removeClass('active');
        cText2.addClass('active');
        cText2.fadeIn();
    } else{
        cText2.fadeOut();
        cText2.removeClass('active');
        cText1.addClass('active');
        cText1.fadeIn();
    }
}
function hideVacuBanner(){
    var banner = $('#bodySpaceBanner');    
    var speed = 250;

    banner.animate({
        height:'45px',
        opacity: 0
    }, speed, 'linear', function(){
        banner.removeClass('active');
        $('.centerText1').removeAttr("style");
        $('.centerText2').removeAttr("style");
        banner.animate({opacity:100}, speed*100, 'linear');
    });
    $('.contentMainpage').animate({
        marginTop:'485px'
    }, speed, 'linear');
}
$(document).ready(function() {
    if ($('#lista').length == 1) {
        if ($('#partners p').length == 1) {
            $('#partners p').append('| ' + $('#lista').html());
        } else {
            $('#partners').html('<p>Partne�i: ' + $('#lista').html() + '</p>');
        }
        $('#lista').remove();
    }   
});
