scripted_gui = {
	custom_tabview_container_topbar = {
		context_type = player_context
		parent_window_token = top_bar
		window_name = "custom_tabview_buttons_container"

		visible = {
			always = yes
		}
		
		triggers = {
			# topbar_page_bg_visible = {
				# check_variable = { show_local_topbar_page > 1 }
			# }
		}
		
		# properties = {
			# page_button = {
				# frame = show_local_topbar_page
			# }
		# }
		
		effects = {
			# page_button_click = {
				# if = {
					# limit = {
						# NOT = {
							# has_variable = show_local_topbar_page
						# }
					# }
					# set_variable = { show_local_topbar_page = 1 }
				# }
				# add_to_variable = { show_local_topbar_page = 1 }
				# #max amount of pages, increase if in need
				# if = {
					# limit = {
						# check_variable = { show_local_topbar_page > 2 }
					# }
					# set_variable = { show_local_topbar_page = 1 }
				# }
			# }
			
			mhc_button_click = {
				if = {
					limit = {
						check_variable = { show_local_mhc = 0 }
					}
					set_variable = { show_local_mhc = 1 }
				}
				else = {
					set_variable = { show_local_mhc = 0 }
				}
				if = {
					limit = {
						has_country_flag = TTT_opened
					}
					clr_country_flag = TTT_opened
				}
				if = {
					limit = {
						has_country_flag = SP_opened
					}
					clr_country_flag = SP_opened
				}
				if = {
					limit = {
						has_country_flag = NMC_opened
					}
					clr_country_flag = NMC_opened
				}
			}
			
			open_internal_politics_click = {
				if = {
					limit = { NOT = { has_country_flag = TTT_opened } }
					set_country_flag = TTT_opened
				}
				else = {
					clr_country_flag = TTT_opened
				}
				if = {
					limit = {
						check_variable = { show_local_mhc = 1 }
					}
					set_variable = { show_local_mhc = 0 }
				}
				if = {
					limit = {
						has_country_flag = SP_opened
					}
					clr_country_flag = SP_opened
				}
				if = {
					limit = {
						has_country_flag = NMC_opened
					}
					clr_country_flag = NMC_opened
				}
			}
		}
	}
}