I have an array with several equal values

[1,1,1,1,2,3,4,5,5,5,5,1,1,1,1,2,2,2,2,4,5,5,5,9,9,9.9]

I would like a way to get a new array by separating equal values.

For example, the new arrays would have values
[1,1,1,1]
[5,5,5,5]
[1,1,1,1]
[2,2,2,2]
[5,5,5]
[9,9,9,9]

For those new arrays,I must find the index when items changes.

This is what i've tried so far

```
indices = []; // fill with information when items in array change
arreglo = [1,1,1,1,2,3,4,5,5,5,5,1,1,1,1,2,2,2,2,4,5,5,5,9,9,9.9];
for ( u=0; u <= arreglo.length; u++){
            if ( arreglo[u] !=  arreglo[u + 1])
            indices.push(u);
            }

```

The idea is finding the index of the biggest array and then loop in it to create the new ones.

Using a loop i would go from 0 to indices[0], later from indices[0] to indices[1] and so on.

It does not work properly, have problems. Is there any efficient way to do this?

Update: This is not homework, it's for a site for a client. I made a question before [Need ideas: Selecting rows in table](https://stackoverflow.com/questions/10323931/need-ideas-selecting-rows-in-table) but couldnt make it with mysql so i decided using jQuery

{
This is the real code i'm using <http://jsfiddle.net/U58jh/>

In the jsfiddle example this is working good but not always when using different data from a php generated page.

The script must find the last dates (fecha) with a final percent (Porcentaje final) iquals. 
}