<!-- normal header container used on all screens except the match screen -->
<panel>

  <!-- hide this container when on the match screen -->
  <attachment class="test_global_attachment" get_property="scid" value="22" set_property="hidn" skip_if_null="false" skip_if_resetting="false"/>

  <layout class="fit_children_attachment" alignment="vertical" offset="0"/>
  <layout class="stick_to_sides_attachment" alignment="horizontal" inset="0" layout_children="true"/>

  <!-- titlebar background image -->
  <widget class="picture" id="pict" file="interface/titlebar/background/bar" auto_size="vertical" cached="true">

    <layout class="stick_to_sides_attachment" alignment="bottom" inset="0"/>

  </widget>

  <!-- titlebar image -->
  <widget class="picture" id="pict" file="interface/titlebar/bar" auto_size="vertical" cached="true" rthr="68">

    <layout class="stick_to_sides_attachment" alignment="bottom" inset="0"/>

    <!-- set the colour of the image to the team background colour -->
    <attachment class="get_global_attachment" get_property="bkcl" set_property="colr"/>

  </widget>

  <!-- container to handle the layout of the 'background' logos -->
  <container height="100">
    <layout class="stick_to_sides_attachment" alignment="top" inset="0"/>
    <layout class="fit_children_attachment" alignment="vertical" offset="0"/>

    <!-- Right Side Logo -->
    <widget class="picture" id="rgtB" auto_size="all" file="pictures/logos/background/default/left">
      <layout class="stick_to_sides_attachment" alignment="top,right" inset="0"/>

      <!-- set main 'background' logo -->
      <attachment class="get_global_attachment" get_property="sbpc" set_property="file" skip_if_null="false"/>

      <!-- tells the picture to listen for the 'main picture needs recolouring' property and sets its own 'should recolour' property from it -->
      <attachment class="get_global_attachment" get_property="sbrc" set_property="srec" skip_if_null="false"/>

      <!-- the background, foreground and outline colours of the object we use for recolouring the default main picture if there is one, and it should be recoloured -->
      <attachment class="get_global_attachment" get_property="bkcl" set_property="rrep"/>
      <attachment class="get_global_attachment" get_property="fcol" set_property="grep"/>
      <attachment class="get_global_attachment" get_property="ocol" set_property="brep"/>

    </widget>

    <!-- Left Side Logo -->
    <widget class="picture" id="lftB" auto_size="all">

      <layout class="stick_to_sides_attachment" alignment="top,left" inset="0"/>

      <!-- set main 'background' logo -->
      <attachment class="get_global_attachment" get_property="mbpc" set_property="file" skip_if_null="false"/>

      <!-- tells the picture to listen for the 'main picture needs recolouring' property and sets its own 'should recolour' property from it -->
      <attachment class="get_global_attachment" get_property="mbrc" set_property="srec" skip_if_null="false"/>

      <!-- the background, foreground and outline colours of the object we use for recolouring the default main picture if there is one, and it should be recoloured -->
      <attachment class="get_global_attachment" get_property="bkcl" set_property="rrep"/>
      <attachment class="get_global_attachment" get_property="fcol" set_property="grep"/>
      <attachment class="get_global_attachment" get_property="ocol" set_property="brep"/>

    </widget>

  </container>
  <!-- background logos container -->

  <!-- main logos container -->
  <container height="100">
    <layout class="arrange_horizontal_attachment" layout="170,-1,170" alignment="centre" offset="0" gap="0" />
    <layout class="stick_to_sides_attachment" alignment="all" inset="0" offset="0"/>

    <!-- left sided main logo -->
    <container height="100">
      <layout class="fit_children_attachment" alignment="vertical,extend" offset="0" />
      <layout class="stick_to_sides_attachment" alignment="vertical" inset="0" />
      <layout class="centre_in_parent_attachment" alignment="horizontal" offset="0" layout_children="true"/>

      <!-- Primary Logo -->
      <widget class="picture" id="rgtF" scale_picture="true" keep_aspect_ratio="true" height="90" width="90" image_alignment="centre" >
        <layout class="centre_in_parent_attachment" alignment="vertical" offset="-2"/>

        <!-- tells the picture to listen to the 'main picture' global property being set, and set its own file property from it -->
        <attachment class="get_global_attachment" get_property="mnpc" set_property="file" skip_if_null="false"/>

        <!-- tells the picture to listen for the 'main picture needs recolouring' property and sets its own 'should recolour' property from it -->
        <attachment class="get_global_attachment" get_property="mprc" set_property="srec" skip_if_null="false"/>

        <!-- the background, foreground and outline colours of the object we use for recolouring the default main picture if there is one, and it should be recoloured -->
        <attachment class="get_global_attachment" get_property="bkcl" set_property="rrep"/>
        <attachment class="get_global_attachment" get_property="fcol" set_property="grep"/>
        <attachment class="get_global_attachment" get_property="ocol" set_property="brep"/>
      </widget>

    </container>

    <!-- dummy container -->
    <container>
    </container>

    <!-- right sided main logo -->
    <container height="100">
      <layout class="fit_children_attachment" alignment="vertical,extend" offset="0" />
      <layout class="stick_to_sides_attachment" alignment="vertical" inset="0" />
      <layout class="centre_in_parent_attachment" alignment="horizontal" offset="0" layout_children="true"/>

      <!-- Primary Logo -->
      <widget class="picture" id="lftF" scale_picture="true" keep_aspect_ratio="true" height="90" width="90" image_alignment="centre">
        <layout class="centre_in_parent_attachment" alignment="vertical" offset="-2"/>

        <attachment class="get_global_attachment" get_property="scpc" set_property="file" skip_if_null="false"/>

        <!-- tells the picture to listen for the 'main picture needs recolouring' property and sets its own 'should recolour' property from it -->
        <attachment class="get_global_attachment" get_property="sprc" set_property="srec" skip_if_null="false"/>

        <!-- the background, foreground and outline colours of the object we use for recolouring the default main picture if there is one, and it should be recoloured -->
        <attachment class="get_global_attachment" get_property="bkcl" set_property="rrep"/>
        <attachment class="get_global_attachment" get_property="fcol" set_property="grep"/>
        <attachment class="get_global_attachment" get_property="ocol" set_property="brep"/>
      </widget>

    </container>

  </container>
  <!-- main logos container -->

  <!-- titlebar effect overlay -->
  <widget class="picture" id="pict" file="interface/titlebar/overlay/bar" auto_size="vertical" cached="true">
    <layout class="stick_to_sides_attachment" alignment="bottom" inset="0"/>
  </widget>

  <!-- titlebar outline -->
  <widget class="picture" id="pict" file="interface/titlebar/outline/bar" auto_size="vertical" cached="true" rthr="68">
    <layout class="stick_to_sides_attachment" alignment="bottom" inset="0"/>
    <attachment class="get_global_attachment" get_property="fcol" set_property="colr"/>
  </widget>

  <!-- Quick Flicks -->
  <container id="flik">
    <layout class="arrange_horizontal_attachment" layout="-1,-1" gap="0" inset="0"/>
    <layout class="stick_to_sides_attachment" alignment="vertical" layout_children="true" inset="-2"/>
    <layout class="stick_to_sides_attachment" alignment="vertical" inset="0"/>

    <container>
      <widget class="quick_flick_button" id="flkl" auto_size="all" appearance="button/custom/quickflicks/left/button" cached="true" step="-1">
        <layout class="stick_to_sides_attachment" alignment="top, right" inset="0"/>
      </widget>
    </container>

    <container>
      <widget class="quick_flick_button" id="flkr" auto_size="all" appearance="button/custom/quickflicks/right/button" cached="true" step="1">
        <layout class="stick_to_sides_attachment" alignment="top, left" inset="0"/>
      </widget>

    </container>

  </container>

  <!-- manager and club names -->
  <container id="text">
    <layout class="stick_to_sides_attachment" alignment="vertical" layout_children="true" inset="2"/>
    <layout class="stick_to_sides_attachment" alignment="vertical" inset="0"/>

    <container width="170">
      <layout class="arrange_vertical_attachment" alignment="bottom" offset="0" gap="-1"/>
      <layout class="stick_to_sides_attachment" alignment="horizontal" inset="2" layout_children="true"/>
      <layout class="stick_to_sides_attachment" alignment="left" inset="4"/>

      <widget class="text" id="pers" text="" standard_spec="text,small" colour="white" style="bold" alignment="left" auto_size="vertical" multiline="false">
        <attachment class="get_global_attachment" get_property="user" set_property="text"/>
      </widget>

      <widget class="text" id="team" text="" standard_spec="text,small" colour="white" style="bold" alignment="left" auto_size="vertical" multiline="false">
        <attachment class="get_global_attachment" get_property="Tnam" set_property="text"/>
      </widget>


    </container>

    <!-- main text -->
    <container id="tita">
      <layout class="arrange_vertical_attachment" alignment="top" offset="6" gap="0"/>
      <layout class="stick_to_sides_attachment" alignment="horizontal" layout_children="true"/>
      <layout class="stick_to_sides_attachment" alignment="horizontal" inset="0"/>

      <!-- title area -->
      <widget class="text" id="sect" alignment="centre_x,top" size="20" style="shadowed" font="fonts/verabd" multiline="false" auto_size="vertical">
        <attachment class="get_global_attachment" get_property="titl" set_property="text"/>

        <attachment class="get_global_attachment" get_property="ttcl" set_property="colr"/>
      </widget>

      <!-- subtitle area -->
      <container height="22">
        <layout class="stick_to_sides_attachment" alignment="vertical" inset="0" layout_children="true"/>
        <layout class="centre_in_parent_attachment" alignment="horizontal" layout_children="true"/>

        <!-- hide when no subtitle -->
        <attachment class="test_global_attachment" get_property="subt" skip_if_null="false" set_property="hidn"/>

        <container>
          <layout class="arrange_horizontal_attachment" alignment="left" offset="0" gap="8"/>
          <layout class="fit_children_attachment" alignment="horizontal,fill" offset="0" gap="8"/>
          <layout class="stick_to_sides_attachment" alignment="vertical" inset="0" layout_children="true"/>

          <!-- flag -->
          <widget class="nation_button" id="stfl" auto_size="horizontal" icon_alignment="right,can_scale" dspf="4">
            <attachment class="test_global_attachment" get_property="stfl" skip_if_null="false" set_property="hidn"/>
            <attachment class="get_global_attachment" get_property="stfl" set_property="valu"/>
          </widget>

          <!-- description -->
          <widget class="text" id="subs" size="12" style="shadowed" alignment="centre" mlti="false" auto_size="all">

            <attachment class="get_global_attachment" get_property="subt" set_property="text"/>
            <attachment class="get_global_attachment" get_property="ttcl" set_property="colr"/>

          </widget>
        </container>
      </container>
    </container>

    <!-- Searchbox -->
    <container width="170">

      <layout class="arrange_vertical_attachment" alignment="bottom" offset="0" gap="0"/>
      <layout class="stick_to_sides_attachment" alignment="horizontal" inset="2" layout_children="true"/>
      <layout class="stick_to_sides_attachment" alignment="right" inset="2"/>

      <widget id="find" class="edit_box" appearance="interface/searchbox/box" spec="text,small" colour="black">

        <layout class="stick_to_sides_attachment" alignment="horizontal" inset="4"/>
        <layout class="stick_to_sides_attachment" alignment="bottom" inset="2"/>
        <attachment kind="max_length_attachment" length="150" />

        <!-- sent the return/enter key event to the screen: it causes a quick search to be performed -->
        <event id="return_event">
          <flags id="event_id" value="DBSR"/>
          <flags id="event_target" value="scrn"/>
        </event>

		<!-- sent the edit event to the screen: will store the search text to set in the next screen (could be the match title bar) -->
        <event id="edit_event">
          <flags id="event_id" value="DBSC"/>
          <flags id="event_target" value="scrn"/>
        </event>

        <!-- send the text changed event to the clear button: if the text is empty, the clear button is disabled or removed -->
        <event id="changed_event">
          <flags id="event_id" value="chtx" />
          <flags id="event_target" value="finb" />
        </event>

        <!-- check the global property that specifies if the game is set up or loaded (ie if we can do a quick search) -->
        <attachment class="test_global_attachment" get_property="gset" value="false" set_property="disa"/>
        <attachment class="get_global_attachment" get_property="qset" set_property="text"/>
      </widget>

      <!-- Button to clear the contents of the searchbox -->
      <widget class="action_button" id="finb" auto_size="all" appearance="interface/searchbox/clear/button" hidden="true">

        <layout class="stick_to_sides_attachment" alignment="right" inset="4"/>
        <layout class="stick_to_sides_attachment" alignment="bottom" inset="3"/>

        <!-- click event sends the deletion/clear event to the find edit box -->
        <event id="click_event">
          <flags id="event_id" value="DELE"/>
          <flags id="event_target" value="find"/>
        </event>

        <!-- check for the 'gset' property, which indicates if the game is loaded or set up -->
        <attachment class="test_global_attachment" get_property="gset" value="false" set_property="disa"/>

        <!-- check for the change text (chtx) event that edit box will send us when: we check the 'text is empty' property of the event and set the disabled property to the value of 'chtx' -->
        <attachment class="test_event_attachment" event_id="chtx" get_property="txie" set_property="hidn" mode="1" />
      </widget>

    </container>

  </container>




</panel>