scripted_gui = {

	WRS_partizan_start_ui = {
		context_type = player_context
		parent_window_token = politics_tab
		
		window_name = WRS_partizan_start_ui_window

		triggers = {
			partizan_warning_1_visible = {
				NOT = { has_country_flag = WRS_havent_clicked_partizan }
			}
			partizan_warning_2_visible = {
				NOT = { has_country_flag = WRS_havent_clicked_partizan }
			}
		}

		visible = {
			has_country_flag = WRS_partizan_unlock
		}
		
		effects = {
			partizan_start_button_click = {
				if = {
					limit = { NOT = { has_country_flag = WRS_partizan_decision_ui_window_show } }
					set_country_flag = WRS_partizan_decision_ui_window_show
				}
				else_if = {
					limit = { has_country_flag = WRS_partizan_decision_ui_window_show }
					clr_country_flag = WRS_partizan_decision_ui_window_show
				}
				if = {
					limit = { NOT = { has_country_flag = WRS_havent_clicked_partizan } }
					set_country_flag = WRS_havent_clicked_partizan
				}
			}
		}
	}

	WRS_partizan_decision_ui = {
		context_type = player_context #decision_category
		window_name = WRS_partizan_decision_ui_window

		visible = {
			has_country_flag = WRS_partizan_decision_ui_window_show
		}

		triggers = {
		
			partizan_rebels_moskowien_1_visible = {
				WRS = { check_variable = { partizan_current_arming_moskowien > 0 } }
			}
			partizan_rebels_moskowien_2_visible = {
				WRS = { check_variable = { partizan_current_arming_moskowien > 1 } }
			}
			partizan_rebels_moskowien_3_visible = {
				WRS = { check_variable = { partizan_current_arming_moskowien > 2 } }
			}
			partizan_rebels_moskowien_4_visible = {
				WRS = { check_variable = { partizan_current_arming_moskowien > 3 } }
			}
			partizan_rebels_moskowien_5_visible = {
				WRS = { check_variable = { partizan_current_arming_moskowien > 4 } }
			}
			partizan_rebels_moskowien_6_visible = {
				WRS = { check_variable = { partizan_current_arming_moskowien > 5 } }
			}
			partizan_rebels_moskowien_7_visible = {
				WRS = { check_variable = { partizan_current_arming_moskowien > 6 } }
			}
			partizan_rebels_moskowien_8_visible = {
				WRS = { check_variable = { partizan_current_arming_moskowien > 7 } }
			}
			partizan_rebels_moskowien_9_visible = {
				WRS = { check_variable = { partizan_current_arming_moskowien > 8 } }
			}
			partizan_rebels_moskowien_10_visible = {
				WRS = { check_variable = { partizan_current_arming_moskowien > 9 } }
			}
			
			partizan_rebels_kaukasien_1_visible = {
				WRS = { check_variable = { partizan_current_arming_kaukasien > 0 } }
			}
			partizan_rebels_kaukasien_2_visible = {
				WRS = { check_variable = { partizan_current_arming_kaukasien > 1 } }
			}
			partizan_rebels_kaukasien_3_visible = {
				WRS = { check_variable = { partizan_current_arming_kaukasien > 2 } }
			}
			partizan_rebels_kaukasien_4_visible = {
				WRS = { check_variable = { partizan_current_arming_kaukasien > 3 } }
			}
			partizan_rebels_kaukasien_5_visible = {
				WRS = { check_variable = { partizan_current_arming_kaukasien > 4 } }
			}
			
			partizan_rebels_ukraine_1_visible = {
				WRS = { check_variable = { partizan_current_arming_ukraine > 0 } }
			}
			partizan_rebels_ukraine_2_visible = {
				WRS = { check_variable = { partizan_current_arming_ukraine > 1 } }
			}
			partizan_rebels_ukraine_3_visible = {
				WRS = { check_variable = { partizan_current_arming_ukraine > 2 } }
			}
			partizan_rebels_ukraine_4_visible = {
				WRS = { check_variable = { partizan_current_arming_ukraine > 3 } }
			}
			
			partizan_rebels_ostland_1_visible = {
				WRS = { check_variable = { partizan_current_arming_ostland > 0 } }
			}
			partizan_rebels_ostland_2_visible = {
				WRS = { check_variable = { partizan_current_arming_ostland > 1 } }
			}
			partizan_rebels_ostland_3_visible = {
				WRS = { check_variable = { partizan_current_arming_ostland > 2 } }
			}
		
			partizan_ostland_gray_visible = {
				WRS = { 
					check_variable = { 
						var = partizan_current_arming_ostland
						value = 2
					    compare = less_than_or_equals
					}
				}
			}
			partizan_ostland_red_visible = {
				WRS = { check_variable = { partizan_current_arming_ostland > 2 } }
			}
			
			partizan_ukraine_gray_visible = {
				WRS = { 
					check_variable = { 
						var = partizan_current_arming_ukraine
						value = 3
					    compare = less_than_or_equals
					}
				}
			}
			partizan_ukraine_red_visible = {
				WRS = { check_variable = { partizan_current_arming_ukraine > 3 } }
			}
			
			partizan_moskowien_gray_visible = {
				WRS = { 
					check_variable = { 
						var = partizan_current_arming_moskowien
						value = 9
					    compare = less_than_or_equals
					}
				}
			}
			partizan_moskowien_red_visible = {
				WRS = { check_variable = { partizan_current_arming_moskowien > 9 } }
			}
			
			partizan_kaukasien_gray_visible = {
				WRS = { 
					check_variable = { 
						var = partizan_current_arming_kaukasien
						value = 4
					    compare = less_than_or_equals
					}
				}
			}
			partizan_kaukasien_red_visible = {
				WRS = { check_variable = { partizan_current_arming_kaukasien > 4 } }
			}
			
			partizan_current_activity_moskowien_visible = {
				has_country_flag = moskowien_partizan_window_open_flag
			}
			partizan_current_activity_ostland_visible = {
				has_country_flag = ostland_partizan_window_open_flag
			}
			partizan_current_activity_kaukasien_visible = {
				has_country_flag = kaukasien_partizan_window_open_flag
			}
			partizan_current_activity_ukraine_visible = {
				has_country_flag = ukraine_partizan_window_open_flag
			}
			
			Ostland_main_header_visible = {
				has_country_flag = ostland_partizan_window_open_flag
			}
			Ukraine_main_header_visible = {
				has_country_flag = ukraine_partizan_window_open_flag
			}
			Moskowien_main_header_visible = {
				has_country_flag = moskowien_partizan_window_open_flag
			}
			Kaukasien_main_header_visible = {
				has_country_flag = kaukasien_partizan_window_open_flag
			}
			
			partizan_button_support_visible = {
				OR = {
					has_country_flag = ostland_partizan_window_open_flag
					has_country_flag = ukraine_partizan_window_open_flag
					has_country_flag = moskowien_partizan_window_open_flag
					has_country_flag = kaukasien_partizan_window_open_flag
				}
			}
			partizan_button_protect_visible = {
				OR = {
					has_country_flag = ostland_partizan_window_open_flag
					has_country_flag = ukraine_partizan_window_open_flag
					has_country_flag = moskowien_partizan_window_open_flag
					has_country_flag = kaukasien_partizan_window_open_flag
				}
			}
			partizan_button_arming_visible = {
				OR = {
					has_country_flag = ostland_partizan_window_open_flag
					has_country_flag = ukraine_partizan_window_open_flag
					has_country_flag = moskowien_partizan_window_open_flag
					has_country_flag = kaukasien_partizan_window_open_flag
				}
			}
			
			partizan_button_support_click_enabled = {
				NOT = { has_country_flag = has_clicked_partizan_button_support }
				has_political_power > 30
			}
			
			partizan_button_protect_click_enabled = {
				NOT = { has_country_flag = has_clicked_partizan_button_protect }
				has_political_power > 50
				has_country_flag = wrs_protect_available
			}
			
			partizan_button_arming_click_enabled = {
				command_power > 25
				OR = {
					AND = {
						has_country_flag = moskowien_partizan_window_open_flag
						check_variable = { partizan_current_activity_moskowien > 30 }
						check_variable = { partizan_current_arming_moskowien < 10 }
					}
					AND = {
						has_country_flag = ukraine_partizan_window_open_flag
						check_variable = { partizan_current_activity_ukraine > 30 }
						check_variable = { partizan_current_arming_ukraine < 4 }
					}
					AND = {
						has_country_flag = ostland_partizan_window_open_flag
						check_variable = { partizan_current_activity_ostland > 30 }
						check_variable = { partizan_current_arming_ostland < 3 }
					}
					AND = {
						has_country_flag = kaukasien_partizan_window_open_flag
						check_variable = { partizan_current_activity_kaukasien > 30 }
						check_variable = { partizan_current_arming_kaukasien < 5 }
					}
				}
			}
				
			
		}

		effects = {
		
			partizan_button_support_click = {
				add_political_power = -30
				if = {
					limit = {
						has_country_flag = moskowien_partizan_window_open_flag
					}
					add_to_variable = { partizan_current_activity_moskowien = 10 }
				}
				else_if = {
					limit = {
						has_country_flag = ukraine_partizan_window_open_flag
					}
					add_to_variable = { partizan_current_activity_ukraine = 10 }
				}
				else_if = {
					limit = {
						has_country_flag = ostland_partizan_window_open_flag
					}
					add_to_variable = { partizan_current_activity_ostland = 10 }
				}
				else_if = {
					limit = {
						has_country_flag = kaukasien_partizan_window_open_flag
					}
					add_to_variable = { partizan_current_activity_kaukasien = 10 }
				}
				set_country_flag = {
					flag = has_clicked_partizan_button_support
					days = 10
					value = 1
				}
			}
			
			partizan_button_protect_click = {
				add_political_power = -50
				if = {
					limit = {
						has_country_flag = moskowien_partizan_window_open_flag
					}
					GER = {
						set_country_flag = partizan_protected_moskowien
						clr_country_flag = partizan_protected_ukraine
						clr_country_flag = partizan_protected_ostland
						clr_country_flag = partizan_protected_kaukasien
					}
				}
				else_if = {
					limit = {
						has_country_flag = ukraine_partizan_window_open_flag
					}
					GER = {
						set_country_flag = partizan_protected_ukraine
						clr_country_flag = partizan_protected_moskowien
						clr_country_flag = partizan_protected_ostland
						clr_country_flag = partizan_protected_kaukasien
					}
				}
				else_if = {
					limit = {
						has_country_flag = ostland_partizan_window_open_flag
					}
					GER = {
						set_country_flag = partizan_protected_ostland
						clr_country_flag = partizan_protected_ukraine
						clr_country_flag = partizan_protected_moskowien
						clr_country_flag = partizan_protected_kaukasien
					}
				}
				else_if = {
					limit = {
						has_country_flag = kaukasien_partizan_window_open_flag
					}
					GER = {
						set_country_flag = partizan_protected_kaukasien
						clr_country_flag = partizan_protected_ukraine
						clr_country_flag = partizan_protected_moskowien
						clr_country_flag = partizan_protected_ostland
					}
				}
				set_country_flag = {
					flag = has_clicked_partizan_button_protect
					days = 15
					value = 1
				}
			}
		
			partizan_button_arming_click = {
				add_command_power = -25
				if = {
					limit = {
						has_country_flag = moskowien_partizan_window_open_flag
					}
					add_to_variable = { partizan_current_activity_moskowien = -30 }
					add_to_variable = { partizan_current_arming_moskowien = 1 }
				}
				else_if = {
					limit = {
						has_country_flag = ukraine_partizan_window_open_flag
					}
					add_to_variable = { partizan_current_activity_ukraine = -30 }
					add_to_variable = { partizan_current_arming_ukraine = 1 }
				}
				else_if = {
					limit = {
						has_country_flag = ostland_partizan_window_open_flag
					}
					add_to_variable = { partizan_current_activity_ostland = -30 }
					add_to_variable = { partizan_current_arming_ostland = 1 }
				}
				else_if = {
					limit = {
						has_country_flag = kaukasien_partizan_window_open_flag
					}
					add_to_variable = { partizan_current_activity_kaukasien = -30 }
					add_to_variable = { partizan_current_arming_kaukasien = 1 }
				}
			}
		
			exit_from_menu_button_click = {
				clr_country_flag = WRS_partizan_decision_ui_window_show
			}
		
			partizan_ostland_red_click = {
				if = {
					limit = { NOT = { has_country_flag = ostland_partizan_window_open_flag } }
					set_country_flag = ostland_partizan_window_open_flag
				}
				else_if = {
					limit = { has_country_flag = ostland_partizan_window_open_flag }
					clr_country_flag = ostland_partizan_window_open_flag
				}
				clr_country_flag = ukraine_partizan_window_open_flag
				clr_country_flag = moskowien_partizan_window_open_flag
				clr_country_flag = kaukasien_partizan_window_open_flag
			}
			partizan_ostland_gray_click = {
				if = {
					limit = { NOT = { has_country_flag = ostland_partizan_window_open_flag } }
					set_country_flag = ostland_partizan_window_open_flag
				}
				else_if = {
					limit = { has_country_flag = ostland_partizan_window_open_flag }
					clr_country_flag = ostland_partizan_window_open_flag
				}
				clr_country_flag = ukraine_partizan_window_open_flag
				clr_country_flag = moskowien_partizan_window_open_flag
				clr_country_flag = kaukasien_partizan_window_open_flag
			}
			
			partizan_moskowien_red_click = {
				if = {
					limit = { NOT = { has_country_flag = moskowien_partizan_window_open_flag } }
					set_country_flag = moskowien_partizan_window_open_flag
				}
				else_if = {
					limit = { has_country_flag = moskowien_partizan_window_open_flag }
					clr_country_flag = moskowien_partizan_window_open_flag
				}
				clr_country_flag = ukraine_partizan_window_open_flag
				clr_country_flag = ostland_partizan_window_open_flag
				clr_country_flag = kaukasien_partizan_window_open_flag
			}
			partizan_moskowien_gray_click = {
				if = {
					limit = { NOT = { has_country_flag = moskowien_partizan_window_open_flag } }
					set_country_flag = moskowien_partizan_window_open_flag
				}
				else_if = {
					limit = { has_country_flag = moskowien_partizan_window_open_flag }
					clr_country_flag = moskowien_partizan_window_open_flag
				}
				clr_country_flag = ukraine_partizan_window_open_flag
				clr_country_flag = ostland_partizan_window_open_flag
				clr_country_flag = kaukasien_partizan_window_open_flag
			}
			
			partizan_kaukasien_red_click = {
				if = {
					limit = { NOT = { has_country_flag = kaukasien_partizan_window_open_flag } }
					set_country_flag = kaukasien_partizan_window_open_flag
				}
				else_if = {
					limit = { has_country_flag = kaukasien_partizan_window_open_flag }
					clr_country_flag = kaukasien_partizan_window_open_flag
				}
				clr_country_flag = ukraine_partizan_window_open_flag
				clr_country_flag = moskowien_partizan_window_open_flag
				clr_country_flag = ostland_partizan_window_open_flag
			}
			partizan_kaukasien_gray_click = {
				if = {
					limit = { NOT = { has_country_flag = kaukasien_partizan_window_open_flag } }
					set_country_flag = kaukasien_partizan_window_open_flag
				}
				else_if = {
					limit = { has_country_flag = kaukasien_partizan_window_open_flag }
					clr_country_flag = kaukasien_partizan_window_open_flag
				}
				clr_country_flag = ukraine_partizan_window_open_flag
				clr_country_flag = moskowien_partizan_window_open_flag
				clr_country_flag = ostland_partizan_window_open_flag
			}
			
			partizan_ukraine_gray_click = {
				if = {
					limit = { NOT = { has_country_flag = ukraine_partizan_window_open_flag } }
					set_country_flag = ukraine_partizan_window_open_flag
				}
				else_if = {
					limit = { has_country_flag = ukraine_partizan_window_open_flag }
					clr_country_flag = ukraine_partizan_window_open_flag
				}
				clr_country_flag = ostland_partizan_window_open_flag
				clr_country_flag = moskowien_partizan_window_open_flag
				clr_country_flag = kaukasien_partizan_window_open_flag
			}
			partizan_ukraine_red_click = {
				if = {
					limit = { NOT = { has_country_flag = ukraine_partizan_window_open_flag } }
					set_country_flag = ukraine_partizan_window_open_flag
				}
				else_if = {
					limit = { has_country_flag = ukraine_partizan_window_open_flag }
					clr_country_flag = ukraine_partizan_window_open_flag
				}
				clr_country_flag = ostland_partizan_window_open_flag
				clr_country_flag = moskowien_partizan_window_open_flag
				clr_country_flag = kaukasien_partizan_window_open_flag
			}
		}

		properties = {
			partizan_current_activity_ukraine = {
				frame = partizan_current_activity_ukraine
			}
			partizan_current_activity_kaukasien = {
				frame = partizan_current_activity_kaukasien
			}
			partizan_current_activity_moskowien = {
				frame = partizan_current_activity_moskowien
			}
			partizan_current_activity_ostland = {
				frame = partizan_current_activity_ostland
			}
		}
	}
	
}