$(function() {
    // Buttons hover, click and vertical align
    $('div.button span', '#selector').hover(function() {
        $(this).addClass('hover');
    }, function() {
        $(this).removeClass('hover');
    }).click(function() {
        // onClick
        window.location.href = $(this).find('a').attr('href');
        return false;
    })
    $('div.button span', '#selector:not(.brand)').each(function() {
        // align each item vertically
        $(this).addClass('js-vertical');
        var height = $('a', this).height();
        var offset = Math.floor(($(this).height() - height) / 2);
        
        $('a', this).css('paddingTop', offset+'px');
    });
    
    // Flash Map
    if($('#flash-map').length) {
        $.getScript('/swfobject.js', function() {
            $('#flash-map').flash({
                swf: '/_includes/product_locations.swf',
                width: 625,
                height: 320,
                wmode: 'transparent',
                flashvars: {
                    northAmericaLink: "/products/location_north_america.aspx",
                    southAmericaLink: "/products/location_south_america.aspx",
                    africaLink: "/products/location_europe_africa_middle_east.aspx",
                    europeLink: "/products/location_europe_africa_middle_east.aspx",
                    middleEastLink: "/products/location_europe_africa_middle_east.aspx",
                    asiaLink: "/products/location_east_asia_pacific.aspx",
                    australiaPacificLink: "/products/location_east_asia_pacific.aspx"
                }
            });
        });
    }
});