var toolbarData = new Array(); toolbarData[1] = new Array('Play_Ayah.gif', 'Play_Ayah_Over.gif', 'Play_Ayah.gif'); toolbarData[2] = new Array('Prev.gif', 'Prev_Over.gif', 'Prev_On.gif'); toolbarData[3] = new Array('Play.gif', 'Play_Over.gif', 'Play_On.gif'); toolbarData[4] = new Array('Pause.gif', 'Pause_Over.gif', 'Pause_On.gif'); toolbarData[5] = new Array('Stop.gif', 'Stop_Over.gif', 'Stop.gif'); toolbarData[6] = new Array('Next.gif', 'Next_Over.gif', 'Next_On.gif'); toolbarData[7] = new Array('Play_Surah.gif', 'Play_Surah_Over.gif', 'Play_Surah.gif'); toolbarData[8] = new Array('Center.gif', 'Center_Over.gif', 'Center.gif'); toolbarData[9] = new Array('Off.gif', 'Off_Over.gif', 'Off.gif'); toolbarData[10] = new Array('On.gif', 'On_Over.gif', 'On.gif'); // store the ID of the currently clicked button var currentSelection = -1; // -1 = initial dummy value //var = document.getElementById("2").object; pl_btn = new Image(); pl_btn.id = '3'; pl_btn.src = 'Play_On.gif'; function play_on() { document.getElementById("3").src = 'Play_On.gif'; } function play_off() { document.getElementById("3").src = 'Play.gif'; } // function to change button state on hover function highlightItem(obj, state) { // get button ID i = obj.getAttribute('id'); // check if it is currently clicked // if not, change state (normal=0, highlight=1) if (i != currentSelection) { if (state == 1) { obj.setAttribute('src', toolbarData[i][1]); } else { obj.setAttribute('src', toolbarData[i][0]); } } } // function to change button state on click function selectItem(obj) { // get button ID i = obj.getAttribute('id'); // reset all toolbar buttons to normal tbar = document.getElementById('toolbar'); items = tbar.getElementsByTagName('img'); for (x = 0; x < items.length; x++) { items[x].setAttribute('src', toolbarData[(x + 1)][0]); } // set selected button to click state obj.setAttribute('src', toolbarData[i][2]); // publish ID of clicked button currentSelection = i; } function switch_sound(id1, id2) { document.getElementById(id1).width = '0'; document.getElementById(id1).height = '0'; document.getElementById(id2).width = '35'; document.getElementById(id2).height = '30'; };