var Vision_Conditional_List; Vision_Conditional_List = new Array(); function doChange(event) { var strQuestionID; var intArray; var arrCond var strLayer; var strCurrentLayer; var bHide; bHide = false; // alert(event.target.value); // alert(event.target.name); // event.target.value tells us the option currently selected // event.target.name tells us the name of the form element strQuestionID = event.target.name.substring(2,event.target.name.length); strCurrentLayer = ""; // alert(strQuestionID); for (intArray = 0; intArray < Vision_Conditional_List.length; intArray++) { arrCond = Vision_Conditional_List[intArray].split('|'); if (arrCond[0] == strQuestionID) { strLayer = "VisionQuestion" + arrCond[1]; $(strLayer).hide(); if (arrCond[2] == event.target.value) { if (bHide) { $("VisionQuestion" + strQuestionID).hide(); $('SubmitPanel').show(); } $(strLayer).show(); strCurrentLayer = strLayer; } } } if (strCurrentLayer != "") { if (bHide) { $("VisionQuestion" + strQuestionID).hide(); } $(strCurrentLayer).show(); } }