﻿var subsites = new function() { };

function subsite(index, image, activeimage) {
    this.index = index;
    this.image = image;
    this.activeimage = activeimage;
}
        
$(document).ready(function() {
    $('.subsite_tree').hide();
    $('.subsite_image').click(function() {

        /* hide all trees */
        $('.subsite_tree').hide();

        /* reset all images */
        $.each(subsites, function() {
            $('#subsiteimage_' + this.index).attr('src', '/' + this.image);
        });

        /* show the tree of the clicked image */
        $(this.id.replace('subsiteimage_', '#subsitetree_')).show();

        /* change the image to an active image */
        $(this).attr('src', '/' + subsites[this.id.replace('subsiteimage_', '')].activeimage);
        changeHeightForBackground();
    });
    changeHeightForBackground();
});
