scripted_gui = {
  constitution_main_gui = {
    window_name = "constitution_gui"
    context_type = player_context
    visible = {
		has_country_flag = constitution_open
    }

    effects = {
		close_button_click = { clr_country_flag = constitution_open }
		button_enb_elec_click = { 
    					if = { limit = { has_political_power > 1000 } 
							add_political_power = -1000
							set_variable = { elecstat = 1 }
							set_variable = { elecstatt = 2 }
						if = { limit = { has_government = democratic } 
							set_politics = {
						ruling_party = democratic
    						elections_allowed = yes
								}
							}
						if = { limit = { has_government = communism } 
							set_politics = {
						ruling_party = communism
    						elections_allowed = yes
								}
							}
						if = { limit = { has_government = fascism } 
							set_politics = {
						ruling_party = fascism
    						elections_allowed = yes
								}
							}
						if = { limit = { has_government = neutrality } 
							set_politics = {
						ruling_party = neutrality
    						elections_allowed = yes
								}
							}
							}
			}
		button_dsb_elec_click = { 
    					if = { limit = { has_political_power > 1000 } 
							add_political_power = -1000
							set_variable = { elecstat = 2 }
							set_variable = { elecstatt = 1 }
						if = { limit = { has_government = democratic } 
							set_politics = {
						ruling_party = democratic
    						elections_allowed = no
								}
							}
						if = { limit = { has_government = communism } 
							set_politics = {
						ruling_party = communism
    						elections_allowed = no
								}
							}
						if = { limit = { has_government = fascism } 
							set_politics = {
						ruling_party = fascism
    						elections_allowed = no
								}
							}
						if = { limit = { has_government = neutrality } 
							set_politics = {
						ruling_party = neutrality
    						elections_allowed = no
								}
							}
								}
							
				
							}
		
		
		button_enb_parl_click = { 
    					if = { limit = { has_political_power > 600
										NOT = { has_government = democratic }
										NOT = { has_government = communism }
										NOT = { has_government = fascism }  
																	}
							add_political_power = -600
							clr_country_flag = parlab
							if = { limit = { NOT = { has_country_flag = alrparl } }
							parliament_gui_initial = yes
							}
							set_country_flag = ablist
							set_variable = { parlstat = 1 }
							set_variable = { parlstatt = 2 }
							}
			}
			
		button_dsb_parl_click = { 
    					if = { limit = { has_political_power > 600
							NOT = { has_government = democratic } } 
							add_political_power = -600
							clr_country_flag = liberal_majority
							clr_country_flag = conservative_majority
							clr_country_flag = progressive_majority
							clr_country_flag = nationalist_majority
							set_country_flag = parlab
							clr_country_flag = ablist
							set_variable = { parlstat = 2 }
							set_variable = { parlstatt = 1 }
							}
			}
			
		button_enb_free_click = { 
    					if = { limit = { has_political_power > 600 } 
							add_political_power = -600
							set_country_flag = liberties_protected
							clr_country_flag = liberties_restricted
							set_variable = { freestat = 1 }
							set_variable = { freestatt = 2 }
							}
			}
			
		button_dsb_free_click = { 
    					if = { limit = { has_political_power > 600 } 
							add_political_power = -600
							set_country_flag = liberties_restricted
							clr_country_flag = liberties_protected
							set_variable = { freestat = 2 }
							set_variable = { freestatt = 1 }
							}
			}
			
		button_federal_click = { 
    					if = { limit = { has_political_power > 600 } 
							add_political_power = -600
							set_country_flag = federal_c
							clr_country_flag = unitary_c
							set_variable = { fedstat = 1 }
							set_variable = { fedstatt = 2 }
							}
			}
			
		button_unitarian_click = { 
    					if = { limit = { has_political_power > 600 } 
							add_political_power = -600
							set_country_flag = unitary_c
							clr_country_flag = federal_c
							set_variable = { fedstat = 2 }
							set_variable = { fedstatt = 1 }
							}
			}
			
		button_gunsr_free_click = { 
    					if = { limit = { has_political_power > 600 } 
							add_political_power = -600
							set_country_flag = gun_rest
							clr_country_flag = gun_prot
							set_variable = { gunstat = 1 }
							set_variable = { gunstatt = 2 }
							}
			}
			
		button_guns_free_click = { 
    					if = { limit = { has_political_power > 600 } 
							add_political_power = -600
							set_country_flag = gun_prot
							clr_country_flag = gun_rest
							set_variable = { gunstat = 2 }
							set_variable = { gunstatt = 1 }
							}
			}
			
		button_seperated_free_click = { 
    					if = { limit = { has_political_power > 600 } 
							add_political_power = -600
							set_country_flag = sep_church
							clr_country_flag = sep_churchs
							set_variable = { sepstat = 1 }
							set_variable = { sepstatt = 2 }
							}
			}
			
		button_intergrated_free_click = { 
    					if = { limit = { has_political_power > 600 } 
							add_political_power = -600
							set_country_flag = sep_churchs
							clr_country_flag = sep_church
							set_variable = { sepstat = 2 }
							set_variable = { sepstatt = 1 }
							}
			}
			
			
			
			
			
		button_capunreg_free_click = { 
    					if = { limit = { has_political_power > 600 } 
							add_political_power = -600
							set_country_flag = interventionisteconomy
							clr_country_flag = laissez_faire
							clr_country_flag = state_capitalism
							clr_country_flag = planned_economy
							clr_country_flag = workplace_democracy
							clr_country_flag = workers_councils
							set_variable = { ecomintervene = 2 }
							set_variable = { ecomlaissez = 1 }
							set_variable = { ecomstatecontrolled = 1 }
							set_variable = { ecomplanned = 1 }
							set_variable = { ecomworkdem = 1 }
							set_variable = { ecomworkcoun = 1 }
							}
			}
			
		button_capitalistreg_free_click = { 
    					if = { limit = { has_political_power > 600 } 
							add_political_power = -600
							clr_country_flag = interventionisteconomy
							set_country_flag = laissez_faire
							clr_country_flag = state_capitalism
							clr_country_flag = planned_economy
							clr_country_flag = workplace_democracy
							clr_country_flag = workers_councils
							set_variable = { ecomintervene = 1 }
							set_variable = { ecomlaissez = 2 }
							set_variable = { ecomstatecontrolled = 1 }
							set_variable = { ecomplanned = 1 }
							set_variable = { ecomworkdem = 1 }
							set_variable = { ecomworkcoun = 1 }
							}
			}
			
		button_statecap_free_click = { 
    					if = { limit = { has_political_power > 600 } 
							add_political_power = -600
							clr_country_flag = interventionisteconomy
							clr_country_flag = laissez_faire
							set_country_flag = state_capitalism
							clr_country_flag = planned_economy
							clr_country_flag = workplace_democracy
							clr_country_flag = workers_councils
							set_variable = { ecomintervene = 1 }
							set_variable = { ecomlaissez = 1 }
							set_variable = { ecomstatecontrolled = 2 }
							set_variable = { ecomplanned = 1 }
							set_variable = { ecomworkdem = 1 }
							set_variable = { ecomworkcoun = 1 }
							}
			}
			
		button_plannedeco_free_click = { 
    					if = { limit = { has_political_power > 600 } 
							add_political_power = -600
							clr_country_flag = interventionisteconomy
							clr_country_flag = laissez_faire
							clr_country_flag = state_capitalism
							set_country_flag = planned_economy
							clr_country_flag = workplace_democracy
							clr_country_flag = workers_councils
							set_variable = { ecomintervene = 1 }
							set_variable = { ecomlaissez = 1 }
							set_variable = { ecomstatecontrolled = 1 }
							set_variable = { ecomplanned = 2 }
							set_variable = { ecomworkdem = 1 }
							set_variable = { ecomworkcoun = 1 }
							}
			}
		button_worker_free_click = { 
    					if = { limit = { has_political_power > 600 } 
							add_political_power = -600
							clr_country_flag = interventionisteconomy
							clr_country_flag = laissez_faire
							clr_country_flag = state_capitalism
							clr_country_flag = planned_economy
							set_country_flag = workplace_democracy
							clr_country_flag = workers_councils
							set_variable = { ecomintervene = 1 }
							set_variable = { ecomlaissez = 1 }
							set_variable = { ecomstatecontrolled = 1 }
							set_variable = { ecomplanned = 1 }
							set_variable = { ecomworkdem = 2 }
							set_variable = { ecomworkcoun = 1 }
							}
			}
		button_workercouncil_free_click = { 
    					if = { limit = { has_political_power > 600 } 
							add_political_power = -600
							clr_country_flag = interventionisteconomy
							clr_country_flag = laissez_faire
							clr_country_flag = state_capitalism
							clr_country_flag = planned_economy
							clr_country_flag = workplace_democracy
							set_country_flag = workers_councils
							set_variable = { ecomintervene = 1 }
							set_variable = { ecomlaissez = 1 }
							set_variable = { ecomstatecontrolled = 1 }
							set_variable = { ecomplanned = 1 }
							set_variable = { ecomworkdem = 1 }
							set_variable = { ecomworkcoun = 2 }
							}
			}
		
		}
    

    properties = {
		
			button_enb_elec = {
						
						frame = elecstat
								
            }
			button_dsb_elec = {
						
						frame = elecstatt
								
            }
			
			button_enb_parl = {
						
						frame = parlstat
								
            }
			button_dsb_parl = {
						
						frame = parlstatt
								
            }
			
			button_enb_free = {
						
						frame = freestat
								
            }
			button_dsb_free = {
						
						frame = freestatt
								
            }
		
			button_federal = {
						
						frame = fedstat
								
            }
			button_unitarian = {
						
						frame = fedstatt
								
            }
			
			button_gunsr_free = {
						
						frame = gunstat
								
            }
			button_guns_free = {
						
						frame = gunstatt
								
            }
			
			button_seperated_free = {
						
						frame = sepstat
								
            }
			button_intergrated_free = {
						
						frame = sepstatt
								
            }
			
			
			button_capunreg_free = {
						
						frame = ecomintervene
								
            }
			button_capitalistreg_free = {
						
						frame = ecomlaissez
								
            }
			button_statecap_free = {
						
						frame = ecomstatecontrolled
								
            }
			button_plannedeco_free = {
						
						frame = ecomplanned
								
            }
			button_worker_free = {
						
						frame = ecomworkdem
								
            }
			button_workercouncil_free = {
						
						frame = ecomworkcoun
								
            }
			
			large_flag = {
						
						 image = [Root.GetFlag]
						
								
            }
				
		
	}

    ai_enabled = {
		always = no
    }


  }
}
