jQuery(document).ready(function($) {

    $('.more-trigger').click(function(){
        var e = $('.attributesplash-view-index .category-description');
        e.slideToggle();

        if($('.more-trigger').text() == 'More >'){
            $('.more-trigger').text('Less >');
        }else{
            $('.more-trigger').text('More >');
        }
    });

    $('#map').click(function(){
        $('#contacts-tabs-contact').css('display', 'none');
        $('#contacts-tabs-map').css('display', 'block');
    });
    $('#contacts').click(function(){
        $('#contacts-tabs-contact').css('display', 'block');
        $('#contacts-tabs-map').css('display', 'none');
    });

    $('.home-ranges-links a').hover(
        function(){
            $(this).find('.desaturated').css('display', 'none');
            $(this).find('.saturated').css('display', 'block');
        },
        function(){
            $(this).find('.desaturated').css('display', 'block');
            $(this).find('.saturated').css('display', 'none');
        });


    // The height of the content block when it's not expanded
    var adjustheight = 148;
    // The "more" link text
    var moreText = "More >";
    // The "less" link text
    var lessText = "< Less";

    var count = $('.more-block').text().length;


    if(count > 340){

        // Sets the .more-block div to the specified height and hides any content that overflows
        $(".more-less .more-block").css('height', adjustheight).css('overflow', 'hidden');
        
        //// The section added to the bottom of the "more-less" div
        // Set the "More" text
        $("a.adjust").text(moreText);

        $(".adjust").toggle(function() {
            $(this).parents("div:first").find(".more-block").css('height', 'auto').css('overflow', 'visible');
            // Hide the [...] when expanded
            $(this).parents("div:first").find("p.continued").css('display', 'none');
            $(this).text(lessText);
        }, function() {
            $(this).parents("div:first").find(".more-block").css('height', adjustheight).css('overflow', 'hidden');
            $(this).parents("div:first").find("p.continued").css('display', 'block');
            $(this).text(moreText);
        });
    }

    $('#visit-us-list a').fancybox();

});
jQuery.noConflict();





function externalLinks() {
    if (!document.getElementsByTagName) return;
    var anchors = document.getElementsByTagName("a");
    for (var i=0; i<anchors.length; i++) {
        var anchor = anchors[i];
        if (anchor.getAttribute("href") &&
            anchor.getAttribute("rel") == "external")
            anchor.target = "_blank";
    }
}
window.onload = externalLinks;
