
Event.observe(window, 'load', function() {
	var links = document.getElementById('maquetablecontent');
	if (!links) return;
	links = links.getElementsByTagName('a');
	if (!links) return;

    for (var i=0; i<links.length; ++i) {
		if (!links[i].title) continue;

		Object.extend(links[i], {
			showDescriptionDialog: function() {
				var box = $('descriptionbox');
				if (!box) return;

				box.setText(this.title + " »");

				this.oldTitle = this.title;
				this.title = '';
				box.show();

				var position = this.cumulativeOffset();
				box.setStyle({
					left: position.left + 'px',
					top: (position.top - box.getHeight()) + 'px'
				});
			},

			hideDescriptionDialog: function() {
				var box = $('descriptionbox');
				if (!box) return;
				box.hide();
				this.title = this.oldTitle;
			}
		});

        links[i].onmouseover = function() {
            this.showDescriptionDialog();
        }
        links[i].onmouseout = function() {
            this.hideDescriptionDialog();
        }
    }

    var div = document.createElement('div');
    div.id = 'descriptionbox';
    div.style.display = 'none';
    div.style.position = 'absolute';
    div.innerHTML = '<div class="inner"><p></p></div>';
	document.body.appendChild(div);

    div.setText = function(text) {
        if (!text) text = '';
        if (text != this.firstChild.firstChild.innerHTML) {
          this.firstChild.firstChild.innerHTML = text;
        }
    }

    div.getText = function() {
        return this.firstChild.firstChild.innerHTML;
    }

});
