/* will match any heading without class .clean */
Cufon.replace('#contentBox h1:not(.clean)', { fontFamily: 'AvantGarde Bk BT' });
Cufon.replace('#contentBox h2:not(.clean), #contentBox h3:not(.clean), #contentBox h4:not(.clean)', { fontFamily: 'AvantGarde Md BT' });

$(document).ready(function() {
    /* scrollpane */
    $('#newBoxEntries .scrollPane').jScrollPane({
        showArrows      : true,
        scrollbarWidth  : 15,
        scrollbarMargin : 0,
        dragMaxHeight   : 30
    });

    /* big target */
    $('#newBoxEntries .entry a').bigTarget({
        clickZone: '#newBoxEntries .entry',
        hoverClass: 'clickable'
    });

    /* resizable */
    $('.formbuilderform textarea').TextAreaResizer();

    /* alternating table rows */
    $(".infoTable tbody tr:even").addClass('even');
    $(".infoTable tbody tr:odd").addClass('odd');

    /* google map modal */
    $("#mapButton").fancybox({
        'width'         : 640,
        'height'        : 480,
        'autoScale'     : false,
        'transitionIn'  : 'none',
        'transitionOut' : 'none',
        'type'          : 'iframe',
        'scrolling'     : 'no'
    });

    /* accordion */
    $(".accordion").accordion({
        autoHeight: false,
        collapsible: true,
        active: false
    });
});

(function($) {
    $.fn.subOption = function(settings) {
        var config = {
            'valCondition' : '',
            'optionElement' : ''
        };

        if (settings) $.extend(config, settings);

        this.each(function() {
            var obj = $(this);

            if (obj.val() == config.valCondition) {
                $(config.optionElement).show();
            } else {
                $(config.optionElement).hide();
            }

            $(obj).change(function() {
                if (obj.val() == config.valCondition) {
                    $(config.optionElement).slideDown('fast');
                } else {
                    $(config.optionElement).slideUp('fast');
                }
            });
        });

        return this;
    };
})(jQuery);

