$(document).ready( function() {
    $('.valign').each( function() {
        $(this).css('margin-top', ($(this).parent().height() - $(this).height())/2);
    });

    $('.slide_down').click( function() {
        if($(this).next('ul').is(':visible'))
        {
            //$(this).parent('div').parent('li').removeClass('down_arrow').addClass('right_arrow');
            $(this).removeClass('down_arrow').addClass('right_arrow');
            $(this).next('ul').slideUp();
        }
        else
        {
            //$(this).parent('div').parent('li').removeClass('right_arrow').addClass('down_arrow');
            $(this).removeClass('right_arrow').addClass('down_arrow');
            $(this).next('ul').slideDown();
        }

        return false;
    });

    $(".zip_search").overlay({                                                                                         
                                                                                                                      
        top: 260,                                                                                                     
        mask: {                                                                                                       
            color: '#fff',                                                                                            
            loadSpeed: 200,                                                                                           
            opacity: 0.5                                                                                              
        },                                                                                                            
        onLoad: function() {
            $('#zip_search_input').focus();
        },
        onClose: function() {                                                                                         
            $('#group_id').val('');                                                                                   
            $('#title').val('');                                                                                      
        },                                                                                                            
        closeOnClick: true
                                                                                                                      
    });                                                                                                               

    $('.zip_search').click( function() {
        page_section = $(this).attr('href')
        if(page_section != "" && page_section != "#")
            $('#page_section').attr('value', page_section);
    });

    Cufon.replace('.sidebox_title');
    Cufon.replace('.impact');
});


sfHover = function() {
    var sfEls = document.getElementById("leash_nav").getElementsByTagName("LI");
    for (var i=0; i<sfEls.length; i++) {
        sfEls[i].onmouseover=function() {
            this.className+=" sfhover";
        }
        sfEls[i].onmouseout=function() {
            this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


