var photobar = document.getElementById('photobar');

function addDescriptions()
{
	photobar_images = photobar.getElementsByTagName('img');
	for (var i = 0; i < photobar_images.length; i++)
	{
		var photobar_image = photobar_images.item(i);
		var br = document.createElement('br');
		var decription = document.createElement('span');
		decription.setAttribute('class', 'image-desc');
		decription.setAttribute('title', photobar_image.getAttribute('title'));
		decription.innerHTML = cut(photobar_image.getAttribute('title'), 16);
		photobar_image.parentNode.appendChild(br);
		photobar_image.parentNode.appendChild(decription);
	}
}

function cut(text, chars)
{
	if (text.length <= chars)
		return text;
	return text.substr(0, chars)+'..';
}