var vidArray=new Array('highVid','mediumVid','lowVid'); function selectVid(Vid){ for (i = 0; i < vidArray.length; i++){ //alert(vidArray[i]) var listElementStyle = document.getElementById(vidArray[i]).style; listElementStyle.display="none"; } toggle(Vid); } function toggle(list){ var listElementStyle=document.getElementById(list).style; if (listElementStyle.display=="none"){ listElementStyle.display="block"; } else{ listElementStyle.display="none"; } }