You'd do it exactly as I mentioned before
Code:
if ( btnselection == 'firstslide'){
count=0;
}
if ( btnselection == 'lastslide'){
count=3;
}
The condition to take you to the first/last slide is ONLY the clicked button and not the current value of "count". In order to take you to the first slide, set the count to 0. In order to take you to the last slide, set the count to 3