Using sub-string function i want to get image no. from string ,

i am applying sub-string to below property .this return 3 at the end in chrome but in mozilla it is not working properly.

**Problem :**
 above " -->" after this i have written chrome values , in mozilla on third step i get .jpg instead of 3.jpg

```
alert("obj.back is "+obj.style.backgroundImage);-->url(http://localhost/final.21/img/img3.jpg);
    origImg = obj.style.backgroundImage.split(")")[0];
    alert('origImg is'+origImg);  -->>url(http://localhost/final.21/img/img3.jpg
    alert('after length '+origImg.substring(origImg.length-5)); -->3.jpg
    origImg = origImg.substring(origImg.length-5).split(".")[0];
    alert('origImg is'+origImg);  --> 3

```