﻿$(document).ready(function() {

    manageBod();
    showHide();

    $(".txtBox").focus(function(srcc) {
        if ($(this).val() == $(this)[0].title) {
            $(this).removeClass("txtBoxActive");
            $(this).val("");
        }
    });

    $(".txtBox").blur(function() {
        if ($(this).val() == "") {
            $(this).addClass("txtBoxActive");
            $(this).val($(this)[0].title);
        }
    });

    $(".txtBox").blur();

    $('#adminBar ul li:last-child').addClass('last');
});


function headerClass() {

    if ($('#bodList div.bodCopy').hasClass('active')) {
        $('#bodList div.bodCopy').siblings('h3').addClass('highlight')
    }

}

function manageBod() {

    $('.bodDetails > div.bodCopy').hide();

    /*$('#bodList h3, #bodList img').mouseover(function(){
        $(this).css('cursor, pointer');
    }*/
    
    $('#bodList h3').click(function() {

        if ($(this).siblings('div').hasClass('active')) {
            $(this).siblings('div').removeClass('active').hide();
            $(this).removeClass('highlight');
        }

        else {
            /*--Highlight clicked BOD name--*/
            $('#bodList div.bodCopy').removeClass('active').hide();
            $('#bodList h3').removeClass('highlight');


            /*--Show selected BOD bio--*/
            $(this).siblings('div').addClass('active').show();
            $(this).addClass('highlight');

        }

        return (false);
    });


    $('#bodList img').click(function() {

        var bodyCopy = $(this).siblings('.bodDetails').children('.bodCopy');
        if (bodyCopy.hasClass('active')) {
            bodyCopy.removeClass('active').hide();
            $('#bodList h3').removeClass('highlight');
        }

        else {
            /*--Highlight clicked BOD name--*/
            $('#bodList div.bodCopy').removeClass('active').hide();
            $('#bodList h3').removeClass('highlight');

            /*--Show selected BOD bio--*/
            bodyCopy.addClass('active').show().siblings('h3').addClass('highlight');
        }

        return (false);
    });

}

function ConfirmDelete(val)
{
    return confirm("Are you sure that you want to permanently remove this " + val +"?");
}

function showHide() {
    $('div.showHide> div').hide();
    $('div.showHide> h2').click(function() {
        $(this).next('div').slideToggle('fast')
            .siblings('div:visible').slideUp('fast');
    });
}
