How to display/hide section based on id

Hi All,

When i double click on the event id which will pop up the edit modal.

I want based on leavetype dropdown value ev.leavetype_id if value contains maternity/funeral. I try to display maternity section or funeral section. If not fall on leavetype_id (maternity/funeral) then hide the both section:-

I have a code below:-

                            if(getLeave(ev.leavetype_id).indexOf('Maternity') > -1)
                            {
                                    //Display Maternity Section
                                    var style = "block";
                                    var nodesA = document.all[32];
                                    nodesA.style.display=style; // editor area
                                    nodesA.previousSibling.style.display=style; //section header
                                    scheduler.setLightboxSize(); //correct size of lightbox

                                    //Hide Funeral Section
                                    var style = "none";
                                    var nodesA = document.all[39];
                                    nodesA.style.display=style; // editor area
                                    nodesA.previousSibling.style.display=style; //section header
                                    scheduler.setLightboxSize(); //correct size of lightbox
                                
                            }
                            else if(getLeave(ev.leavetype_id).indexOf('Funeral') > -1)
                            {
                                //Display Funeral Section
                                var style = "block";
                                var nodesA = document.all[39];
                                nodesA.style.display=style; // editor area
                                nodesA.previousSibling.style.display=style; //section header
                                scheduler.setLightboxSize(); //correct size of lightbox

                                //Hide Maternity Section
                                var style = "none";
                                var nodesA = document.all[32];
                                nodesA.style.display=style; // editor area
                                nodesA.previousSibling.style.display=style; //section header
                                scheduler.setLightboxSize(); //correct size of lightbox
                               
                            }else{
                                //Hide Maternity Section
                                var style = "node";
                                var nodesA = document.all[32];
                                nodesA.style.display=style; // editor area
                                nodesA.previousSibling.style.display=style; //section header
                                scheduler.setLightboxSize(); //correct size of lightbox

                                //Hide Funeral Section
                                var style = "none";
                                var nodesA = document.all[39];
                                nodesA.style.display=style; // editor area
                                nodesA.previousSibling.style.display=style; //section header
                                scheduler.setLightboxSize(); //correct size of lightbox

                            }

But where can i run this code?

Please Advise.

Thank you.

Regards,
Micheale

scheduler.attachEvent("onLightbox", function(id){ ... your code here ... scheduler.resetLightbox(); });