
/* default values */
path2images = "";
replaceImages = new Array();
tag = "";

function firdom() {
	if(document.getElementsByTagName && document.createElement){
		for (l=1;l<=6;l++){
			h1s=document.getElementsByTagName('h'+l);
			scanandreplace(h1s,'h'+l, replaceImages);
		}
	}
}

/* scan h1's and replace with images */
function scanandreplace(h1s,tag,headerArray){
	for(i=0;i<h1s.length;i++){
		for(f=0;f<headerArray.length;f++){
			chunks=headerArray[f].split('|');
			thish1=document.getElementsByTagName(tag)[i];
			if(thish1.firstChild.nodeValue==chunks[0]){
				newImg=document.createElement('img');			
				newImg.setAttribute('alt',chunks[0]);
				newImg.setAttribute('src',path2images + chunks[1] + '.gif');
				newImg.setAttribute('id',chunks[1]+'Img');
				// or newImg.src=chunks[1];
				thish1.replaceChild(newImg,thish1.firstChild)
			}
		}
	}
}