function showImage(img){ return (function(){ img.style.display='inline'; }) }
function delicious_posts() {    
	if (!Delicious.posts || !document.getElementById('diu_post')) {
		setTimeout(delicious_posts, 100);
		return;
	}
    var ul = document.createElement('ul');
	ul.className = 'delicious-posts';
	
    for (var i=0, post; post = Delicious.posts[i]; i++) {
        var li = document.createElement('li');
		li.className = 'delicious-post';
        var a = document.createElement('a');
        a.style.marginLeft = '12px';
        var img = document.createElement('img');
        img.style.position = 'absolute';
        img.style.display = 'none';
        // img.height = img.width = 16;
        // img.src = post.u.split('/').splice(0,3).join('/')+'/favicon.ico';
	img.src = 'http://www.ritterbush.com/joomla/images/M_images/arrow.png';
	img.width = 9;
	img.height = 12;
	img.onload = showImage(img);
        a.setAttribute('href', post.u);
        a.appendChild(document.createTextNode(post.d));
        li.appendChild(img);
        li.appendChild(a);
		
		if (showTags && post.t) {
			li.appendChild(document.createElement('BR'));
			for (var j=0, tag; tag = post.t[j]; j++) {
				a = document.createElement('A');
				a.setAttribute('href', tagURI + tag);
				a.appendChild(document.createTextNode(tag));
				a.className = 'delicious-tag';
				li.appendChild(a);
				li.appendChild(document.createTextNode(' '));
			}
		}
		if (showNotes && post.n) {
			li.appendChild(document.createElement('BR'));
			li.appendChild(document.createTextNode(post.n));
			li.appendChild(document.createTextNode(' '));
		}
		
        ul.appendChild(li);
    }
	document.getElementById('diu_post').appendChild(ul);
}

