$('.lookbook li a, .campanas li a').lightBox({
    imageLoading:'/images/lightbox-ico-loading.gif',
    imageBtnPrev:'/images//lightbox-btn-prev.gif',
    imageBtnNext:'/images/lightbox-btn-next.gif',
    imageBtnClose:'/images/lightbox-btn-close.gif',
    imageBlank:'/images/lightbox-blank.gif'
}
);

$("#add_more_versions").click(function(e)
{
    var last_row = $(".detalles-on:last").clone();
    $(".detalles-on:last").after(last_row);
});

$(".toggle-order-items").click(function(e)
{
    e.preventDefault();

    $(this).parent().toggleClass("desplegado");
    $(this).parent().next().toggle();
});


$("a[rel='fancybox']").fancybox();

var fancybox_timeout = null;

$(document).ready(function()
{
    if(typeof flash_error != 'undefined')
    {
        $.fancybox('<div style="padding: 15px">' + flash_error + '</div>',
        {
            'onComplete': function()
            {
                closeOnFiveSeconds()
            }
        });
    }

    if(typeof flash_notice != 'undefined')
    {
        $.fancybox('<div style="padding: 15px">' + flash_notice + '</div>',
        {
            'onComplete': function()
            {
                closeOnFiveSeconds()
            }
        });
    }

    if(typeof flash_success != 'undefined')
    {
        $.fancybox('<div style="padding: 15px">' + flash_success + '</div>',
        {
            'onComplete': function()
            {
                closeOnFiveSeconds()
            }
        });
    }
});

function closeOnFiveSeconds()
{
    fancybox_timeout = setInterval('$.fancybox.close()', 3000);
}
