HTML низ

Код:
<script type="text/javascript">
var we=document.getElementsByTagName("ul")
var x=0
for (x=0; x<=(we.length-1); x++)
{if (we[x].innerHTML.indexOf("pa-online")!=-1)
{we[x].innerHTML=we[x].innerHTML.substring(0, (we[x].innerHTML.indexOf("pa-online")-11))+"<center><img src=картинка online></center>"}
else if ((we[x].innerHTML.indexOf("pa-online")==-1)&&(we[x].innerHTML.indexOf("pa-author")!=-1))
{we[x].innerHTML=we[x].innerHTML+"<center><img src=картинка offline></center>"}
}
</script>