// (c) zajc.info

function $(name) {
	return document.getElementById(name);
} // $

// script from: http://del.icio.us/help/json/posts
// modified by zajc.info
function load_delicious() {

	var links = $('links');
	var b = $('main');

	//b.style.width = '780px';
	 /*
    function showImage(img){ return (function(){ img.style.display='inline'; }) }
	 */

    var h3 = document.createElement('h3');
	 h3.appendChild(document.createTextNode('del.icio.us'));
	 links.appendChild(h3);
	 
    var ul = document.createElement('dl');
    for (var i=0, post; post = Delicious.posts[i]; i++) {
        var dt = document.createElement('dt');
        var a = document.createElement('a');
        a.setAttribute('href', post.u);
        a.style.display = 'block';
        a.appendChild(document.createTextNode(post.d));
        dt.appendChild(a);
        ul.appendChild(dt);
		  if (post.n != undefined) {
				var dd = document.createElement('dd');
				dd.appendChild(document.createTextNode(post.n));
				ul.appendChild(dd);
		  }
		  
    }
    $('links').appendChild(ul);
	 var a = document.createElement('div');
	 a.style.textAlign = 'right';
	 a.style.fontSize = '80%';
	 var link = document.createElement('a');
	 link.setAttribute('href', 'http://del.icio.us/pzajac2');
	 link.appendChild(document.createTextNode('więcej »'));
	 a.appendChild(link);
    $('links').appendChild(a);

} // load_delicious()

window.onload = function() {
	load_delicious();
} // window.onload()
