var ids=new Array('page_1','page_2','page_3','page_4','page_5','page_6','page_7','page_8','page_9','page_10','page_11'); function switchid(id){ hideallids(); showdiv(id); } function hideallids(){ //loop through the array and hide each element by id for (var i=0;i