Button array & Prev/NextImage buttons interaction. How can I do this?

In my Photo gallery I have a buttons array that i like to interact with my Previous and Next button

Like it is now ( take a look att www.apneaimages.com ) when I push one of the buttons they turn BLUE and stay there (visited)
But I like that they turn blue when I use the prev and next Button

my Button array is:

myButtons = [btn1, btn2, btn3];

Then the Next Button script is:

function nextImage() {
 if (cur == pArray.length-1) {
 } else {

There must be a way to arhive this if I use the cur & pArray but how can I do this?