// requires jQuery 1.3.x
var showSpeed = 'fast';
var hideSpeed = 'fast';
var valid = new Object;

valid.regex = [
    { 'name'    : /^[a-z\-\.\'\`\ \,\(\)]{3,100}$/i },
    { 'email'   : /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i },
    { 'url'     : /^(https?:\/\/)?(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i },
    { 'text'    : /^[\s\S]{10,512}$/i }
];

var container;

var allowed = oc([ 'jpg', 'jpeg', 'png', 'gif', 'flv' ]);

function validate( v, n ) {

    // value based checking
    if ( n == 'name' && ( v == '' || v == 'your name' ) ) return false;
    if ( n == 'email' && ( v == '' || v == 'your email' ) ) return false;
    if ( n == 'text' && ( v == 'your comments' || blank( v ) ) ) return false;
    if ( n == 'url' && ( v == '' || v == 'your website (optional)' ) ) return true;

    // regex based
    var ret = false;
    for ( i in valid.regex ) {
        if ( i.toString().search( /^[0-9]+$/ ) == 0 ) {
            if ( eval( 'valid.regex[ i ].' + n ) ) {
                if ( n == 'text' ) eval( 'ret = valid.regex[ i ].' + n + '.test( "' + escape( v ) + '" );');
                else eval( 'ret = valid.regex[ i ].' + n + '.test( "' + v + '" );');
            }
        }
    }
    return ret;
}

function blank( v ) {
    var ret = true;
    var esc = escape( v );

    for ( i = 0; i < esc.length; i++ ) {
        if ( esc.indexOf( '%0D' ) > -1 ) esc = esc.replace( '%0D', '' );
        if ( esc.indexOf( '%0A' ) > -1 ) esc = esc.replace( '%0A', '' );
        v = unescape( esc );
        if ( v != '' ) ret = false;
    }
    return ret;
}

function oc( a ) {
    var o = { };
    for ( var i = 0; i< a.length; i++ ) o[ a[i] ] = '';
    return o;
}

(function($) {

    $( document ).ready( function() {
    	
    	// Publicatioin page buttons
    	$("#archived_btn").click(function () {
			$('#recent_pubs').fadeOut(200, function() {	$('#archived_pubs').fadeIn(200);});
			$(this).addClass("highlight");
			$('#recent_btn').removeClass("highlight");
        });
    	$("#recent_btn").click(function () {
			$('#archived_pubs').fadeOut(200,function() { $('#recent_pubs').fadeIn(200);});
			$(this).addClass("highlight");
			$('#archived_btn').removeClass("highlight");
        });
    	   	

        $( '#corporateMenuButton' ).click( function() {
            hideMenus();
            var c = $( '#corporateMenu' );
            if ( c.is( ':visible' ) ) c.slideUp( hideSpeed );
            else {
                c.alignWith( this, 'tmbm', { y : 5 } );
                c.slideDown( showSpeed );
            }
            return false;
        } );

        $( '#divisionsMenuButton' ).click( function() {
            hideMenus();
            var d = $( '#divisionsMenu' );
            if ( d.is( ':visible' ) ) d.slideUp( hideSpeed );
            else {
                d.alignWith( this, 'tmbm', { y : 5 } );
                d.slideDown( showSpeed );
            }
            return false;
        } );

        $( '#SubscribeButton' ).click( function() {
            hideMenus();
            var n = $( '#NewsMenu' );
            if ( n.is( ':visible' ) ) n.slideUp( hideSpeed );
            else {
                n.alignWith( $( '#SubscribeButton' ), 'trbr', { y: -2, x : 54 } );
                n.slideDown( showSpeed );
            }
        } );

        $( '#Form_Form_EditableTextField1' ).each( function() {
            if ( this.value == '' ) $( this ).val( 'your name' );

            $( this ).focus( function() {
                if ( this.value == 'your name' ) $( this ).val( '' );
                $( this ).css( { 'color' : '#000' } );
                if ( validate( this.value, 'name' ) ) $( this ).css( { 'background-position' : '0 -40px' } );
                else $( this ).css( { 'background-position' : '0 -20px' } );
            } );

            $( this ).keyup( function() {
                if ( validate( this.value, 'name' ) ) $( this ).css( { 'background-position' : '0 -40px' } );
                else $( this ).css( { 'background-position' : '0 -20px' } );
            } );

            $( this ).blur( function() {
                if ( valid.name = validate( this.value, 'name' ) ) $( this ).css( { 'background-position' : '0 0', 'color' : '#8c8c8c' } );
                if ( this.value == '' ) $( this ).val( 'your name' );
            } );
        } );

        $( '#Form_Form_EditableEmailField2' ).each( function() {
            if ( this.value == '' ) $( this ).val( 'your email' );

            $( this ).focus( function() {
                if ( this.value == 'your email' ) $( this ).val( '' );
                $( this ).css( { 'color' : '#000' } );
                if ( validate( this.value, 'email' ) ) $( this ).css( { 'background-position' : '0 -40px' } );
                else $( this ).css( { 'background-position' : '0 -20px' } );
            } );

            $( this ).keyup( function() {
                if ( validate( this.value, 'email' ) ) $( this ).css( { 'background-position' : '0 -40px' } );
                else $( this ).css( { 'background-position' : '0 -20px' } );
            } );

            $( this ).blur( function() {
                if ( valid.email = validate( this.value, 'email' ) ) $( this ).css( { 'background-position' : '0 0', 'color' : '#8c8c8c' } );
                if ( this.value == '' ) $( this ).val( 'your email' );
            } );
        } );

        $( '#Form_Form' ).submit( function() {
            var name = email = false;

            if ( validate( $( '#Form_Form_EditableTextField1' ).val(), 'name' ) ) name = true;
            else $( '#Form_Form_EditableTextField1' ).css( { 'background-position' : '0 -20px' } );

            if ( validate( $( '#Form_Form_EditableEmailField2' ).val(), 'email' ) ) email = true;
            else $( '#Form_Form_EditableEmailField2' ).css( { 'background-position' : '0 -20px' } );

            if ( name && email ) return true;
            return false;
        } );

        $( document ).bind( 'click', function(e) {
            var c = $( '#corporateMenu' );
            var d = $( '#divisionsMenu' );
            var n = 'div[id="NewsMenu"]';
            if ( $( e.target ).closest( c ).length == 0 ) c.slideUp( hideSpeed );
            if ( $( e.target ).closest( d ).length == 0 ) d.slideUp( hideSpeed );
            if ( $( e.target ).closest( n ).length == 0 && $( e.target ).closest( 'a[id="SubscribeButton"]' ).length == 0 ) $( n ).slideUp( hideSpeed );
        } );

        if ( typeof showcaseImages !== 'undefined' && showcaseImages.length > 0 ) {
            $( '#showcase' ).showcase( {
                images:     showcaseImages,
                animation:  { type: 'fade', interval: 6000 },
                border:     '0',
                navigator:  {
                    position:   'bottom-right',
                    showNumber: false,
                    item:       { width: '4px', height: '4px' }
                }
            } );
        }

        $( '#Form_ContactForm_Name' ).each( function() {
            if ( this.value == '' ) $( this ).val( 'your name' );

            $( this ).focus( function() {
                if ( this.value == 'your name' ) $( this ).val( '' );
                $( this ).css( { 'color' : '#000' } );
                if ( validate( this.value, 'name' ) ) $( this ).css( { 'background-position' : '0 -40px' } );
                else $( this ).css( { 'background-position' : '0 -20px' } );
            } );

            $( this ).keyup( function() {
                if ( validate( this.value, 'name' ) ) $( this ).css( { 'background-position' : '0 -40px' } );
                else $( this ).css( { 'background-position' : '0 -20px' } );
            } );

            $( this ).blur( function() {
                if ( valid.name = validate( this.value, 'name' ) ) $( this ).css( { 'background-position' : '0 0', 'color' : '#8c8c8c' } );
                if ( this.value == '' ) $( this ).val( 'your name' );
            } );
        } );

        $( '#Form_ContactForm_Email' ).each( function() {
            if ( this.value == '' ) $( this ).val( 'your email' );

            $( this ).focus( function() {
                if ( this.value == 'your email' ) $( this ).val( '' );
                $( this ).css( { 'color' : '#000' } );
                if ( validate( this.value, 'email' ) ) $( this ).css( { 'background-position' : '0 -40px' } );
                else $( this ).css( { 'background-position' : '0 -20px' } );
            } );

            $( this ).keyup( function() {
                if ( validate( this.value, 'email' ) ) $( this ).css( { 'background-position' : '0 -40px' } );
                else $( this ).css( { 'background-position' : '0 -20px' } );
            } );

            $( this ).blur( function() {
                if ( valid.email = validate( this.value, 'email' ) ) $( this ).css( { 'background-position' : '0 0', 'color' : '#8c8c8c' } );
                if ( this.value == '' ) $( this ).val( 'your email' );
            } );
        } );

        $( '#Form_ContactForm_Comments' ).each( function() {
            if ( this.value == '' ) $( this ).val( 'your comments' );

            $( this ).focus( function() {
                if ( this.value == 'your comments' ) $( this ).val( '' );
                $( this ).css( { 'color' : '#000' } );
                if ( validate( this.value, 'text' ) ) $( this ).css( { 'background-position' : '0 -180px' } );
                else $( this ).css( { 'background-position' : '0 -90px' } );
            } );

            $( this ).keyup( function() {
                if ( validate( this.value, 'text' ) ) $( this ).css( { 'background-position' : '0 -180px' } );
                else $( this ).css( { 'background-position' : '0 -90px' } );
            } );

            $( this ).blur( function() {
                if ( valid.text = validate( this.value, 'text' ) ) $( this ).css( { 'background-position' : '0 0', 'color' : '#8c8c8c' } );
                if ( this.value == '' ) $( this ).val( 'your comments' );
            } );
        } );

        $( '#Form_ContactForm_action_SendContactForm' ).click( function() {
            if ( valid.name && valid.email && valid.text ) return true;
            return false;
        } );

        $( '#PageCommentInterface_Form_PostCommentForm' ).submit( function() {
            var name = email = url = text = false;

            if ( validate( $( '#PageCommentInterface_Form_PostCommentForm_Name' ).val(), 'name' ) ) name = true;
            else $( '#PageCommentInterface_Form_PostCommentForm_Name' ).css( { 'background-position' : '0 -20px' } );

            if ( validate( $( '#PageCommentInterface_Form_PostCommentForm_CommenterEmail' ).val(), 'email' ) ) email = true;
            else $( '#PageCommentInterface_Form_PostCommentForm_CommenterEmail' ).css( { 'background-position' : '0 -20px' } );

            if ( validate( $( '#PageCommentInterface_Form_PostCommentForm_CommenterURL' ).val(), 'url' ) ) url = true;
            else $( '#PageCommentInterface_Form_PostCommentForm_CommenterURL' ).css( { 'background-position' : '0 -20px' } );

            if ( validate( $( '#PageCommentInterface_Form_PostCommentForm_Comment' ).val(), 'text' ) ) text = true;
            else $( '#PageCommentInterface_Form_PostCommentForm_Comment' ).css( { 'background-position' : '0 -80px' } );

            if ( name && email && url && text ) return true;
            return false;
        } );

        $( '#PageCommentInterface_Form_PostCommentForm_Name' ).each( function() {
            if ( this.value == '' ) $( this ).val( 'your name' );

            $( this ).focus( function() {
                if ( this.value == 'your name' ) $( this ).val( '' );
                $( this ).css( { 'color' : '#000' } );
                if ( validate( this.value, 'name' ) ) $( this ).css( { 'background-position' : '0 -40px' } );
                else $( this ).css( { 'background-position' : '0 -20px' } );
            } );

            $( this ).keyup( function() {
                if ( validate( this.value, 'name' ) ) $( this ).css( { 'background-position' : '0 -40px' } );
                else $( this ).css( { 'background-position' : '0 -20px' } );
            } );

            $( this ).blur( function() {
                if ( valid.name = validate( this.value, 'name' ) ) $( this ).css( { 'background-position' : '0 0', 'color' : '#8c8c8c' } );
                if ( this.value == '' ) $( this ).val( 'your name' );
            } );
        } );

        $( '#PageCommentInterface_Form_PostCommentForm_CommenterEmail' ).each( function() {
            if ( this.value == '' ) $( this ).val( 'your email' );

            $( this ).focus( function() {
                if ( this.value == 'your email' ) $( this ).val( '' );
                $( this ).css( { 'color' : '#000' } );
                if ( validate( this.value, 'email' ) ) $( this ).css( { 'background-position' : '0 -40px' } );
                else $( this ).css( { 'background-position' : '0 -20px' } );
            } );

            $( this ).keyup( function() {
                if ( validate( this.value, 'email' ) ) $( this ).css( { 'background-position' : '0 -40px' } );
                else $( this ).css( { 'background-position' : '0 -20px' } );
            } );

            $( this ).blur( function() {
                if ( valid.email = validate( this.value, 'email' ) ) $( this ).css( { 'background-position' : '0 0', 'color' : '#8c8c8c' } );
                if ( this.value == '' ) $( this ).val( 'your email' );
            } );

        } );

        $( '#PageCommentInterface_Form_PostCommentForm_CommenterURL' ).each( function() {
            if ( this.value == '' ) $( this ).val( 'your website (optional)' );

            $( this ).focus( function() {
                if ( this.value == 'your website (optional)' ) $( this ).val( '' );
                $( this ).css( { 'color' : '#000' } );
                if ( validate( this.value, 'url' ) ) $( this ).css( { 'background-position' : '0 -40px' } );
                else $( this ).css( { 'background-position' : '0 -20px' } );
            } );

            $( this ).keyup( function() {
                if ( validate( this.value, 'url' ) ) $( this ).css( { 'background-position' : '0 -40px' } );
                else $( this ).css( { 'background-position' : '0 -20px' } );
            } );

            $( this ).blur( function() {
                if ( valid.url = validate( this.value, 'url' ) ) $( this ).css( { 'background-position' : '0 0', 'color' : '#8c8c8c' } );
                if ( this.value == '' ) $( this ).val( 'your website (optional)' );
            } );
        } );

        $( '#PageCommentInterface_Form_PostCommentForm_Comment' ).each( function() {
            if ( this.value == '' ) $( this ).val( 'your comments' );

            $( this ).focus( function() {
                if ( this.value == 'your comments' ) $( this ).val( '' );
                $( this ).css( { 'color' : '#000' } );
                if ( validate( this.value, 'text' ) ) $( this ).css( { 'background-position' : '0 -160px' } );
                else $( this ).css( { 'background-position' : '0 -80px' } );
            } );

            $( this ).keyup( function() {
                if ( validate( this.value, 'text' ) ) $( this ).css( { 'background-position' : '0 -160px' } );
                else $( this ).css( { 'background-position' : '0 -80px' } );
            } );

            $( this ).blur( function() {
                if ( valid.text = validate( this.value, 'text' ) ) $( this ).css( { 'background-position' : '0 0', 'color' : '#8c8c8c' } );
                if ( this.value == '' ) $( this ).val( 'your comments' );
            } );
        } );

        $( '#PeopleFilter div.fieldgroupField label' ).click( function() { $( this ).parent().parent().find( 'input' ).attr( 'checked', false ); } );

        $( '#SearchForm_PersonFilter_Search' ).each( function() {
            if ( this.value == '' ) $( this ).val( 'keywords' );

            $( this ).focus( function() {
                if ( this.value == 'keywords' ) $( this ).val( '' );
                $( this ).css( { 'color' : '#000' } );
            } );

            $( this ).blur( function() {
                if ( this.value == '' ) $( this ).val( 'keywords' );
            } );
        } );

        $( '#NewsFilter div.fieldgroupField label' ).click( function() { $( this ).parent().parent().find( 'input' ).attr( 'checked', false ); } );

        $( '#SearchForm_NewsFilter_Search' ).each( function() {
            if ( this.value == '' ) $( this ).val( 'keywords' );

            $( this ).focus( function() {
                if ( this.value == 'keywords' ) $( this ).val( '' );
                $( this ).css( { 'color' : '#000' } );
            } );

            $( this ).blur( function() {
                if ( this.value == '' ) $( this ).val( 'keywords' );
            } );
        } );

        $( '#ProjectFilter .subdivTrigger' ).click( function() {
            var c = $( this ).attr( 'class' ).split(/\s+/)[1];
            toggleSubfilter( $( '#ProjectFilter h5.' + c + ' input' ), c, false );
        } );

        $( '#ProjectFilter h5' ).each( function () {
            var o = $( this );
            var c = o.attr( 'class' );
            if ( c != '' ) {
                o.find( 'input' ).bind( 'click, change', function() { toggleSubfilter( this, c, true ); } );
                o.find( 'span' ).click( function() { toggleSubfilter( $( this ).parent().find( 'input' ), c, false ); } );
            }
        } );

        $( '#ProjectFilter a.all, #ProjectFilter a.none' ).click( function() {
            var v = $( this ).attr( 'class' ) == 'all' ? true : false;
            $( this ).parent().find( 'input' ).attr( 'checked', v );
        } );

        $( '#SearchForm_ProjectFilter_Search' ).each( function() {
            if ( this.value == '' ) $( this ).val( 'keywords' );

            $( this ).focus( function() {
                if ( this.value == 'keywords' ) $( this ).val( '' );
                $( this ).css( { 'color' : '#000' } );
            } );

            $( this ).blur( function() {
                if ( this.value == '' ) $( this ).val( 'keywords' );
            } );
        } );

        $( '#AwardsContent ul.years div.expand a' ).click( function() {
            var clicked = $( this ).parent().parent().find( 'div.wrapper' );
            if ( clicked.is( ':visible' ) ) clicked.slideUp( showSpeed );
            else clicked.slideDown( showSpeed );
        } );    

        $('a[href$=".pdf"]').parent().addClass('pdf');

        if ( $( '#NewsMenu div.success' ).length ) $( '#NewsMenu' ).alignWith( $( '#SubscribeButton' ), 'trbr', { y: -2, x : 54 } ).slideDown( showSpeed, function() { setTimeout( function() { $( '#NewsMenu').slideUp( hideSpeed ); }, 5000 ); } );

        $( document ).pngFix();

        $( document ).keypress( function(e) {
            if ( e.which == 13 ) {
                $return = false;
                if ( $( e.target ).is( 'textarea' ) ) $return = true;
                if ( $( e.target ).attr( 'id' ) == 'SearchForm_SearchForm_Search' ) $return = true;
                return $return;
            }
        } );

        if ( document.location.hash && document.location.hash.match( '#PageComment_' ) ) {
            if ( $( document.location.hash ).length === 0 ) $( 'html, body' ).animate( { scrollTop: $( 'a[name="comments"]' ).offset().top }, 0, function() { $( '#CommentModerationWarning' ).slideDown( showSpeed ); } );
        }

        $( '#accordion div.content' ).each( function() { $( this ).slideUp( 1 ); } );
        $( '#accordion div.header' ).siblings( '.open' ).slideDown( showSpeed );
        $( '#accordion div.header' ).click( function() {
            var clicked = $( this );
            $( '#accordion div.header' ).removeClass( 'open' );
            $( '#Sidebar h5.active' ).removeClass( 'active' );
            clicked.addClass( 'open' );
            $( '#accordion div.content' ).each( function(e) { if ( !$( this ).prev( 'div.header' ).hasClass( 'open' ) ) $( this ).slideUp( hideSpeed ); } );
            clicked.next( '.content' ).slideDown( showSpeed );
        } );

    } );

    function hideMenus() {
        var d = $( '#divisionsMenu' );
        if ( d.is( ':visible' ) ) d.slideUp( hideSpeed );

        var c = $( '#corporateMenu' );
        if ( c.is( ':visible' ) ) c.slideUp( hideSpeed );

        var n = $( '#NewsMenu' );
        if ( n.is( ':visible' ) ) n.slideUp( hideSpeed );
    }

    function toggleSubfilter( o, c, i ) {
        var p = $( '#ProjectFilter div.subdivTrigger.' + c );
        p.toggleClass( 'active' );
        var s = i ? '' : 'un';
        if ( $( o ).is( ':' + s + 'checked' ) ) {
            if ( $( '#ProjectFilter div.subdivisions.' + c ).is( ':hidden' ) ) {
                $( '#ProjectFilter div.subdivisions.' + c + ' input' ).attr( 'checked', true );
                $( '#ProjectFilter div.subdivisions.' + c ).slideDown( showSpeed );
                $( '#ProjectFilter h5.' + c + ' input' ).attr( 'checked', true );
            } else  $( '#ProjectFilter div.subdivisions.' + c ).slideUp( hideSpeed, function() {
                        $( '#ProjectFilter div.subdivisions.' + c + ' input' ).attr( 'checked', false );
                        $( '#ProjectFilter h5.' + c + ' input' ).attr( 'checked', false );
                    } );
        } else  $( '#ProjectFilter div.subdivisions.' + c ).slideUp( hideSpeed, function() {
                    $( '#ProjectFilter div.subdivisions.' + c + ' input' ).attr( 'checked', false );
                    $( '#ProjectFilter h5.' + c + ' input' ).attr( 'checked', false );
                } );
    }

} )( jQuery );


