﻿$(document).ready(function() {


    /*  Scroll to an element on hyperlink click*/
    $('a[rel=scrollTo]').click(function(e) {
        e.preventDefault();                                         //prevents the default action of the calling control

        $($(this).attr('href')).scrollintoview();  //lock on to element and scroll to
    });

    $('a[rel=accordion]').click(function(e) {
        e.preventDefault();

        $('div.accordion').hide();

        /*  Reset all accordion elements    */
        $('a[rel=accordion]').removeClass("collapse").addClass("expand");

        $(this).removeClass("expand").addClass("collapse");
        $($(this).attr('href')).show();  //lock on to element and scroll to
    });

    $('a[rel=employeeSelect]').click(function(e) {
        e.preventDefault();

        /*  Switch the employee element being shown */
        $(this).parent("li").parent("ul").parent("div.accordion").children("div.employee").hide();
        $($(this).attr('href')).show();

        // remove styling from current selected
        $(this).parent("li").parent("ul").children("li").removeClass("selected");

        $(this).parent().addClass("selected");
    });

    $('a.mfPressArchive-Accordion').click(function() {
        $(this).parent('li').children('ul').toggle();

    });
});


