for(k=0;k<a.length;k++) { if(a[k].substr(0,7)=='http://') a[k]='<a href='+a[k]+' target=_blank>'+a[k]+'</a>'; a[k] = a[k].replace(/\*([0-9]{1,3})/,' <img src="img/smile/$1" onclick="sendto(this.title)" title=" *$1 " style="cursor: pointer; cursor: hand;" alt="" /> '); }