[[if deliciousID]]
[[if currentContext.liveDataFeeds]]
(function($){
 $(function() {
   $.ajaxSetup({
               "error":function() { 
               var nr = document.createElement('span');
               var tx = document.createTextNode('[[=&usernameNotFoundString]]');
               nr.appendChild(tx);
               var rp = document.getElementById('[[=&replaceID]]');
               document.getElementById('[[=&divID]]').replaceChild(nr, rp);
               }});
   $.getJSON('http://feeds.delicious.com/v2/json/[[=&deliciousID]][[if restrictedTags]]/[[=&%restrictedTags]][[endif3]]?callback=?', 
             {
             [[if maxEntries]]count: [[=maxEntries]][[endif3]]
             },
         function(data) {
         if (data.length > 0)
         {
[[if sortAlphabetically]]
            data.sort(function(a,b){return (a.d.toLowerCase()>b.d.toLowerCase()?1:a.d.toLowerCase()<b.d.toLowerCase()?-1:0)});
[[endif3]]
[[if listStyle]]
            var ul = document.createElement('ul');
            for (var i=0; i < data.length; i++) {
                var li = document.createElement('li');
                li.setAttribute('class', 'i' + (i+1) + ' ' + (i%2?'e':'o'));
                var a = document.createElement('a');
                a.setAttribute('href', data[i].u);
                [[if openLinksInNewWindow]]a.setAttribute('target', '_blank');[[endif4]]
                a.innerHTML = data[i].d;
                li.appendChild(a);
                [[if showExtended]]
                if (data[i].n) {
                    var extended = document.createElement('span');
                    extended.setAttribute('style', 'font-size:85%;');
                    li.appendChild(extended);
                    extended.innerHTML = ' : ' + data[i].n;
                }
                [[endif4]]
                [[if showTags]]
                if (data[i].t) {
                    var tagSpan = document.createElement('span');
                    tagSpan.setAttribute('style', 'font-size:75%;');
                    tagSpan.appendChild(document.createTextNode(' / '));
                    for (var t=0, tag; tag=data[i].t[t]; t++) {
			 
                        var tagA = document.createElement('a');
                        [[if openLinksInNewWindow]]tagA.setAttribute('target', '_blank');[[endif5]]
                        tagA.setAttribute('href', 'http://delicious.com/[[=&deliciousID]]/'+tag);
                        tagA.appendChild(document.createTextNode(tag));
                        tagSpan.appendChild(tagA);
                        tagSpan.appendChild(document.createTextNode(' '));
                    }
                    li.appendChild(tagSpan);
                }
                [[endif4]]
                ul.appendChild(li);
            }
            var rp = document.getElementById('[[=&replaceID]]');
            document.getElementById('[[=&divID]]').replaceChild(ul, rp);
[[else3]]
            var dl = document.createElement('dl');
            for (var i=0; i < data.length; i++) {
                var dt = document.createElement('dt');
                var dd = document.createElement('dd');
                var a = document.createElement('a');
                a.setAttribute('href', data[i].u);
                [[if openLinksInNewWindow]]a.setAttribute('target', '_blank');[[endif4]]
                a.innerHTML = data[i].d;
                dt.appendChild(a);
                [[if showExtended]]
                if (data[i].n) {
                    dd.innerHTML = data[i].n;
                }
                [[endif4]]
                [[if showTags]]
                if (data[i].t) {
                    var tagSpan = document.createElement('span');
                    tagSpan.setAttribute('style', 'font-size:75%;');
                    tagSpan.appendChild(document.createTextNode(' : '));
                    for (var t=0, tag; tag=data[i].t[t]; t++) {
                        var tagA = document.createElement('a');
                        tagA.setAttribute('href', 'http://delicious.com/[[=&deliciousID]]/'+tag);
                        [[if openLinksInNewWindow]]tagA.setAttribute('target', '_blank');[[endif5]]
                        tagA.appendChild(document.createTextNode(tag));
                        tagSpan.appendChild(tagA);
                        tagSpan.appendChild(document.createTextNode(' '));
                    }
                    dd.appendChild(tagSpan);
                }
                [[endif4]]
                dl.appendChild(dt);
                dl.appendChild(dd);
            }
            var rp = document.getElementById('[[=&replaceID]]');
            document.getElementById('[[=&divID]]').replaceChild(dl, rp);
[[endif3]]
         }
         else
         {
            var nr = document.createElement('span');
         [[if restrictedTags]]
            var tx = document.createTextNode('[[=&noTagsFoundString]]');
         [[else3]]
            var tx = document.createTextNode('[["No links found]]');
         [[endif3]]
            nr.appendChild(tx);
            var rp = document.getElementById('[[=&replaceID]]');
            document.getElementById('[[=&divID]]').replaceChild(nr, rp);
         [[if restrictedTags]]
            var ts = document.getElementById('[[=&tagSpanID]]');
            document.getElementById('[[=&tagDivID]]').removeChild(ts);
         [[endif3]]
         }
         });
   });
 })(jQuery);
[[endif2]]
[[endif]]