$(document).ready(function() {
    $('#quick-links').accordion({
        header: '.acc',
        disabled: false
    });

    $('#myscroll').jcarousel({
        auto: 2,
        scroll: 1,
        wrap: 'both',
        initCallback: function (carousel) {
            $('#r-arrow').bind('click', function() {
                carousel.startAuto(0);
                carousel.next();
                return false;
            });

            $('#l-arrow').bind('click', function() {
                carousel.startAuto(0);
                carousel.prev();
                return false;
            });

            // Pause autoscrolling if the user moves with the cursor over the clip.
            carousel.clip.hover(function() {
                carousel.stopAuto();
            }, function() {
                carousel.startAuto();
            });

        },
        visible: 5,
        animation: 'slow'
    });

    // Get news from the news page.
    var address = '/corporate/news.asp';
    $('ul.news').html('');
    $('<div id="tmp"></div>').insertAfter('#ft');
    $('#tmp').css({visibility: 'hidden'});
    $('#tmp').load(address+' #content', function() {
        $('#tmp #content .article:lt(2)').each(function() {
            var title = $(this).find('h3').html();
            var body = $(this).find('p:lt(1)').html();
            var html = "<li><h3><a href='"+address+"#"+title.replace(/ /g,'-')+"'>"+title+"</a></h3><p>"+body;
            html = html.substr(0,220+title.length)+'<a href="'+address+'#'+title+'">...more</a></p></li>';
            $('ul.news').append(html);
        });
        $('#tmp').remove();
    });

    $('#promo').easySlider({
        controlsShow: false,
        speed: 6400,
        auto: true,
        pause: 3600,
        continuous: true
    });
    
});
