function favorite_add(fav_type,fav_code)
{
    var timeout = 1200 * 1000;
    if ( (loadTime + timeout) < (new Date().getTime()) )
    {
        alert('Alert! Your session may have timed out. Please refresh the page, and try again.');
        return;
    }
    if (!document.getElementById && document.all) {
        document.getElementById = document.all;
    }
    if (document.getElementById)
    {
        // A little entropy to ensure no caching takes place
        var date    = new Date();
        var entropy = String(date.getHours()) + String(date.getMinutes()) + String(date.getSeconds()) + String(date.getMilliseconds());
        // Create a new Image object, and set the source to the rent script
        // In effect calls the rent script to register the queued/unqueued title
        var favScriptImg = new Image();
        favScriptImg.src = 'index.php?action=recommendations/favorites&add' + fav_type + '='+ fav_code;

        // Grab image object...
        var favButtonImgObject = document.getElementById('addFavoriteImg_' + fav_type + '' + fav_code);
        var favButtonLinkObject = document.getElementById('addFavorite_' + fav_type + '' + fav_code);
        // If the rent button object was successfully retrieved...
        if (favButtonImgObject)
        {
            // Grab the current image src, and get the filename from it
            if (favButtonImgObject.src.indexOf('/') != -1)
            {
                var pos = favButtonImgObject.src.lastIndexOf('/');
                var filename = favButtonImgObject.src.substring(pos + 1);
            }
            else
            {
                var filename = favButtonImgObject.src;
            }
            // Determine the new filename based on the current filename
            var newFilename;
            var newAltText;
                switch(fav_type)
                {
                    case 'genre':
                        newFilename = '/images/recommendations/i/favorites.gif';
                        newAltText  = 'Genre Added to favorites';
                        break;
                    case 'actor':
                        newFilename = '/images/recommendations/i/favorites.gif';
                        newAltText  = 'Actor Added to favorites';
                        break;
                    case 'director':
                        newFilename = '/images/recommendations/i/avorites.gif';
                        newAltText  = 'Director Added to favorites';
                        break;
                    default:
                        newFilename = '/images/recommendations/i/favorites.gif';
                        newAltText  = ' ... Added to favorites';
                }

          favButtonImgObject.src = newFilename;
        favButtonImgObject.alt = newAltText;
        favButtonLinkObject.href='index?action=recommendations/favorites';
        }
    // For browser not supporting document.getElementById call the old rentPopup functionality
    }
        else
        {
            openWin('/index.php?action=recommendations/favorites&add' + fav_type + '='+ fav_code, 'Favorites');
            return false;
    }
}