
var contenu = document.getElementById('contenu');

var photos = contenu.getElementsByTagName('img');

var nbPhotos = photos.length;

for(var iPhoto=0; iPhoto<photos.length; iPhoto++) {
	var unePhoto = photos[iPhoto];

	if(unePhoto && unePhoto.alt) {

		var alignementPhoto = unePhoto.align;

		unePhoto.removeAttribute('hspace');
		unePhoto.removeAttribute('vspace');
		unePhoto.removeAttribute('align');



		var str = '<table cellspacing="0" cellpadding="0" border="0"';
		if(alignementPhoto == 'right')
			str += ' align="right" style="clear:right; margin-bottom:10px;"';
		else if(alignementPhoto == 'left')
			str += ' align="left" style="clear:left; margin-bottom:10px;"';

		str += '>';

		str += '<tr><td';


		if(alignementPhoto == 'right')
			str += ' style="padding-left:10px;"';
		else if(alignementPhoto == 'left')
			str += ' style="padding-right:10px;"';

		str += ' align="center" id="zPhoto_'+ iPhoto +'">';

		//str += unePhoto.outerHTML;

		var altPhoto = unePhoto.alt.replace(' | ', '<br />');

		str += '</td></tr>';
		str += '<tr><td align="center"';

		if(alignementPhoto == 'right')
			str += ' style="padding:2px 0px 2px 10px;font-weight:normal;"';
		else if(alignementPhoto == 'left')
			str += ' style="padding:2px 10px 2px 0px;font-weight:normal;"';
		else
			str += ' style="padding:2px 0px;font-weight:normal;"';

		str += '><font size=1>'+ altPhoto +'</font></td></tr>';
		str += '</table>';

		//unePhoto.insertAdjacentHTML('afterend', str);
		unePhoto.insertAdjacentHTML('afterend', str);

		var celPhoto = document.getElementById('zPhoto_'+ iPhoto);
		celPhoto.appendChild(unePhoto);

		
		//unePhoto.style.display = 'none';
		//unePhoto.outerHTML = str;

	} else if(unePhoto) {

		if(unePhoto.align == 'left') unePhoto.style.marginRight = '10px';
		else if(unePhoto.align == 'right') unePhoto.style.marginLeft = '10px';

	}
}
