/**
 * Set thickbox loading image 
 */
tb_pathToImage = "./img/loading-thickbox.gif";


/**
 * Carousel - Drazedni kalendar
 */
function calendarCarousel_initCallback(carousel) {
 
    jQuery('#auction-calendar-carousel-next').bind('click', function() {
        carousel.next();
        return false;
    });
 
    jQuery('#auction-calendar-carousel-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};
 
// Ride the carousel...
jQuery(document).ready(function() {
    jQuery("#auction-calendar-carousel").jcarousel({
        scroll: 1,
        wrap: 'last',
        initCallback: calendarCarousel_initCallback,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
});



/**
 * Carousel - TOP nabidky
*/
function mycarousel_itemLoadCallback(carousel, state)
{
    // Check if the requested items already exist
    if (carousel.has(carousel.first, carousel.last)) {
        return;
    }

    jQuery.get(
        './script/dynamic_ajax_php.php',
        {
            first: carousel.first,
            last: carousel.last
        },
        function(xml) {
            mycarousel_itemAddCallback(carousel, carousel.first, carousel.last, xml);
        },
        'xml'
    );
};

function mycarousel_itemAddCallback(carousel, first, last, xml)
{
    // Set the size of the carousel
    carousel.size(parseInt(jQuery('total', xml).text()));

    jQuery('content', xml).each(function(i) {
        carousel.add(first + i, mycarousel_getItemHTML(jQuery(this).text()));
    });
};

/**
 * Item html creation helper.
 */
function mycarousel_getItemHTML(content)
{
    return '<div>' + content + '<\/div>';
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        // Uncomment the following option if you want items
        // which are outside the visible range to be removed
        // from the DOM.
        // Useful for carousels with MANY items.
	
        //itemVisibleOutCallback: {onAfterAnimation: function(carousel, item, i, state, evt) { carousel.remove(i); }},
        scroll: 1,
        wrap: 'last',
        itemLoadCallback: mycarousel_itemLoadCallback
    });
});


/**
 * Rozjeti detailu nemovitosti
 */
jQuery(document).ready(function()
{
       $('#show-div-offer-detail').click(function(){
           $('#show-div-offer-detail').hide();
           $('#offer-detail-bottom-content-full').show();
       });
         
});


/**
 * Rozjeti vice informaci o drazbe - vypis drazeb 
 */
jQuery(document).ready(function()
		{
		       $('#show-div-auction-more').click(function(){
		           $('#show-div-auction-more').hide();
		           $('#drazba-info-more').show();
		       });
		         
		});

