 function selectCode(tid)
 {
     tid.focus();
     tid.select();
 }

 function hideEmbedCode()
 {
    document.getElementById('fullDescription').style.display = 'none';
    document.getElementById('bgFullDescription').style.display = 'none';
 }

var embedCodePopup = {
     currAlbumId: null,
     currAlbumEmbed: '',
     currAlbumUrl: '',

     show: function(id)
     {
        if (id != embedCodePopup.currAlbumId)
        {
            embedCodePopup.currAlbumId = id;
            $.post(rootUrl+'wsdl/showalbum.php?albumId='+id, {data: 'albumId='+id} , embedCodePopup._show);
            $('#loadingEmbedCode').center();
            $('#loadingEmbedCode').css('display','block');
        }
        else
        {
           embedCodePopup._show(embedCodePopup.currAlbumEmbed);
        }
     },

     _show : function(data)
     {
         $('#loadingEmbedCode').css('display','none');
         embedCodePopup.currAlbumEmbed = data;
         embedCodePopup.currAlbumUrl   = embedCodePopup.getUrlAlbum();

         $('#txtEmbedCode').html(embedCodePopup.currAlbumEmbed);
         $('#txtEmbedCode').val(embedCodePopup.currAlbumEmbed);
         $('#txtUrl').val(embedCodePopup.currAlbumUrl);
         $('#fullDescription').show();
         $('#fullDescription').center();
         $('#bgFullDescription').show();

         document.getElementById('lnkUrl').onclick = function()
         {
             doClipboard(rootUrl, embedCodePopup.currAlbumUrl, 'URL was copied to clipboard');
         }

         document.getElementById('lnkEmbed').onclick = function()
         {
             doClipboard(rootUrl, embedCodePopup.currAlbumEmbed, 'Embed code was copied to clipboard');
         }

         selectCode(document.getElementById('txtUrl'));
     },

     getUrlAlbum: function()
     {
         return (rootUrl + 'artist.php?albumId=' + embedCodePopup.currAlbumId);
     }
 }