$(document).ready(function () {

        $("#fancybox ul a").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});

    		$('#sidebar-menu').accordion({
                autoHeight: false,
                <?php

                $categories = array(17,28,48,69,682);
                if (in_array(the_ancestor(), $categories))
                {
                    if (the_ancestor() == "17") {echo "active: 0";}; // utilities
                    if (the_ancestor() == "28") {echo "active: 1";}; // money
                    if (the_ancestor() == "48") {echo "active: 2";}; // insurance
                    if (the_ancestor() == "69") {echo "active: 3";}; // travel
                    if (the_ancestor() == "682") {echo "active: 4";}; // business
                } else
                {
                echo "active:false";
                }
                ?>
    		 });
            
        
            $('a.show').click(function() {$('.second_form').show(); });
            $('a.show').click(function() { $('.show').hide(); });
            $('.second_form').hide();
            <?php if ($_POST['submitted'] ==  "_submitted") echo "$('.second_form').show();"; ?>

            <?php if (debug()){?>
			$('.pre').appendTo($('.block'));
            	$(".toggle_container").hide();
            
            	$("h2.trigger").click(function(){
            		$(this).toggleClass("active").next().slideToggle("slow");
                    $(this).text($(this).text() == 'Hide Debug Info' ? 'Show Debug Info' : 'Hide Debug Info');
            	});
            
                $(".toggle_container").click(function(){
                    		$(this).slideToggle("slow");
                        $("h2.trigger").text($("h2.trigger").text() == 'Hide Debug Info' ? 'Show Debug Info' : 'Hide Debug Info');
                });
                <? } ?>

    	});
