

function Init()
    {

    InitTopItems();
    }

function TopItem (name,caption_de,caption_en,highlight,url,pic_de,pic_en)
    {
    this.name = name;
    this.caption_de = caption_de;
    this.caption_en = caption_en;
    this.highlight = highlight;
    this.url = url;
    this.pic_de = pic_de;
    this.pic_en = pic_en;
    this.subitems = new Array();
    this.AddSubItem = AddSubItem;
    }

function SubItem(topitemname,caption_de,caption_en,url,itemnumber)
    {
    this.name = itemnumber;
    this.url = url;
    this.caption_de = caption_de;
    this.caption_en = caption_en;
    }

function AddSubItem (caption_de,caption_en,url)
    {
    var itemnumber = this.subitems.length;
    this.subitems[itemnumber] = new SubItem(this.name,caption_de,caption_en,url,itemnumber);
    }

function WriteHeader(lang,current)
    {
    var strRet = '';
    var strClear = '<div class="clearer">&nbsp;</div>';
    var strPic;
    var strNav = '';
    var x;
    var clsHigh = '';

    if (lang == 'de')
    {
        strPic = 'bg_main_start.png';
    }
    else
    {
        strPic = 'bg_main_start_en.png';
    }


    strRet = '<div id="defaultnav">';
    if (lang == 'de')
        {
        strRet += '<a href="en_index.html"><img src="image/icon_lang_en.gif" width=22 height=10 border="0" />English</a>';
        }
    else
        {
        strRet += '<a href="index.html"><img src="image/icon_lang_de.gif" width=22 height=10 border="0" />Deutsch</a>';
        }

    strRet += '</div>';
    strRet += '<div id="logo"><a href="index.html"><img src="image/logo.gif" width=171 height=58 alt="" border="0"></a></div>';
    strRet += strClear;

    strNav = '<div id="mainnav"><ul>';


    for (x=0;x<topitems.length;x++)
        {

        if (topitems[x].highlight == 1)
		{
			clsHigh = 'style="color:rgb(142,5,5)"';
		}
		else
		{
			clsHigh = '';
		}
		
		
        if (topitems[x].name == current)
            {

            if (lang == 'de')
                {
                	strNav += '<li><strong ' + clsHigh + '>' + topitems[x].caption_de + '</strong>';
                strPic = topitems[x].pic_de;
                }
            else
                {
                	strNav += '<li><strong ' + clsHigh + '>' + topitems[x].caption_en + '</strong>';
                strPic = topitems[x].pic_en;
                }
            }
        else
            {

            if (lang == 'de')
                {
                if (topitems[x].name == 'home')
                    {
                    	strNav += '<li><a ' + clsHigh + ' href="' + topitems[x].url + '">' + topitems[x].caption_de + '</a></li>';
                    }
                else
                    {
                    	strNav += '<li><a ' + clsHigh + ' href="' + lang + '_' + topitems[x].url + '">' + topitems[x].caption_de + '</a></li>';
                    }

                }
            else
                {
                	strNav += '<li><a ' + clsHigh + ' href="' + lang + '_' + topitems[x].url + '">' + topitems[x].caption_en + '</a></li>';
                }
            }

        }

    strNav += '</ul></div>';

    strRet += '<div id="mainpic"><img src="image/' + strPic + '" width=800 height=212 alt="" border="0"></div>';
    strRet += strClear;
    strRet += strNav;

    document.write(strRet);
    }


function WriteSubItem(t_item,lang,current)
    {

    var strRet = '';
    var x;
    var y;

    for (x=0;x<topitems.length;x++)
        {
        if (topitems[x].name == t_item)
            {
            if (topitems[x].subitems.length > 0)
                {
                strRet = '<ul>';

                for (y=0;y<topitems[x].subitems.length;y++)
                    {
                    if (topitems[x].subitems[y].name == current)
                        {
                        if (lang == 'de')
                            {
                                strRet += '\n <li id="current_sn"><span>' + topitems[x].subitems[y].caption_de + '</span></li>';
                            }
                        else
                            {
                                strRet += '\n <li id="current_sn"><span>' + topitems[x].subitems[y].caption_en + '</span></li>';
                            }
                        }
                    else
                        {
                        if (lang == 'de')
                            {
                                strRet += '\n <li><a href="' + lang + topitems[x].subitems[y].url +'">' + topitems[x].subitems[y].caption_de + '</a></li>';
                            }
                        else
                            {
                                strRet += '\n <li><a href="' + lang + topitems[x].subitems[y].url +'">' + topitems[x].subitems[y].caption_en + '</a></li>';
                            }
                        }

                    }
                strRet += '</ul>';
                }
            break;
            }
        }
    document.write(strRet);
    }

function WriteFooter(lang)
    {
    var strRet;

    if (lang == 'de')
        {
        strRet = '<ul>';
        strRet += '<li><p>&copy; by Hartkopf&amp;Cie</p></li>';
        strRet += '<li><a href="de_legalnote_0.html">Rechtshinweis</a></li>';
        strRet += '<li><a href="de_imprint_0.html">Impressum</a></li>';
        strRet += '</ul>';
        }
    else
        {
        strRet = '<ul>';
        strRet += '<li><p>&copy; by Hartkopf&amp;Cie</p></li>';
        strRet += '<li><a href="en_legalnote_0.html">Legal notice</a></li>';
        strRet += '<li><a href="en_imprint_0.html">Masthead</a></li>';
        strRet += '</ul>';
        }

    document.write(strRet);
    }


function WriteBanner(lang)
    {
    var strRet;

    strRet = '<div id="newsbanner">';
    strRet += '<img src="image/banner2011.gif" alt="Hier entlang..." border="0" width="170" height="170"';
    strRet += 'onclick="javascript:window.open(\'de_challenge.html\',\'Fenster\',\'width=550,height=600\')">';
    strRet += '</div>';

    document.write(strRet)
    }
