﻿$(function () {
    carregardados();
});
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;
    $.post("carrosel.aspx", function (data) {
        if (data != '') {
            $("#BarraDeServicos").show();
            mycarousel_itemAddCallback(carousel, carousel.first, carousel.last, data);
        }
        else {
            $("#BarraDeServicos").hide();
        }
    });

};

function mycarousel_itemAddCallback(carousel, first, last, data) {
    // Simply add all items at once and set the size accordingly.
    var items = data.split('|');
    for (i = 0; i < items.length; i++) {
        carousel.add(i, mycarousel_getItemHTML(items[i]));
    }

    carousel.size(items.length);
    //IniciarAlbum();
};

/**
* Item html creation helper.
*/
function mycarousel_getItemHTML(url) {
    return url;
};

function IniciarAlbum() {
    //$('#mycarousel a').lightBox();
}
function carregardados() {
    //$("#mycarousel ul").html("");
    jQuery('#mycarousel').jcarousel({
        itemLoadCallback: mycarousel_itemLoadCallback
    });
}
