$(document).ready(function() {

    // Open a window instead of a layer because of cross domain limitations
    $(".emailToAFriendLink").unbind("click").click(function(event) {
        var url = $("base").attr("href") + "/emailfriend3rdparty.strl?urlOfInterest="
                + encodeURIComponent(window.location.href)
                + "&description="
                + encodeURIComponent(document.title);

        window.open(url, "emailToAFriend", "width=465,height=530,toolbar=0");
        return false;
    });

    // Set the WhereToBuy dropdown action to an absolute url based on what the BASE href is.
    var whereToBuyAction = $("#whereToBuy-dropDown-form form").attr("action");
    if (whereToBuyAction.indexOf('..') == 0) {
        whereToBuyAction = whereToBuyAction.substring(2, whereToBuyAction.length);
    }
    whereToBuyAction = $("base").attr("href") + whereToBuyAction;
    $("#whereToBuy-dropDown-form form").attr("action", whereToBuyAction);

});