function new_medal(butt_src,altText,b_link,b_target,n){
txt = document.getElementsByName('zachto');

for (code_i=0; code_i < txt.length; code_i++){

textAr = txt[code_i];

if(textAr){
var newA = document.createElement('A');

if (b_target!='#'){
newA.href = b_link;
newA.target = b_target;
}
else
{
newA.href = '#';
newA.target = '_self';
newA.onClick = b_link;
}
var URL_img = textAr.parentNode.childNodes[n];

textAr.parentNode.insertBefore(newA, URL_img);
var tagA = textAr.parentNode.childNodes[n];
tagA.appendChild(document.createElement('img'));
tagA.lastChild.src = butt_src;
tagA.lastChild.border = 0;
tagA.lastChild.alt = altText;
tagA.lastChild.title = altText;
tagA.lastChild.name = code_i;
tagA.lastChild.id = code_i;
textAr.parentNode.insertBefore(document.createTextNode(unescape('%20')), URL_img);}
}
}
function text_paste_zam(code){
strzam=document.getElementsByName('zachto');
for (code_i=0; code_i < strzam.length; code_i++){
strzam[code_i].value=strzam[code_i].value+code;
}
}
for (j=1; j < medals_code.length; j++){
new_medal(medals_url[j],medals_code[j],"JavaScript:text_paste_zam(' "+medals_code[j]+" ');","_self",j*2+9);
}
