fpr what its worth, these are some the handler functions I have created. the logic s fine, but your suggestion is much less work, it seems, and there are a few bugs which i commented out. i am not an expert in JS, its not veryintuitive for me
function get_system_states() { var ref = document.getElementById('mb_system_state_references'); var systemz = []; systemz = ref.innerHTML.split(":",33); // innerHTML default state reference (U=Unopen, O=Open, M=Minimized) :> //100=U:101=U:102=U:103=U:104=U:105=U:106=U:107=U:108=U:109=U: //110=U:111=U:112=U:113=U:114=U:115=U:116=U:117=U:118=U:119=U: //120=U:121=U:122=U:123=U:124=U:125=U:126=U:127=U:128=U:129=U: //130=U:131=U:132=U var mb_statez = []; for(k=100;k<133;k++) { var n = k-100; // system 100 should be index 0, system 132 should be index 32 var sys_string = systemz[n]; var system_statez = sys_string.split("=",2); var state = system_statez[1]; // index 0 should be the system number, index 1 is the letter U, M or O mb_statez[n] = state; } // end loop return mb_statez; } // end function function get_system_state(system_index) { system_index+=''; var s = get_system_states(); var n = (parseInt(system_index)-100); return s[n]; } function set_system_state(system_index,new_state){ var s = []; s=get_system_states(); var n = 0; system_index+=''; var new_ref_string=""; //alert('setting new system state: '+new_state); for(k=100;k<133;k++) { n = k-100; //if not the setting we are setting, write its current state if ((system_index)==k.toString()) { new_ref_string+=k+'='+new_state; } else { // else, write the new one new_ref_string+=k+'='+s[n]; } // end else new_ref_string+=":"; } // end for loop document.getElementById('mb_system_state_references').innerHTML=new_ref_string; //alert('writing new innerHTML as: '+new_ref_string); return false; } // function function minimize_mb_system(system_index) { //if (get_system_state(system_index)=="M") // { system_index+=''; var sp_div_id = 'system'+system_index+''; var min_div_id = 'system'+system_index+'_minimized'; Effect.SwitchOff(sp_div_id); Effect.Appear(min_div_id); set_system_state(system_index,"M"); return false; // } // else { var warning = "system display state is already minimized. did not collapse."; return warning; } } function restore_mb_system(system_index) { //if (get_system_state(system_index)=="O") // { system_index+=''; var sp_div_id = 'system'+system_index; var min_div_id = 'system'+system_index+'_minimized'; Effect.Appear(''+sp_div_id+''); Effect.SwitchOff(''+min_div_id+''); set_system_state(system_index,"O"); return false; // } // else { var warning = "system display state is already open. did not restore."; return warning; } } -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/dQqsVP_C75wJ. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.