scripted_gui = {

	SBI_KAZAKHSTAN_decision_ui = {
		context_type = decision_category
		window_name = "SBI_KAZAKHSTAN_decision_ui_window"

		dynamic_lists = {
			KZN_CityList = {
				index = city_idx
			}
		}

		triggers = {
			KAZAKHSTAN_center_gray_visible = {
				KZN = { check_variable = { KZN_center_revolt_Progress > 69 } }
			}
			KAZAKHSTAN_center_red_visible = {
				KZN = { check_variable = { KZN_center_revolt_Progress < 70 } }
			}
			KAZAKHSTAN_south_gray_visible = {
				KZN = { check_variable = { KZN_south_revolt_Progress > 69 } }
			}
			KAZAKHSTAN_south_red_visible = {
				KZN = { check_variable = { KZN_south_revolt_Progress < 70 } }
			}
			KAZAKHSTAN_east_gray_visible = {
				KZN = { check_variable = { KZN_east_revolt_Progress > 69 } }
			}
			KAZAKHSTAN_east_red_visible = {
				KZN = { check_variable = { KZN_east_revolt_Progress < 70 } }
			}
			KAZAKHSTAN_west_gray_visible = {
				KZN = { check_variable = { KZN_west_revolt_Progress > 69 } }
			}
			KAZAKHSTAN_west_red_visible = {
				KZN = { check_variable = { KZN_west_revolt_Progress < 70 } }
			}
			KAZAKHSTAN_north_gray_visible = {
				KZN = { check_variable = { KZN_north_revolt_Progress > 69 } }
			}
			KAZAKHSTAN_north_red_visible = {
				KZN = { check_variable = { KZN_north_revolt_Progress < 70 } }
			}
			
			
			
			KZN_center_revolt_bar_visible = {
				check_variable = { KZN_revolt_City_Frame^city_idx = 1 }
			}
			KZN_south_revolt_bar_visible = {
				check_variable = { KZN_revolt_City_Frame^city_idx = 2 }
			}
			KZN_west_revolt_bar_visible = {
				check_variable = { KZN_revolt_City_Frame^city_idx = 3 }
			}
			KZN_north_revolt_bar_visible = {
				check_variable = { KZN_revolt_City_Frame^city_idx = 4 }
			}
			KZN_east_revolt_bar_visible = {
				check_variable = { KZN_revolt_City_Frame^city_idx = 5 }
			}
		}
		
		effects = {
			KAZAKHSTAN_center_red_click = {
				set_country_flag = KAZAKHSTAN_center_open_flag
				clr_country_flag = KAZAKHSTAN_west_open_flag
				clr_country_flag = KAZAKHSTAN_east_open_flag
				clr_country_flag = KAZAKHSTAN_north_open_flag
				clr_country_flag = KAZAKHSTAN_south_open_flag
				set_variable = { KZN_revolt_City_Frame^city_idx = 1 }
				if = {
					limit = { original_tag = WSR }
					set_country_flag = KZN_OUR_open_flag
					clr_country_flag = KZN_NOT_OUR_open_flag
				}
				else_if = {
					limit = { original_tag = SBI }
					set_country_flag = KZN_NOT_OUR_open_flag
					clr_country_flag = KZN_OUR_open_flag
				}
			}
			KAZAKHSTAN_north_red_click = {
				clr_country_flag = KAZAKHSTAN_center_open_flag
				clr_country_flag = KAZAKHSTAN_west_open_flag
				clr_country_flag = KAZAKHSTAN_east_open_flag
				set_country_flag = KAZAKHSTAN_north_open_flag
				clr_country_flag = KAZAKHSTAN_south_open_flag
				set_variable = { KZN_revolt_City_Frame^city_idx = 4 }
				if = {
					limit = { original_tag = WSR }
					set_country_flag = KZN_OUR_open_flag
					clr_country_flag = KZN_NOT_OUR_open_flag
				}
				else_if = {
					limit = { original_tag = SBI }
					set_country_flag = KZN_NOT_OUR_open_flag
					clr_country_flag = KZN_OUR_open_flag
				}
			}
			KAZAKHSTAN_south_red_click = {
				clr_country_flag = KAZAKHSTAN_center_open_flag
				clr_country_flag = KAZAKHSTAN_west_open_flag
				clr_country_flag = KAZAKHSTAN_east_open_flag
				clr_country_flag = KAZAKHSTAN_north_open_flag
				set_country_flag = KAZAKHSTAN_south_open_flag
				set_variable = { KZN_revolt_City_Frame^city_idx = 2 }
				if = {
					limit = { original_tag = WSR }
					set_country_flag = KZN_OUR_open_flag
					clr_country_flag = KZN_NOT_OUR_open_flag
				}
				else_if = {
					limit = { original_tag = SBI }
					set_country_flag = KZN_NOT_OUR_open_flag
					clr_country_flag = KZN_OUR_open_flag
				}
			}
			KAZAKHSTAN_east_red_click = {
				clr_country_flag = KAZAKHSTAN_center_open_flag
				clr_country_flag = KAZAKHSTAN_west_open_flag
				set_country_flag = KAZAKHSTAN_east_open_flag
				clr_country_flag = KAZAKHSTAN_north_open_flag
				clr_country_flag = KAZAKHSTAN_south_open_flag
				set_variable = { KZN_revolt_City_Frame^city_idx = 5 }
				if = {
					limit = { original_tag = WSR }
					set_country_flag = KZN_OUR_open_flag
					clr_country_flag = KZN_NOT_OUR_open_flag
				}
				else_if = {
					limit = { original_tag = SBI }
					set_country_flag = KZN_NOT_OUR_open_flag
					clr_country_flag = KZN_OUR_open_flag
				}
			}
			KAZAKHSTAN_west_red_click = {
				clr_country_flag = KAZAKHSTAN_center_open_flag
				set_country_flag = KAZAKHSTAN_west_open_flag
				clr_country_flag = KAZAKHSTAN_east_open_flag
				clr_country_flag = KAZAKHSTAN_north_open_flag
				clr_country_flag = KAZAKHSTAN_south_open_flag
				set_variable = { KZN_revolt_City_Frame^city_idx = 3 }
				if = {
					limit = { original_tag = WSR }
					set_country_flag = KZN_OUR_open_flag
					clr_country_flag = KZN_NOT_OUR_open_flag
				}
				else_if = {
					limit = { original_tag = SBI }
					set_country_flag = KZN_NOT_OUR_open_flag
					clr_country_flag = KZN_OUR_open_flag
				}
			}
			
			KAZAKHSTAN_center_gray_click = {
				set_country_flag = KAZAKHSTAN_center_open_flag
				clr_country_flag = KAZAKHSTAN_west_open_flag
				clr_country_flag = KAZAKHSTAN_east_open_flag
				clr_country_flag = KAZAKHSTAN_north_open_flag
				clr_country_flag = KAZAKHSTAN_south_open_flag
				set_variable = { KZN_revolt_City_Frame^city_idx = 1 }
				if = {
					limit = { original_tag = WSR }
					set_country_flag = KZN_OUR_open_flag
					clr_country_flag = KZN_NOT_OUR_open_flag
				}
				else_if = {
					limit = { original_tag = SBI }
					set_country_flag = KZN_NOT_OUR_open_flag
					clr_country_flag = KZN_OUR_open_flag
				}
			}
			KAZAKHSTAN_north_gray_click = {
				clr_country_flag = KAZAKHSTAN_center_open_flag
				clr_country_flag = KAZAKHSTAN_west_open_flag
				clr_country_flag = KAZAKHSTAN_east_open_flag
				set_country_flag = KAZAKHSTAN_north_open_flag
				clr_country_flag = KAZAKHSTAN_south_open_flag
				set_variable = { KZN_revolt_City_Frame^city_idx = 4 }
				if = {
					limit = { original_tag = WSR }
					set_country_flag = KZN_OUR_open_flag
					clr_country_flag = KZN_NOT_OUR_open_flag
				}
				else_if = {
					limit = { original_tag = SBI }
					set_country_flag = KZN_NOT_OUR_open_flag
					clr_country_flag = KZN_OUR_open_flag
				}
			}
			KAZAKHSTAN_south_gray_click = {
				clr_country_flag = KAZAKHSTAN_center_open_flag
				clr_country_flag = KAZAKHSTAN_west_open_flag
				clr_country_flag = KAZAKHSTAN_east_open_flag
				clr_country_flag = KAZAKHSTAN_north_open_flag
				set_country_flag = KAZAKHSTAN_south_open_flag
				set_variable = { KZN_revolt_City_Frame^city_idx = 2 }
				if = {
					limit = { original_tag = WSR }
					set_country_flag = KZN_OUR_open_flag
					clr_country_flag = KZN_NOT_OUR_open_flag
				}
				else_if = {
					limit = { original_tag = SBI }
					set_country_flag = KZN_NOT_OUR_open_flag
					clr_country_flag = KZN_OUR_open_flag
				}
			}
			KAZAKHSTAN_east_gray_click = {
				clr_country_flag = KAZAKHSTAN_center_open_flag
				clr_country_flag = KAZAKHSTAN_west_open_flag
				set_country_flag = KAZAKHSTAN_east_open_flag
				clr_country_flag = KAZAKHSTAN_north_open_flag
				clr_country_flag = KAZAKHSTAN_south_open_flag
				set_variable = { KZN_revolt_City_Frame^city_idx = 5 }
				if = {
					limit = { original_tag = WSR }
					set_country_flag = KZN_OUR_open_flag
					clr_country_flag = KZN_NOT_OUR_open_flag
				}
				else_if = {
					limit = { original_tag = SBI }
					set_country_flag = KZN_NOT_OUR_open_flag
					clr_country_flag = KZN_OUR_open_flag
				}
			}
			KAZAKHSTAN_west_gray_click = {
				clr_country_flag = KAZAKHSTAN_center_open_flag
				set_country_flag = KAZAKHSTAN_west_open_flag
				clr_country_flag = KAZAKHSTAN_east_open_flag
				clr_country_flag = KAZAKHSTAN_north_open_flag
				clr_country_flag = KAZAKHSTAN_south_open_flag
				set_variable = { KZN_revolt_City_Frame^city_idx = 3 }
				if = {
					limit = { original_tag = WSR }
					set_country_flag = KZN_OUR_open_flag
					clr_country_flag = KZN_NOT_OUR_open_flag
				}
				else_if = {
					limit = { original_tag = SBI }
					set_country_flag = KZN_NOT_OUR_open_flag
					clr_country_flag = KZN_OUR_open_flag
				}
			}
			
		}

		properties = {
			KZN_revolt_CityImage = { frame = KZN_revolt_City_Frame^city_idx }
			
			KZN_north_revolt_bar = { frame = KZN.KZN_north_revolt_Progress }
			KZN_south_revolt_bar = { frame = KZN.KZN_south_revolt_Progress }
			KZN_center_revolt_bar = { frame = KZN.KZN_center_revolt_Progress }
			KZN_east_revolt_bar = { frame = KZN.KZN_east_revolt_Progress }
			KZN_west_revolt_bar = { frame = KZN.KZN_west_revolt_Progress }
		}
		
		visible = {
			always = yes
		}
	}
	
}