function mycarousel_itemLoadCallback(carousel, state)
{
    // Since we get all URLs in one file, we simply add all items
    // at once and set the size accordingly.
    if (state != 'init')
        return;
        
    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });        

    jQuery.get('http://www.lesgrossman.cz/slide.xml', function(xml) {
        mycarousel_itemAddCallback(carousel, carousel.first, carousel.last, xml);
    });
};

function mycarousel_itemAddCallback(carousel, first, last, xml)
{   
    // Set the size of the carousel
    carousel.size(parseInt(jQuery('total', xml).text()));


    // Simply add all items at once and set the size accordingly.    
     jQuery('item', xml).each(function(i) {
        var url=jQuery(this).find("url").text();
        var title=jQuery(this).find("title").text();
        var p=jQuery(this).find("p").text();
        var img=jQuery(this).find("img").text();

        carousel.add(i+1, getLiSlide(url, title, img, p));
    });
       
        
          
};

function getLiSlide(url, title, img, p)
{
  return '<img width="250" height="150" src="'+img+'" class="img-slide" alt="'+title+'" title="'+title+'" align="right">	<p class="nadpis-slide"><a href="'+url+'" title="'+title+'">'+title+'</a></p><p>'+p+'</p>';
}



jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        auto: 6,
        wrap: 'last',
        scroll: 1,
        itemLoadCallback: mycarousel_itemLoadCallback
    });
});

function onLoadActions()
{
  var fb='<iframe src="http://www.facebook.com/plugins/likebox.php?id=139435336093773&amp;width=200&amp;connections=5&amp;stream=false&amp;header=true&amp;height=287" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:200px; height:287px;"></iframe>'; 
  $('#facebookbox').html(fb);

}



  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-7491496-6']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
