function makeImgText(idName)
{
 if(!document.getElementById || !document.createTextNode){return;}
 var divCollection = document.getElementsByTagName('div'); 
 for(var x=0;x<divCollection.length;x++)
  {
  sok=divCollection[x].getAttribute('id');
   if (idName==sok)
   {
	var imgs=document.getElementById(idName).getElementsByTagName("img");
    for(var i=0;i<imgs.length;i++)
    {
		var agt=navigator.userAgent.toLowerCase();
		var isIE = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
		var img = imgs[i];
		var title = img.title;
		//title = (isset(title)?title+' ':'');
		var alt = img.alt;
		var width = img.width;
		var align = img.align;
		if(align != 'left' && align != 'right'){align = 'center';} //sett alignment for table container
		var pos = img.parentNode; //the current position
		
		
		var tr = new Array();
		var td = new Array();
		
		//create TABLE-element
		var table = document.createElement('table');
		table.setAttribute('align', align);
		table.setAttribute((isIE?'className':'class'), 'imgTable' + 'img' + align);
		table.setAttribute('width', width);
		pos.insertBefore(table, img); //insert TABLE befor IMG
		
		var tbody = document.createElement('tbody');
		table.appendChild(tbody);
		//Insert TABLE ROW
		//START: first row
		tr[0] = document.createElement('tr'); //TR
		td[0] = document.createElement('td'); //TD in TR
		td[0].appendChild(img); //Put IMG in TR
		tr[0].appendChild(td[0]); //Put TD in TR
		tbody.appendChild(tr[0]); //Put TR in TABLE
		//END: First row
		
		//Insert TABLE ROW
		//START: second row
		tr[1] = document.createElement('tr'); //TR
		td[1] = document.createElement('td'); //TD in TR
		td[1].setAttribute((isIE?'className':'class'), 'text');
		var span = document.createElement('span');
		span.setAttribute((isIE?'className':'class'), 'imgtitle');
		span.appendChild(document.createTextNode(title));
		td[1].appendChild(span);
		td[1].appendChild(document.createTextNode(alt)); //Put IMG ALT TEXT in TR
		tr[1].appendChild(td[1]); //Put TD in TR
		tbody.appendChild(tr[1]); //Put TR in TABLE
		//END: second row

    }
   }	
  }
}
