/* following uses arrays declared in the calling code
	0907220826 changed first 'alt' attribute in pam var to be 'title'
	090820 changed pam 'href' attribute to 'name' from 'title' however IE7 does not find them
	090821 fixed IE7 problem in line 14 not quite sure how!
	090823 added style to table cell t2r1c2 - added attribute 'id' into the pam string for future reference
	       re-arranged pam string into three lines.
 */

function addItems(item,thumb,altTh,big,altBig,price,sdesc,ldesc) {
    if (item.length>0 && document.getElementById && document.createElement) {

// add note to click on pics
	newPara=document.createElement('p'); // newPara is a global variable for new paragraphs, it is defined in krono_navs
	newPara.innerHTML='<span style="font-size:12pt">(click on an image to see more info, click browser back-button to return to this page)</span>';
	document.getElementById("t2r1c2").style.textAlign = 'center';
	document.getElementById("t2r1c2").appendChild(newPara);

	// add a table to receive the collection content
	var newTable=document.createElement('table');
	newTable.id="t3";
	newTable.className="sub";
	document.getElementById("t2r1c2").appendChild(newTable);
	var newTbody=document.createElement('tbody'); // needed by IE 6 et subs
	newTbody.id="t3b1";

	// the row content
	newTable.appendChild(newTbody);
	var newRow=null;
	var newCell=null;
	var numItems=item.length;
		for (j=0;j<numItems;j++) {
		newRow=document.createElement('tr');
		newRow.id='t3r'+(j+1);
		newTbody.appendChild(newRow);
		newCell=document.createElement('td');
		newCell.id=newRow.id+'c1';
		newCell.className="w";
		newRow.appendChild(newCell);
		// <a href="url" name="item" id="item"><img src="thumb" alt="altTh"/></a><p>price</p>
		pam='<a href="'+big[j]+'" name="'+item[j]+'" id="'+item[j]+'">';
		pam=pam+'<img src="'+thumb[j]+'" alt="' +altTh[j]+'"/></a>';
		pam=pam+'<p>'+price[j]+'</p>';
		newCell.innerHTML=pam;
		newCell=document.createElement('td');
		newCell.id=newRow.id+'c2';
		newCell.className="dat2";
		newRow.appendChild(newCell);
		newCell.innerHTML='<p>'+sdesc[j]+'</p><p>' +ldesc[j]+'</p>';
		} // endfor
	} // end if there are some items and objects are OK
	else {
	alert ("can't add items");
	} // end else if objects not found
} // end function addItems

// end of file