imbox

[edit]
<table class="plainlinks imbox 
((#switch:(({type|))}
| speedy     = imbox-speedy
| delete     = imbox-delete
| content    = imbox-content
| style      = imbox-style
| move       = imbox-move
| protection = imbox-protection
| license    = imbox-license
| featured   = imbox-featured
| notice          <!-- notice = default -->
| #default   = imbox-notice
))" style="(({style|))}">
<tr>
((#ifeq:(({image|))}|none
| <!-- No image. Cell with some width or padding necessary for text cell to have 100% width. --><td class="mbox-empty-cell" style="border: none; padding: 0px; width: 1px;"></td>
| <td class="mbox-image">
  ((#if:(({image|))}
  | (({image))}
  | ((#switch:(({type|))}
    | speedy     = [[Image:Imbox speedy deletion.png|40x40px]] 
    | delete     = [[Image:Imbox deletion.png|40x40px]] 
    | content    = [[Image:Imbox content.png|40x40px]]
    | style      = [[Image:Imbox style.png|40x40px]]
    | move       = [[Image:Imbox move.png|40x40px]]
    | protection = [[Image:Imbox protection.png|40x40px]]
    | license    = [[Image:Imbox license.png|40x40px]]
    | featured   = [[Image:Imbox featured.png|40x40px]]
    | notice          <!-- notice = default -->
    | #default   = [[Image:Imbox notice.png|40x40px]]
    ))
  ))</td>
))
<td class="mbox-text" style="(({textstyle|))}"> (({text))} </td>
((#if:(({imageright|))}
| <td class="mbox-imageright"> (({imageright))} </td>
))
</tr>
((#if:(({below|))}
| <tr><td colspan=((#if:(({imageright|))}|3|2)) class="mbox-text" style="(({textstyle|))}"> (({below))} </td></tr>
))
</table><!-- Detect and report usage with faulty "type" parameter:
-->((#switch:(({type|))}
|   <!-- No type fed, is also valid input -->
| speedy
| delete
| content
| style
| move
| protection
| license
| featured
| notice     =    <!-- Do nothing, valid "type" -->
| #default   = <div style="text-align: center;">This message box is using an invalid "type=(({type|))}" parameter and needs fixing.</div>[[Category:Wikipedia message box parameter needs fixing|((main other|Main:))((FULLPAGENAME))]]<!-- Sort on namespace -->
))<!--

--><includeonly>((#ifeq:((BASEPAGENAME))|((SUBPAGENAME))|((#ifeq:((NAMESPACE))|Template|[[Category:File message boxes|((PAGENAME))]]))))</includeonly>

types = { 'speedy'     : [ 'speedy',     Imbox speedy deletion.png ],
          'delete'     : [ 'delete',     Imbox deletion.png ],
          'content'    : [ 'content',    Imbox content.png ],
          'style'      : [ 'style',      Imbox style.png ],
          'move'       : [ 'move',       Imbox move.png ],
          'protection' : [ 'protection', Imbox protection.png ],
          'license'    : [ 'license',    Imbox license.png ],
          'featured'   : [ 'featured',   Imbox featured.png ],
          'notice'     : [ 'notice',     Imbox notice.png ],     # 'notice' is the default
        }

def main():
    params = getAllParams()      # This returns a dictionary of all parameters passed to the template
    if getParam( 'small', '' ):  # This gets a single parameter value, or a defined default
        params['small'] = 'mbox-small'
    t = getParam( 'type', 'notice' )
    if t in types:
        params['type'] = t
    else:
        params['type'] = 'notice'

    print "<table class='plainlinks imbox imbox-%(type)s %(small)s' style='%(style)s'><tr>" % params

    if params['image'] == 'none':
        # No image. Cell with some width or padding necessary for text cell to have 100% width.
        print "<td class='mbox-empty-cell' style='border: none; padding: 0px; width: 1px;'></td>"
    else:
        print '<td class="mbox-image">'
        if params['image']:
            print params['image']
        else:
            print "[[File:%s|40x40px]]" % types[params['type']][1]
        print '</td>'
    
    print "<td class='mbox-text' style='%(textstyle)s'> %(text)s </td>" % params

    if params['imageright']:
        print "<td class='mbox-imageright'> %(imageright)s </td>" % params

    print '</tr>'

    if params['below']:
        if params['imageright']:
            params['cols'] = 3
        else:
            params['cols'] = 2
        print "<tr><td colspan=%(cols)d class='mbox-text' style='%(textstyle)s'> %(below)s </td></tr>" % params

    print '</table>'

    # Detect and report usage with faulty "type" parameter
    if getParam( 'type', 'notice' ) not in types and getParam( 'type' ):
        print """
<div style="text-align: center;">
This message box is using an invalid "type=%s" parameter and needs fixing.
</div>[[Category:Wikipedia message box parameter needs fixing|((main other|Main:))((FULLPAGENAME))]]
""" % getParam( 'type' )

    # Magic words are implemented as constants?
    if BASEPAGENAME == SUBPAGENAME and NAMEPACE == 'Template':
        print "<includeonly>[[Category:File message boxes|%s]]</includeonly>" % PAGENAME
[edit]
<!--

Please do not edit without discussion first as this is a VERY complex template.

-->((#switch:(({border|(({1|))))))|subgroup|child=</div>|none=|#default=<table class="navbox" cellspacing="0" <!--
 -->style="(({bodystyle|))};(({style|))}"><tr><td style="padding:2px;">))<!--

--><table cellspacing="0" class="nowraplinks ((#if:(({title|))}|((#switch:(({state|))}|plain|off=|<!--
 -->#default=collapsible ((#if:(({state|))}|(({state))}|autocollapse)))))) ((#switch:(({border|(({1|))))))|<!--
 -->subgroup|child|none=navbox-subgroup" style="width:100%;(({bodystyle|))};(({style|))}|<!--
 -->#default=" style="width:100%;background:transparent;color:inherit));(({innerstyle|))};"><!--



---Title and Navbar---
-->((#if:(({title|))}|<tr>((#if:(({titlegroup|))}|<!--
 --><td class="navbox-group" style="(({basestyle|))};(({groupstyle|))};(({titlegroupstyle|))}">(({titlegroup|))}</td><!--
 --><th style="border-left:2px solid #fdfdfd;width:100%;|<th style="))(({basestyle|))};(({titlestyle|))}" <!--
 -->colspan=((#expr:2((#if:(({imageleft|))}|+1))((#if:(({image|))}|+1))((#if:(({titlegroup|))}|-1)))) <!--
 -->class="navbox-title"><!--

-->((#if:((#switch:(({navbar|))}|plain|off=1))<!--
 -->((#if:(({name|))}||((#switch:(({border|(({1|))))))|subgroup|child|none=1))))|<!--
 -->((#ifeq:(({navbar|))}|off|((#ifeq:(({state|))}|plain|<div style="float:right;width:6em;"> </div>))|<!--
 -->((#ifeq:(({state|))}|plain||<div style="float:left; width:6em;text-align:left;"> </div>))))|<!--
 --><div style="float:left; width:6em;text-align:left;"><!--
 -->((Navbar|(({name))}|fontstyle=(({basestyle|))};(({titlestyle|))};border:none;|mini=1))<!--
 --></div>((#ifeq:(({state|))}|plain|<div style="float:right;width:6em;"> </div>))))<!--

 --><span style="font-size:((#switch:(({border|(({1|))))))|subgroup|child|none=100|#default=110))%;"><!--
 -->(({title))}</span></th></tr>))<!--



---Above---
-->((#if:(({above|))}|<!--
 -->((#if:(({title|))}|<tr style="height:2px;"><td></td></tr>))<!--
 --><tr><td class="navbox-abovebelow" style="(({basestyle|))};(({abovestyle|))}" <!--
 -->colspan="((#expr:2((#if:(({imageleft|))}|+1))((#if:(({image|))}|+1))))">(({above))}</td></tr>))<!--



---Body---

---First group/list and images---
-->((#if:(({list1|))}|((#if:(({title|))}(({above|))}|<tr style="height:2px;"><td></td></tr>))<tr><!--

-->((#if:(({imageleft|))}|<!--
 --><td style="width:0%;padding:0px 2px 0px 0px;(({imageleftstyle|))}" <!--
 -->rowspan=((#expr:1((#if:(({list2|))}|+2))((#if:(({list3|))}|+2))((#if:(({list4|))}|+2))<!--
 -->((#if:(({list5|))}|+2))((#if:(({list6|))}|+2))((#if:(({list7|))}|+2))((#if:(({list8|))}|+2))<!--
 -->((#if:(({list9|))}|+2))((#if:(({list10|))}|+2))((#if:(({list11|))}|+2))((#if:(({list12|))}|+2))<!--
 -->((#if:(({list13|))}|+2))((#if:(({list14|))}|+2))((#if:(({list15|))}|+2))((#if:(({list16|))}|+2))<!--
 -->((#if:(({list17|))}|+2))((#if:(({list18|))}|+2))((#if:(({list19|))}|+2))((#if:(({list20|))}|+2))))><!--
 -->(({imageleft))}</td>))<!--

 -->((#if:(({group1|))}|<td class="navbox-group" style="(({basestyle|))};(({groupstyle|))};(({group1style|))}"><!--
 -->(({group1))}</td><td style="text-align:left;border-left-width:2px;border-left-style:solid;|<td colspan=2 style="))<!--
 -->width:100%;padding:0px;(({liststyle|))};(({oddstyle|))};(({list1style|))}" <!--
 -->class="navbox-list navbox-((#ifeq:(({evenodd|))}|swap|even|(({evenodd|odd))))}"><!--
 --><div style="padding:(({list1padding|(({listpadding|0em 0.25em))))))">(({list1))}</div></td><!--

-->((#if:(({image|))}|<!--
 --><td style="width:0%;padding:0px 0px 0px 2px;(({imagestyle|))}" <!--
 -->rowspan=((#expr:1((#if:(({list2|))}|+2))((#if:(({list3|))}|+2))((#if:(({list4|))}|+2))<!--
 -->((#if:(({list5|))}|+2))((#if:(({list6|))}|+2))((#if:(({list7|))}|+2))((#if:(({list8|))}|+2))<!--
 -->((#if:(({list9|))}|+2))((#if:(({list10|))}|+2))((#if:(({list11|))}|+2))((#if:(({list12|))}|+2))<!--
 -->((#if:(({list13|))}|+2))((#if:(({list14|))}|+2))((#if:(({list15|))}|+2))((#if:(({list16|))}|+2))<!--
 -->((#if:(({list17|))}|+2))((#if:(({list18|))}|+2))((#if:(({list19|))}|+2))((#if:(({list20|))}|+2))))><!--
 -->(({image))}</td>))<!--

--></tr>))<!--



---Remaining groups/lists---

-->((#if:(({list2|))}|<!--
 -->((#if:(({title|))}(({above|))}(({list1|))}|<tr style="height:2px"><td></td></tr>))<tr><!--
 -->((#if:(({group2|))}|<td class="navbox-group" style="(({basestyle|))};(({groupstyle|))};(({group2style|))}"><!--
 -->(({group2))}</td><td style="text-align:left;border-left-width:2px;border-left-style:solid;|<td colspan=2 style="))<!--
 -->width:100%;padding:0px;(({liststyle|))};(({evenstyle|))};(({list2style|))}" <!--
 -->class="navbox-list navbox-((#ifeq:(({evenodd|))}|swap|odd|(({evenodd|even))))}"><!--
 --><div style="padding:(({listpadding|0em 0.25em))}">(({list2))}</div></td></tr>))<!--

-->((#if:(({list3|))}|<!--
 -->((#if:(({title|))}(({above|))}(({list1|))}(({list2|))}|<tr style="height:2px"><td></td></tr>))<tr><!--
 -->((#if:(({group3|))}|<td class="navbox-group" style="(({basestyle|))};(({groupstyle|))};(({group3style|))}"><!--
 -->(({group3))}</td><td style="text-align:left;border-left-width:2px;border-left-style:solid;|<td colspan=2 style="))<!--
 -->width:100%;padding:0px;(({liststyle|))};(({oddstyle|))};(({list3style|))}" <!--
 -->class="navbox-list navbox-((#ifeq:(({evenodd|))}|swap|even|(({evenodd|odd))))}"><!--
 --><div style="padding:(({listpadding|0em 0.25em))}">(({list3))}</div></td></tr>))<!--

-->((#if:(({list4|))}|<!--
 --><tr style="height:2px"><td></td></tr><tr><!--
 -->((#if:(({group4|))}|<td class="navbox-group" style="(({basestyle|))};(({groupstyle|))};(({group4style|))}"><!--
 -->(({group4))}</td><td style="text-align:left;border-left-width:2px;border-left-style:solid;|<td colspan=2 style="))<!--
 -->width:100%;padding:0px;(({liststyle|))};(({evenstyle|))};(({list4style|))}" <!--
 -->class="navbox-list navbox-((#ifeq:(({evenodd|))}|swap|odd|(({evenodd|even))))}"><!--
 --><div style="padding:(({listpadding|0em 0.25em))}">(({list4))}</div></td></tr>))<!--

-->((#if:(({list5|))}|<!--
 --><tr style="height:2px"><td></td></tr><tr><!--
 -->((#if:(({group5|))}|<td class="navbox-group" style="(({basestyle|))};(({groupstyle|))};(({group5style|))}"><!--
 -->(({group5))}</td><td style="text-align:left;border-left-width:2px;border-left-style:solid;|<td colspan=2 style="))<!--
 -->width:100%;padding:0px;(({liststyle|))};(({oddstyle|))};(({list5style|))}" <!--
 -->class="navbox-list navbox-((#ifeq:(({evenodd|))}|swap|even|(({evenodd|odd))))}"><!--
 --><div style="padding:(({listpadding|0em 0.25em))}">(({list5))}</div></td></tr>))<!--

-->((#if:(({list6|))}|<!--
 --><tr style="height:2px"><td></td></tr><tr><!--
 -->((#if:(({group6|))}|<td class="navbox-group" style="(({basestyle|))};(({groupstyle|))};(({group6style|))}"><!--
 -->(({group6))}</td><td style="text-align:left;border-left-width:2px;border-left-style:solid;|<td colspan=2 style="))<!--
 -->width:100%;padding:0px;(({liststyle|))};(({evenstyle|))};(({list6style|))}" <!--
 -->class="navbox-list navbox-((#ifeq:(({evenodd|))}|swap|odd|(({evenodd|even))))}"><!--
 --><div style="padding:(({listpadding|0em 0.25em))}">(({list6))}</div></td></tr>))<!--

-->((#if:(({list7|))}|<!--
 --><tr style="height:2px"><td></td></tr><tr><!--
 -->((#if:(({group7|))}|<td class="navbox-group" style="(({basestyle|))};(({groupstyle|))};(({group7style|))}"><!--
 -->(({group7))}</td><td style="text-align:left;border-left-width:2px;border-left-style:solid;|<td colspan=2 style="))<!--
 -->width:100%;padding:0px;(({liststyle|))};(({oddstyle|))};(({list7style|))}" <!--
 -->class="navbox-list navbox-((#ifeq:(({evenodd|))}|swap|even|(({evenodd|odd))))}"><!--
 --><div style="padding:(({listpadding|0em 0.25em))}">(({list7))}</div></td></tr>))<!--

-->((#if:(({list8|))}|<!--
 --><tr style="height:2px"><td></td></tr><tr><!--
 -->((#if:(({group8|))}|<td class="navbox-group" style="(({basestyle|))};(({groupstyle|))};(({group8style|))}"><!--
 -->(({group8))}</td><td style="text-align:left;border-left-width:2px;border-left-style:solid;|<td colspan=2 style="))<!--
 -->width:100%;padding:0px;(({liststyle|))};(({evenstyle|))};(({list8style|))}" <!--
 -->class="navbox-list navbox-((#ifeq:(({evenodd|))}|swap|odd|(({evenodd|even))))}"><!--
 --><div style="padding:(({listpadding|0em 0.25em))}">(({list8))}</div></td></tr>))<!--

-->((#if:(({list9|))}|<!--
 --><tr style="height:2px"><td></td></tr><tr><!--
 -->((#if:(({group9|))}|<td class="navbox-group" style="(({basestyle|))};(({groupstyle|))};(({group9style|))}"><!--
 -->(({group9))}</td><td style="text-align:left;border-left-width:2px;border-left-style:solid;|<td colspan=2 style="))<!--
 -->width:100%;padding:0px;(({liststyle|))};(({oddstyle|))};(({list9style|))}" <!--
 -->class="navbox-list navbox-((#ifeq:(({evenodd|))}|swap|even|(({evenodd|odd))))}"><!--
 --><div style="padding:(({listpadding|0em 0.25em))}">(({list9))}</div></td></tr>))<!--

-->((#if:(({list10|))}|<!--
 --><tr style="height:2px"><td></td></tr><tr><!--
 -->((#if:(({group10|))}|<td class="navbox-group" style="(({basestyle|))};(({groupstyle|))};(({group10style|))}"><!--
 -->(({group10))}</td><td style="text-align:left;border-left-width:2px;border-left-style:solid;|<td colspan=2 style="))<!--
 -->width:100%;padding:0px;(({liststyle|))};(({evenstyle|))};(({list10style|))}" <!--
 -->class="navbox-list navbox-((#ifeq:(({evenodd|))}|swap|odd|(({evenodd|even))))}"><!--
 --><div style="padding:(({listpadding|0em 0.25em))}">(({list10))}</div></td></tr>))<!--

-->((#if:(({list11|))}|<!--
 --><tr style="height:2px"><td></td></tr><tr><!--
 -->((#if:(({group11|))}|<td class="navbox-group" style="(({basestyle|))};(({groupstyle|))};(({group11style|))}"><!--
 -->(({group11))}</td><td style="text-align:left;border-left-width:2px;border-left-style:solid;|<td colspan=2 style="))<!--
 -->width:100%;padding:0px;(({liststyle|))};(({oddstyle|))};(({list11style|))}" <!--
 -->class="navbox-list navbox-((#ifeq:(({evenodd|))}|swap|even|(({evenodd|odd))))}"><!--
 --><div style="padding:(({listpadding|0em 0.25em))}">(({list11))}</div></td></tr>))<!--

-->((#if:(({list12|))}|<!--
 --><tr style="height:2px"><td></td></tr><tr><!--
 -->((#if:(({group12|))}|<td class="navbox-group" style="(({basestyle|))};(({groupstyle|))};(({group12style|))}"><!--
 -->(({group12))}</td><td style="text-align:left;border-left-width:2px;border-left-style:solid;|<td colspan=2 style="))<!--
 -->width:100%;padding:0px;(({liststyle|))};(({evenstyle|))};(({list12style|))}" <!--
 -->class="navbox-list navbox-((#ifeq:(({evenodd|))}|swap|odd|(({evenodd|even))))}"><!--
 --><div style="padding:(({listpadding|0em 0.25em))}">(({list12))}</div></td></tr>))<!--

-->((#if:(({list13|))}|<!--
 --><tr style="height:2px"><td></td></tr><tr><!--
 -->((#if:(({group13|))}|<td class="navbox-group" style="(({basestyle|))};(({groupstyle|))};(({group13style|))}"><!--
 -->(({group13))}</td><td style="text-align:left;border-left-width:2px;border-left-style:solid;|<td colspan=2 style="))<!--
 -->width:100%;padding:0px;(({liststyle|))};(({oddstyle|))};(({list13style|))}" <!--
 -->class="navbox-list navbox-((#ifeq:(({evenodd|))}|swap|even|(({evenodd|odd))))}"><!--
 --><div style="padding:(({listpadding|0em 0.25em))}">(({list13))}</div></td></tr>))<!--

-->((#if:(({list14|))}|<!--
 --><tr style="height:2px"><td></td></tr><tr><!--
 -->((#if:(({group14|))}|<td class="navbox-group" style="(({basestyle|))};(({groupstyle|))};(({group14style|))}"><!--
 -->(({group14))}</td><td style="text-align:left;border-left-width:2px;border-left-style:solid;|<td colspan=2 style="))<!--
 -->width:100%;padding:0px;(({liststyle|))};(({evenstyle|))};(({list14style|))}" <!--
 -->class="navbox-list navbox-((#ifeq:(({evenodd|))}|swap|odd|(({evenodd|even))))}"><!--
 --><div style="padding:(({listpadding|0em 0.25em))}">(({list14))}</div></td></tr>))<!--

-->((#if:(({list15|))}|<!--
 --><tr style="height:2px"><td></td></tr><tr><!--
 -->((#if:(({group15|))}|<td class="navbox-group" style="(({basestyle|))};(({groupstyle|))};(({group15style|))}"><!--
 -->(({group15))}</td><td style="text-align:left;border-left-width:2px;border-left-style:solid;|<td colspan=2 style="))<!--
 -->width:100%;padding:0px;(({liststyle|))};(({oddstyle|))};(({list15style|))}" <!--
 -->class="navbox-list navbox-((#ifeq:(({evenodd|))}|swap|even|(({evenodd|odd))))}"><!--
 --><div style="padding:(({listpadding|0em 0.25em))}">(({list15))}</div></td></tr>))<!--

-->((#if:(({list16|))}|<!--
 --><tr style="height:2px"><td></td></tr><tr><!--
 -->((#if:(({group16|))}|<td class="navbox-group" style="(({basestyle|))};(({groupstyle|))};(({group16style|))}"><!--
 -->(({group16))}</td><td style="text-align:left;border-left-width:2px;border-left-style:solid;|<td colspan=2 style="))<!--
 -->width:100%;padding:0px;(({liststyle|))};(({evenstyle|))};(({list16style|))}" <!--
 -->class="navbox-list navbox-((#ifeq:(({evenodd|))}|swap|odd|(({evenodd|even))))}"><!--
 --><div style="padding:(({listpadding|0em 0.25em))}">(({list16))}</div></td></tr>))<!--

-->((#if:(({list17|))}|<!--
 --><tr style="height:2px"><td></td></tr><tr><!--
 -->((#if:(({group17|))}|<td class="navbox-group" style="(({basestyle|))};(({groupstyle|))};(({group17style|))}"><!--
 -->(({group17))}</td><td style="text-align:left;border-left-width:2px;border-left-style:solid;|<td colspan=2 style="))<!--
 -->width:100%;padding:0px;(({liststyle|))};(({oddstyle|))};(({list17style|))}" <!--
 -->class="navbox-list navbox-((#ifeq:(({evenodd|))}|swap|even|(({evenodd|odd))))}"><!--
 --><div style="padding:(({listpadding|0em 0.25em))}">(({list17))}</div></td></tr>))<!--

-->((#if:(({list18|))}|<!--
 --><tr style="height:2px"><td></td></tr><tr><!--
 -->((#if:(({group18|))}|<td class="navbox-group" style="(({basestyle|))};(({groupstyle|))};(({group18style|))}"><!--
 -->(({group18))}</td><td style="text-align:left;border-left-width:2px;border-left-style:solid;|<td colspan=2 style="))<!--
 -->width:100%;padding:0px;(({liststyle|))};(({evenstyle|))};(({list18style|))}" <!--
 -->class="navbox-list navbox-((#ifeq:(({evenodd|))}|swap|odd|(({evenodd|even))))}"><!--
 --><div style="padding:(({listpadding|0em 0.25em))}">(({list18))}</div></td></tr>))<!--

-->((#if:(({list19|))}|<!--
 --><tr style="height:2px"><td></td></tr><tr><!--
 -->((#if:(({group19|))}|<td class="navbox-group" style="(({basestyle|))};(({groupstyle|))};(({group19style|))}"><!--
 -->(({group19))}</td><td style="text-align:left;border-left-width:2px;border-left-style:solid;|<td colspan=2 style="))<!--
 -->width:100%;padding:0px;(({liststyle|))};(({oddstyle|))};(({list19style|))}" <!--
 -->class="navbox-list navbox-((#ifeq:(({evenodd|))}|swap|even|(({evenodd|odd))))}"><!--
 --><div style="padding:(({listpadding|0em 0.25em))}">(({list19))}</div></td></tr>))<!--

-->((#if:(({list20|))}|<!--
 --><tr style="height:2px"><td></td></tr><tr><!--
 -->((#if:(({group20|))}|<td class="navbox-group" style="(({basestyle|))};(({groupstyle|))};(({group20style|))}"><!--
 -->(({group20))}</td><td style="text-align:left;border-left-width:2px;border-left-style:solid;|<td colspan=2 style="))<!--
 -->width:100%;padding:0px;(({liststyle|))};(({evenstyle|))};(({list20style|))}" <!--
 -->class="navbox-list navbox-((#ifeq:(({evenodd|))}|swap|odd|(({evenodd|even))))}"><!--
 --><div style="padding:(({listpadding|0em 0.25em))}">(({list20))}</div></td></tr>))<!--


---Below---
-->((#if:(({below|))}|<!--
 -->((#if:(({title|))}(({above|))}(({list1|))}(({list2|))}(({list3|))}|<tr style="height:2px;"><td></td></tr>))<!--
 --><tr><td class="navbox-abovebelow" style="(({basestyle|))};(({belowstyle|))}" <!--
 -->colspan="((#expr:2((#if:(({imageleft|))}|+1))((#if:(({image|))}|+1))))">(({below))}</td></tr>))<!--


--></table>((#switch:(({border|(({1|))))))|subgroup|child=<div>|none=|#default=</td></tr></table>))


## Please do not edit without discussion first as this is a VERY complex template ##

def main():
    params = getAllParams( { 'bodystyle'   : '',
                             'style'       : '',
                             'listpadding' : '0em 0.25em' } )
    params['border'] = getParam( 'border', getParam( '1', '' ) )

    if params['border'] in ['subgroup','child']:
        print '</div>'
    elif params['border'] == 'none':
        pass
    else:
        print "<table class='navbox' cellspacing='0' style='%(bodystyle)s;%(style)s'><tr><td style='padding:2px;'>" % params

    print "<table cellspacing='0' class='nowraplinks "

    if params['title'] and params['state'] not in ['plain','off']:
        print "collapsible %s" % getParam( 'state', 'autocollapse' )

    if params['border'] in ['subgroup','child','none']:
        print "navbox-subgroup' style='width:100%;%(bodystyle)s;%(style)s%(innerstyle)s" % params
    else:
        print "' style='width:100%;background:transparent;color:inherit;%(innerstyle)s" % params

    # Title and navbar
    if params['title']:
        print '<tr>'
        if params['titlegroup']:
            print """<td class='navbox-group' 
                         style='%(basestyle)s;
                                %(groupstyle)s;
                                %(titlegroupstyle)s'>
                     %(titlegroup)s</td><th style='border-left:2px solid #fdfdfd;width:100%;
                  """ % params
        else:
            print "<th style='"

        params['~cols'] = 2
        if getParam( 'imageleft' ):
            params['~cols'] += 1
        if getParam( 'image' ):
            params['~cols'] += 1
        if getParam( 'titlegroup' ):
            params['~cols'] -= 1
        print "%(basestyle)s;%(titlestyle)s' colspan='%(~cols)d' class='navbox-title'>" % params

        if params['navbar'] in ['plain','off'] or not params['name'] and params['border'] in ['subgroup','child','none']:
            if params['navbar'] == 'off':
                if params['state'] == 'plain':
                    print "<div style='float:right;width:6em;'>&nbsp;</div>"
            else:
                if params['state'] != 'plain':
                    print "<div style='float:left;width:6em;'>&nbsp;</div>"
        else:
            print "<div style='float:left; width:6em;text-align:left;'>"
            print "((Navbar|%(name)s|fontstyle=%(fontstyle)s;%(titlestyle)s;border:none;|mini=1))</div>" % params
            if params['state'] == 'plain':
                print "<div style='float:right;width:6em;'>&nbsp;</div>"

        if params['border'] in ['subgroup','child','none']:
            params['~fontsize'] = 100
        else:
            params['~fontsize'] = 110
        print "<span style='font-size:%(~fontsize)d;'>%(title)s</span></th></tr>" % params

    # Above
    if params['above']:
        if params['title']:
            print <tr style="height:2px;"><td></td></tr>
        print "<tr><td class='navbox-abovebelow' style='%(basestyle)s;%(abovestyle)s' colspan='%(~cols)d>%(above)s</td></tr>" % params



    ## Body
    params['~rowspan'] = 1
    for i in range( 2, 20 ):
        if params['list'+str(i)]:
            params['~rowspan'] += 2

    # First group/list and images
    if params['list1']:
        if params['title'] or params['above']:
            print "<tr style='height:2px;'><td></td></tr>"
        print '<tr>'

        if params['imageleft']:
            print "<td style='width:0%;padding:0px 2px 0px 0px;%(imageleftstyle)s' rowspan=%(~rowspan)d>%(imageleft)s</td>" % params

        doGroup( 1, params)

        if params['image']:
            print "<td style='width:0%;padding:0px 0px 0px 2px;%(imagestyle)s' rowspan=%(~rowspan)d>%(image)s</td>" % params

        print '</tr>'

    # Remaining groups/lists 
    for i in range( 2, 20):
        doGroup( i, params )

    # Below
    if params['below']:
        if params['title'] or params['above'] or params['list1'] or params['list2'] or params['list3']:
            print "<tr style='height:2px;'><td></td></tr>"
        print "<tr><td class='navbox-abovebelow' style='%(basestyle)s;%(belowstyle)s' colspan='%(~cols)d'>%(below)s</td></tr>" % params

    print "</table>"
    
    if params['border'] in ['subgroup','child']:
        print "<div>"
    elif params['border'] == 'none':
        pass
    else:
        print "</td></tr></table>"

# Do a group/list block
def doGroup(count, params):
    i = str(count)
    if params['list'+i]:
        if params['title'] or params['above'] or params['list1']:
            print "<tr style='height:2px'><td></td></tr>"
        print '<tr>'
        if params['group'+i]:
            params['~groupstyle'] = params['group'+i+'style']
            params['~group'] = params['group'+i]
            print """<td class='navbox-group' 
                         style='%(basestyle)s;%(groupstyle)s;%(~groupstyle)s'>
                     %(~group)s
                     </td><td style='text-align:left;border-left-width:2px;border-left-style:solid;
                  """ % params
        else:
            print "<td colspan='2' style='"

        if count % 2:
            params['~eostyle'] = params['oddstyle']
        else:
            params['~eostyle'] = params['evenstyle']
        if params['evenodd'] == 'swap':
            if count % 2:
                params['~evenodd'] = 'even'
            else:
                params['~evenodd'] = 'odd'
        else:
            if count % 2:
                params['~evenodd'] = getParam( 'evenodd', 'odd' )
            else:
                params['~evenodd'] = getParam( 'evenodd', 'even' )
        params['~liststyle'] = params['list'+i+'style']
        params['~list'] = params['list'+i]
        print """width:100%;padding:0px;%(liststyle)s;%(~eostyle)s;%(~liststyle)s' 
                   class='navbox-list navbox-%(~evenodd)s"><div 
                   style='padding:%(listpadding)s">%(~list)s</div></td></tr>
              """ % params