jQuery.noConflict();

jQuery(document).ready(function($) {

    $('ul.services li ul.overflow').css({ 'overflow': 'hidden', 'height': '181px' });
    $('ul.services>li').each(function(index) {
        var ul = $('<ul class="linksList"></ul>');
        $('ul li', $(this)).each(function(index) {
            var name = $(this).find('h3').text();
            var link = $(this).find('a').attr('href');
            var id = $(this).attr('id');
            var anchor = $('<a></a>').text(name);
            anchor.attr('href', link).attr('rel', index);
            $('<li></li>').append(anchor).appendTo(ul);
        });
        ul.appendTo($(this));
        $('ul.linksList > li > a').hover(function() {
            $(this).closest('ul.services>li').find('ul.overflow li').stop().animate({
                'top': 0 - ($(this).attr('rel') * 199) + 'px'
            }, 300);
        }, function() {
            $(this).closest('ul.services>li').find('ul.overflow li').stop().animate({
                'top': '150'
            }, 300);
        });
    });

    $('ul.overflow').hover(function() {
        $(this).children('li').stop().animate({ 'top': '0' }, 300);
    }, function() {
        $(this).children('li').stop().animate({ 'top': '150' }, 300)
    })






    $('table.inner-boxes').each(function() {
        var h = 0;
        $(this).find('div.inner-boxes-content').each(function() {
            var th = $(this).height();
            if (th > h) {
                h = th;
            }
        }).height(h);
    });

    $('#homeBanner div.itemContent a').bigTarget({ clickZone: 'div:eq(0)' });

    $('div.serviceBlock td').hover(function() {
        $(this).addClass('hover');
    }, function() {
        $(this).removeClass('hover');
    });
    var h = 0;
    $('div.serviceBlock div.whiteBox').each(function() {
        var th = $(this).height();
        if (th > h) {
            h = th;
        }
    }).height(h);

    $('div.homeDropDown h2').click(function() {
        $(this).toggleClass('open').next().slideToggle();
    });

    $('#homeBanner ul li').each(function(i, e) {
        var $this = $(this);

        $this.find('h2').each(function(i, e) {
            $(this).addClass('h' + i);
        }).appendTo($this);
    });

    $('div.homeFooter div.feedCaseStudy div.carouselMask ul').adidoCarousel({ pager: false, pagerElement: 'div.homeFooter div.feedCaseStudy div.carouselPager', pagerStyle: 'numeric', resizeMask: true });
    //$('#homeBanner div.carouselMask ul').adidoCarousel({ pager: true, pagerAuto: false, pagerElement: '#homeBanner div.carouselPager', mode: 'fade', animDelay: 200 });
    $('#homeBanner div.carouselMask ul').adidoCarousel({ pager: false, pagerAuto: false });

    $(':first-child').addClass('first');
    $(':last-child').addClass('last');
});
