nextFriendsPage = function(page) {
    var throbber = $('moreFriendsThrobber_' + page);

    $('showMoreFriends').hide();
    $(throbber).show();

    new Ajax.Request(PUBLIC_URL+'gifts/next-friends-page/', {
        method: 'get',
        parameters: $H({page: page}).toQueryString(),
        
        onSuccess: function(transport) {
            $('friendsPage_' + page).innerHTML = transport.responseText;
            $('friendsPage_' + page).fadeIn();
        }
    });
};

function deleteGift(giftId){
    new Ajax.Request(PUBLIC_URL+'gifts/delete/',
            {
                method: 'post',
                postBody: 'giftId='+giftId,
                onSuccess: function(transport) {
                    eval(transport.responseText);
                }
            }
        );
}

closeGiftNotifyBox = function(userId) {
  	var expDate = new Date();
	expDate.setDate(expDate.getDate() + 365);
    $('giftNotifyBoxContainer').hide();
	document.cookie = 'giftNotifyBox=' + userId + ';expires=' + expDate.toGMTString();
}

positionNotifyBox = function(notifyBoxId) {
    var position = $('giftMenuItem').cumulativeOffset();
    var top = position.top;
    
    top = top - Math.ceil(234 / 2) + 6;
    $(notifyBoxId).setStyle({top: top + 'px'});
}