/* gallery vars */
var inactiveImageHeight = '60px';
var inactiveImageOffset = '-95px';
var activeImageHeight = '250px';
var initialFade = 500;
var shadowFade = 500;
var imageFade = 500;
var ie7 = false;

/* nav + links highlights */
$(document).ready(function(){
    if(!ie7){
        /* image span highlights */
        var items = $('#nav a:not(#nav li.current a), #right a.banner-link');
        $('span', items).css({'opacity': 0, 'display': 'block'});
        items.bind('mouseenter', function(){    
            $('span', this).animate({'opacity':1}, {queue:false, duration:500}, 'swing');
            //$('span', this).fadeIn({queue:false, duration:500});
        });
        items.bind('mouseleave', function(){    
            $('span', this).animate({'opacity':0}, {queue:false, duration:500}, 'swing');
            //$('span', this).fadeOut({queue:false, duration:500});
        });
    }
    /* text link bottom border highlights */
    var items = $('.home .txt-link, .home .bottom a, #centre a, .featured #left a, .about #contact a.txt-link');
    
    items.bind('mouseenter', function(){    
        //$(this).animate({borderBottomColor:$(this).css('color')}, {queue:false, duration:300}, 'swing');
        $(this).animate({backgroundColor:'#dfefb5'}, {queue:false, duration:300});
    });
    items.bind('mouseleave', function(){    
        //$(this).animate({borderBottomColor:'#FFFFFF'}, {queue:false, duration:300}, 'swing');
        $(this).animate({backgroundColor:'#ffffff'}, {queue:false, duration:300});
    });
    /* gallery */
    
    if($('ul.gallery').length){
        $('.gallery-current .shadow').hide();//.fadeOut({queue:false, duration: 500});
        $('.gallery-current').nextAll('li').children('.shadow-bottom').fadeOut(initialFade);
        $('.gallery-current').animate({height: activeImageHeight}, initialFade);
        $('.gallery-current img').animate({top: '0'}, initialFade);
        
        $('ul.gallery li').bind('mouseenter', function(){
            if(!$(this).hasClass('gallery-current')){
                safe = false;
                /* fix class */
                $('ul.gallery li').removeClass('gallery-current');
                $(this).addClass('gallery-current');
                /* height + img */
                $(this).siblings('li').animate({height: inactiveImageHeight}, {queue: false, duration:imageFade});
                $(this).siblings('li').children('img').animate({top: inactiveImageOffset}, {queue: false, duration:imageFade});
                $(this).animate({height: activeImageHeight}, {queue: false, duration:imageFade});
                $('img', this).animate({top: '0'}, {queue: false, duration:imageFade});
            }
        });
    }
});