
/** vygeneruje menu */
function genMenu() {
  $(".submenu").corner('bottom 5px');
  $("div.submenu ul li a").each(function(index){
    $(this).corner('5px');
  });

  //var activeMenuEntry = $("a.menuAct-act");

  $("#menu li.hasSubmenu").hover(
    function() {
      $('div.submenu', this).fadeIn(200);
      $('a', this).addClass('menuAct');
      $('div.submenu', this).animate({
        opacity: 0.95
      }, 1);
    //activeMenuEntry.removeClass('menuAct-act');
    },
    function() {
      $('div.submenu', this).fadeOut(200);
      $('a', this).removeClass('menuAct');
      //activeMenuEntry.addClass('menuAct-act');
      clearInfo(this);
    }
    );

  if(jQuery.browser.msie && parseInt(jQuery.browser.version, 10) == 6) {
    try {
      document.execCommand("BackgroundImageCache", false, true);
    } catch(err) {}
  }
}

/** pro menu, po najeti na polozku zobrazi popis */
var orig_popis = "";
function showInfo(img, text, thisObj) {
  if( orig_popis=="" ) {
    orig_popis = $(thisObj).parent().parent().parent().children('div.info').html();
  }

  var htmlNew = "";
  if( img!='' ) {
    htmlNew += '<img src="'+img+'" alt="" title="" width="50" />';
  }
  htmlNew += text;
  $(thisObj).parent().parent().parent().children('div.info').html(htmlNew);
}

/** pro menu, po odjeti z polozky zlikviduje popis */
function clearInfo(thisObj) {
  $(thisObj).parent().parent().parent().children('div.info').html(orig_popis);
  orig_popis = '';
}

/** linkbuilding v paticce */
function linkbuild() {
  $('#linkbuild-open').click(function() {
    $('#linkbuild-div').show('slow');
    return false;
  });

  $('#linkbuild-close').click(function() {
    $('#linkbuild-div').hide('slow');
    return false;
  });
}

/** footer carousel */
function footercarousel_initCallback(carousel) {
  jQuery('#footercarousel-next').bind('click', function() {
    carousel.next();
    return false;
  });

  jQuery('#footercarousel-prev').bind('click', function() {
    carousel.prev();
    return false;
  });
};

/** flash player */
function flashBox() {
  try
  {
    AC_FL_RunContent(
      'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
      'width', '100%',
      'height', '100%',
      'src', 'tpl/web/flash/slider',
      'quality', 'high',
      'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
      'align', 'middle',
      'play', 'true',
      'loop', 'true',
      'scale', 'noscale',
      'wmode', 'Transparent',
      'devicefont', 'false',
      'id', 'play',
      'name', 'play',
      'menu', 'true',
      'FlashVars', 'baseDir=tpl/web/flash/',
      'allowFullScreen', 'true',
      'allowScriptAccess','sameDomain',
      'movie', 'tpl/web/flash/slider',
      'salign', 'lt'
      ); //end AC code
  }
  catch(e){
    if(window.console && window.console.log)
      window.console.log("This page requires AC_RunActiveContent.js.");
  }
}




/**
 * az tady spustime potrebne funkce
 */
$(document).ready(function() {
  genMenu();
  linkbuild();

  // Ride the carousel...
  jQuery("#footercarousel").jcarousel({
    scroll: 3,
    auto: 3,
    horizontal: true,
    wrap: 'circular',
    initCallback: footercarousel_initCallback,
    // This tells jCarousel NOT to autobuild prev/next buttons
    buttonNextHTML: null,
    buttonPrevHTML: null
  });
});
