def _generate_main_scripts(self):
        """
        Include the scripts used by solutions.
        """

        head = self.parser.find('head').first_result()
        if head is not None:
            common_functions_script = self.parser.find(
                '#'
                + AccessibleEventImplementation.ID_SCRIPT_COMMON_FUNCTIONS
            ).first_result()
            if common_functions_script is None:
                common_functions_file = open(
                    os.path.join(
                        os.path.dirname(os.path.dirname(os.path.dirname(
                            os.path.realpath(__file__)
                        ))),
                        'js',
                        'common.js'
                    ),
                    'r'
                )
                common_functions_content = common_functions_file.read()
                common_functions_file.close()

                common_functions_script = self.parser.create_element('script')
                common_functions_script.set_attribute(
                    'id',
                    AccessibleEventImplementation.ID_SCRIPT_COMMON_FUNCTIONS
                )
                common_functions_script.set_attribute(
                    'type',
                    'text/javascript'
                )
                common_functions_script.append_text(common_functions_content)
                head.prepend_element(common_functions_script)
            if (
                self.parser.find(
                    '#'
                    + AccessibleEventImplementation.ID_SCRIPT_EVENT_LISTENER
                ).first_result() is None
            ):
                event_listener_file = open(
                    os.path.join(
                        os.path.dirname(os.path.dirname(os.path.dirname(
                            os.path.realpath(__file__)
                        ))),
                        'js',
                        'eventlistener.js'
                    ),
                    'r'
                )
                event_listener_script_content = event_listener_file.read()
                event_listener_file.close()

                script = self.parser.create_element('script')
                script.set_attribute(
                    'id',
                    AccessibleEventImplementation.ID_SCRIPT_EVENT_LISTENER
                )
                script.set_attribute('type', 'text/javascript')
                script.append_text(event_listener_script_content)
                common_functions_script.insert_after(script)
        local = self.parser.find('body').first_result()
        if local is not None:
            self.script_list = self.parser.find(
                '#'
                + AccessibleEventImplementation.ID_LIST_IDS_SCRIPT
            ).first_result()
            if self.script_list is None:
                self.script_list = self.parser.create_element('script')
                self.script_list.set_attribute(
                    'id',
                    AccessibleEventImplementation.ID_LIST_IDS_SCRIPT
                )
                self.script_list.set_attribute('type', 'text/javascript')
                self.script_list.append_text('var activeElements = [];')
                self.script_list.append_text('var hoverElements = [];')
                self.script_list.append_text('var dragElements = [];')
                self.script_list.append_text('var dropElements = [];')
                local.append_element(self.script_list)
            if self.parser.find(
                    '#'
                    + AccessibleEventImplementation.ID_FUNCTION_SCRIPT_FIX
            ).first_result() is None:
                include_file = open(
                    os.path.join(
                        os.path.dirname(os.path.dirname(os.path.dirname(
                            os.path.realpath(__file__)
                        ))),
                        'js',
                        'include.js'
                    ),
                    'r'
                )
                local_include_script_content = include_file.read()
                include_file.close()

                script_function = self.parser.create_element('script')
                script_function.set_attribute(
                    'id',
                    AccessibleEventImplementation.ID_FUNCTION_SCRIPT_FIX
                )
                script_function.set_attribute('type', 'text/javascript')
                script_function.append_text(local_include_script_content)
                local.append_element(script_function)
        self.main_script_added = True
Include the scripts used by solutions.