
$(document).ready(function(){
    $('ul.main li a.main').click(function() {
        if($(this).parent().children('ul').is(':visible'))
        {
            $(this).parent().children('ul').hide('fast');
            $(this).parent().children('ul').removeClass('show');
        } else {
            $(this).parent().children('ul').show('fast');
        }

        return false;
    });

    $("ul.topLinks li.main").hoverIntent({
        sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)
        interval: 200, // number = milliseconds for onMouseOver polling interval
        timeout: 200, // number = milliseconds delay before onMouseOut
        over: function() {
            if($(this).siblings('li').children('.mainTab').is(":visible") )
            {
                $(this).siblings('li').children('.mainTab').slideUp('fast');
            }

            if( !$(this).children('.mainTab').is(":visible") ){
                $(this).children('.mainTab').slideDown('fast');
                $(this).addClass('active');
            }
        }, // function = onMouseOver callback (REQUIRED)
        out: function() {
            $(this).removeClass('active');
            if( !$(this).children('.mainTab').is(":animated") ){
                $(this).children('.mainTab').slideUp('fast');
            }
        } // function = onMouseOut callback (REQUIRED)
    });

    $('ul.main li').hover(function() {
            $(this).children().addClass('green');
        },
        function () {
            $(this).children().removeClass('green');
        }
    );

    $('ul.main li ul li').hover(function() {
            $(this).children().addClass('green');
        },
        function () {
            $(this).children().removeClass('green');
        }
    );

    $('ul.topLinks li ul li').hover(function() {
            $(this).addClass('whiteBG');
            $(this).children().addClass('green');
        },
        function () {
            $(this).removeClass('whiteBG');
            $(this).children().removeClass('green');
        }
    );

    $('#rotate li').hover(function() {
            $(this).children('.caption').fadeIn("fast");
        },
        function () {
            $(this).children('.caption').fadeOut("fast");
        }
    );

    $('#rotate').cycle({
        fx:     'fade',
        pager: '.pager',
        next: '.next',
        prev: '.prev',
        timeout: 6000,

        pagerAnchorBuilder: function(idx, slide) {
            return '<span class="circle"></span>';
        }
    });

    $("form.search label").inFieldLabels();
    $("form.email label").inFieldLabels();
});

