HTML низ

Код:
    <script type="text/javascript">
    defaultPict = "https://forumupload.ru/uploads/0000/12/13/61-1.png"

    var arr=document.getElementsByTagName("ul")
    i=1
    while(arr[++i]){
    str=arr[i].innerHTML
    if(str.indexOf("pa-avatar")==-1) {
    q=str.toLowerCase()
    if((pos=q.indexOf("<li class=pa-from>"))!=-1 || (pos=q.indexOf("<li class=\"pa-from\">"))!=-1 || (pos=q.indexOf("<li class=pa-reg>"))!=-1 || (pos=q.indexOf("<li class=\"pa-reg\">"))!=-1){
    nstr =str.substring(0,pos)
    nstr+="<li class=\"pa-avatar item2\"><img src="+ defaultPict +" alt=\"Аватар\" /></li>"
    nstr+=str.substring(pos)
    arr[i].innerHTML=nstr
    }}}
    </script>