
var SPEED = 2000;
var TIMEOUT = 9000;


$(document).ready
(
    function()
    {    
        initLightBox();
        startSlideshow();
    }
); 

function startSlideshow()
{
    if( !$('#photos_collection').length ) return false;
    
    $('#photos_collection').cycle({fx: 'fade', speed: SPEED, timeout: 0, 
        after: function()
        {    
            $('#photos_collection').cycle('pause');
        }
    });
    $('.photo_title').cycle( {fx: 'fade', speed: SPEED, timeout: 0, cleartype:  true, cleartypeNoBg:  true, 
        after: function()
        {
            $('.photo_title').cycle('pause');
        } 
    });    
    $('#photos_collection').cycle('pause');
    $('.photo_title').cycle('pause');
    
    window.setInterval( slide, TIMEOUT );
}

function slide()
{                                       
    $('#photos_collection').cycle('next');
    $('.photo_title').cycle('next');    
}


function showSubMenu( id )
{
    hideSubMenu();
    
    var offset = $('#m_item_'+id).offset();
    var submenu = $('#submenu_'+id);
    submenu.css( 'left', offset.left - 10 + 'px' );

    submenu.css( 'display', 'block' );
}

function hideSubMenu()
{
    $('div [id^=submenu_]').css( 'display', 'none' );    
}

function overBottomMenu( id )
{
    $('#b_menu_caption_'+id).addClass( 'b_menu_caption_hover' );
}

function outBottomMenu()
{
    $('.b_menu_caption').removeClass( 'b_menu_caption_hover' );
    $('.b_menu_caption').addClass( 'b_menu_caption' );
}



function initLightBox()
{
    $(function() {
        $('#newsletters').lightBox
        (
            {
                /*imageLoading: baseUrl + 'public/js/lightbox/images/lightbox-ico-loading.gif'*/
            }
        );
    });
}

function _finish() 
{
    $('#jquery-lightbox').remove();
    $('#jquery-overlay').fadeOut(function() { $('#jquery-overlay').remove(); });
    // Show some elements to avoid conflict with overlay in IE. These elements appear above the overlay.
    $('embed, object, select').css({ 'visibility' : 'visible' });
}