/* ----------------------------------------------------- */
/* Defines design of website, inclusive navigation       */
/* (Parameter "textcolumns" defines number of columns.   */
/* Valid values are 1 or 2)                              */
/* ----------------------------------------------------- */

function DesignOfWebsite(textcolumns)
{
  if   (textcolumns == 2) { columnspan = ''; } else { columnspan = 'colspan=3'; } /* note 10 */

  if   (locContains('/en/'))
       { var homeStatus    = 'entry page';
         var contactStatus = 'contact addresses';
         var languageStatus = 'German website - Deutsche Website';
         var contactLink   = 'CONTACT';
         var languageLink  = 'GERMAN';
         var languageHref  = '../index.html';
       }
  else { var homeStatus    = 'Einstiegsseite';
         var contactStatus = 'Kontaktadressen';
         var languageStatus = 'Englisch-sprachige Website - English website';
         var contactLink   = 'KONTAKT';
         var languageLink  = 'ENGLISH';
         var languageHref  = 'en/index.html';
       }

  document.write('<body background="images/_icon-top.gif" bgproperties="fixed">');
  preloadImages(); /* note 1 */
  document.write('<a name="top"></a>'); /* note 2 */
  /* note 3 + 4 */
  document.write('<table width="1004" height="100%" cellpadding="0" cellspacing="0" valign="top" border="0">');
  document.write('<colgroup> <col width="16"> <col width="142"> <col width="82"> <col width="50"> <col width="480"> <col width="40"> <col width="178"> <col width="16"> </colgroup>');

  /* 1. TR: spacer | home-contact-language | green cell | 4.-8. empty cells */
  document.write('<tr><td width="16" height="41">&nbsp;</td>');
  document.write('<td width="142" height="41" valign="bottom">');
  document.write('<table cellpadding="0" cellspacing="0" border="0" width="125">');
  if   (!locContains('index.html'))
       { document.write('<tr><td class="menu" align="left"><a class="menu" href="' + parentDir + 'index.html" onmouseover="window.status=\'' + homeStatus + '\'; return true;" onmouseout="window.status=\'\'; return true;">HOME&nbsp;</a></td>'); }
  else { document.write('<tr><td class="menuactive" align="left">HOME&nbsp;</td>'); }
  if   (!locContains('kontakt.html'))
       { document.write('<td class="menu" align="center"><a class="menu" href="' + parentDir + 'kontakt.html" onmouseover="window.status=\'' + contactStatus + '\'; return true;" onmouseout="window.status=\'\'; return true;">' + contactLink + '</a></td>'); }
  else { document.write('<td class="menuactive" align="center">' + contactLink + '</td>'); }
  document.write('<td class="menu" align="right"><a class="menu" href="' + parentDir + languageHref + '" onmouseover="window.status=\'' + languageStatus + '\'; return true;" onmouseout="window.status=\'\'; return true;">' + languageLink + '</a></td>');
  document.write('</tr></table></td>');
  document.write('<td background="' + parentDir + 'images/ci_greencell.jpg" width="82" height="41" valign="top"></td>');
  document.write('<td height="41" colspan="5" valign="top"></td></tr>');

  /* 2. TR: spacer | green line | green line | 4.-8. empty cells */
  document.write('<tr><td width="16" height="2"></td>');
  document.write('<td width="142" height="2" valign="top"><img src="' + parentDir + 'images/ci_greenline.gif" width="142" height="2" alt=""></td>');
  document.write('<td width="82" height="2" valign="top"><img src="' + parentDir + 'images/ci_greenline.gif" width="82" height="2" alt=""></td>');
  document.write('<td height="2" colspan="5" valign="top"></td></tr>');

  /* 3. TR - 1.+2. TD: spacer | navigation bar and top-button */
  document.write('<tr><td width="16" height="100%">&nbsp;</td>');
  document.write('<td width="142" background="images/_blank.gif" onClick="self.location.href=\'#top\'" title="zur&uuml;ck zum Seitenanfang" height="100%" valign="top">');
  document.write('<p class="navimain">&nbsp;</p>');
  showMenu("unternehmen");
  showMenu("leistungen");
  showMenu("staerken");
  showMenu("projekte");
  showMenu("kunden");
  showMenu("drucken");
  if (!locContains('/en/')) { document.write('<p style="margin-top:56px"><a href="itnews.html" class="itnews">IT-News der Stunde</a></p>'); }
  document.write('</td>');

  /* 3. TR - 3.-5. TD: picture stripe | spacer | logo and content */
  document.write('<td width="82" height="100%" valign="top" rowspan="2" background="' + parentDir + 'images/ci_picture-stripe.jpg" bgcolor="white" title="">&nbsp;</td>');
  document.write('<td width="50" height="100%" valign="top">&nbsp;</td>');
  document.write('<td ' + columnspan + ' height="100%" valign="top" align="left">'); /* note 10 */
  document.write('<a href="' + parentDir + 'index.html"><img src="' + parentDir + 'images/ci_logo.gif" width="478" height="43" align="right" alt="" border="0"></a>'); /* note 11 */
  document.write('<p class="normalblack" style="height:115px">&nbsp;</p>');
}


/* ----------------------------------------------------- */
/* Show main and its submenu                             */
/* Main and submenu html-file has to follow the          */
/* conventions: main.html and main_submenu.html          */
/* ----------------------------------------------------- */

function showMenu(menu)
{ 
  /* ---- show main menu items ---- */
  var menuLink = parentDir + menu + ".html";
  var str;

  if   (!locContains(menu)) /* note 6 */
       { str = 'style="display:none"';
         document.write('<p class="navimain"><a href="' + menuLink + '"' +
         'onmouseover="changeImages(\'m_' + menu + '\', \'' + parentDir + 'images/m_' + menu + '-over.gif\'); window.status=\'\'; return true;"' +
         'onmouseout="changeImages(\'m_' + menu + '\', \'' + parentDir + 'images/m_' + menu + '.gif\'); window.status=\'\'; return true;">' +
         '<img name="m_' + menu + '" src="' + parentDir + 'images/m_' + menu + '.gif" alt="" width="125" height="14" border="0"></a></p>');
       }
  else { str = ''; 
         document.write('<p class="navimain"><a href="' + menuLink + '"' +
         'onmouseover="changeImages(\'m_' + menu + '\', \'' + parentDir + 'images/m_' + menu + '-over.gif\'); window.status=\'\'; return true;"' +
         'onmouseout="changeImages(\'m_' + menu + '\', \'' + parentDir + 'images/m_' + menu + '-down.gif\'); window.status=\'\'; return true;">' +
         '<img name="m_' + menu + '" src="' + parentDir + 'images/m_' + menu + '-down.gif" alt="" width="125" height="14" border="0"></a></p>');
       }

  /* define content of submenus ------------------------ */
  if   (navigator.appName.indexOf("Netscape") != -1) 
       { var linefeed = "<br>" } 
  else { var linefeed = ""; }
  if   (locContains('/en/')) /* note 7 */
       { var leistungenSub1 = linefeed + linefeed + '&nbsp;&nbsp;Effective Strategies for<br>&nbsp;&nbsp;long-term Success';
         var leistungenSub2 = linefeed + '&nbsp;&nbsp;Outsourcing your<br>&nbsp;&nbsp;Marketing Activities';
         var leistungenSub3 = linefeed + '&nbsp;&nbsp;Marketing Management';
         var leistungenSub4 = linefeed + '&nbsp;&nbsp;Speed up your<br>&nbsp;&nbsp;Business in Germany';
         var projekteSub1 = linefeed + linefeed + '&nbsp;&nbsp;Strategic Marketing';
         var projekteSub2 = linefeed + '&nbsp;&nbsp;Tactical Marketing';
         var projekteSub3 = linefeed + '&nbsp;&nbsp;Outsourcing<br>&nbsp;&nbsp;Marketing Management';
         var projekteSub4 = linefeed + '&nbsp;&nbsp;Others(e.g. PM)';
       }
  else { var leistungenSub1 = linefeed + linefeed + '&nbsp;&nbsp;Effektive Strategien f&uuml;r<br>&nbsp;&nbsp;den langfristigen Erfolg';
         var leistungenSub2 = linefeed + '&nbsp;&nbsp;Outsourcing Ihrer<br>&nbsp;&nbsp;Marketingaktivit&auml;ten';
         var leistungenSub3 = linefeed + '&nbsp;&nbsp;Marketingmanagement';
         var projekteSub1 = linefeed + linefeed + '&nbsp;&nbsp;Strategisches Marketing';
         var projekteSub2 = linefeed + '&nbsp;&nbsp;Operatives Marketing';
         var projekteSub3 = linefeed + '&nbsp;&nbsp;Outsourcing &amp; Interims-<br>&nbsp;&nbsp;Marketingmanagement';
         var projekteSub4 = linefeed + '&nbsp;&nbsp;Andere (z.B. PM)';
       }

  /* ---- show or hide submenu, depending on variable str (if error: see note 8) */
  if (menu == "leistungen")
     { document.write('<div id="div_leistungen"' + str + '>');
       if   (locContains('_strategien'))
            { document.write('<p class="naviactive"><a class="naviactive" href="' + parentDir + 'leistungen_strategien.html" title="">' + leistungenSub1 + '</a></p>'); }
       else { document.write('<p class="navi"><a class="navi" href="' + parentDir + 'leistungen_strategien.html" title="">' + leistungenSub1 + '</a></p>'); }
       if   (locContains('_outsourcing'))
            { document.write('<p class="naviactive"><a class="naviactive" href="' + parentDir + 'leistungen_outsourcing.html" title="">' + leistungenSub2 + '</a></p>'); }
       else { document.write('<p class="navi"><a class="navi" href="' + parentDir + 'leistungen_outsourcing.html" title="">' + leistungenSub2 + '</a></p>'); }
       if   (locContains('_management'))
            { document.write('<p class="naviactive"><a class="naviactive" href="' + parentDir + 'leistungen_management.html" title="">' + leistungenSub3 + '</a></p>'); }
       else { document.write('<p class="navi"><a class="navi" href="' + parentDir + 'leistungen_management.html" title="">' + leistungenSub3 + '</a></p>'); }
       if   (locContains('/en/')) 
            { if   (locContains('_startup'))
                   { document.write('<p class="naviactive"><a class="naviactive" href="' + parentDir + 'leistungen_startup.html" title="">' + leistungenSub4 + '</a></p>'); }
              else { document.write('<p class="navi"><a class="navi" href="' + parentDir + 'leistungen_startup.html" title="">' + leistungenSub4 + '</a></p>'); }
            }
       document.write('</div>');
     }
  if ((menu == "projekte") && (locContains('/en/') == false))
     { document.write('<div id="div_projekte"' + str + '>');
       if   (locContains('_strategisch'))
            { document.write('<p class="naviactive"><a class="naviactive" href="' + parentDir + 'projekte_strategisch.html" title="">' + projekteSub1 + '</a></p>'); }
       else { document.write('<p class="navi"><a class="navi" href="' + parentDir + 'projekte_strategisch.html" title="">' + projekteSub1 + '</a></p>'); }
       if   (locContains('_operativ'))
            { document.write('<p class="naviactive"><a class="naviactive" href="' + parentDir + 'projekte_operativ.html" title="">' + projekteSub2 + '</a></p>'); }
       else { document.write('<p class="navi"><a class="navi" href="' + parentDir + 'projekte_operativ.html" title="">' + projekteSub2 + '</a></p>'); }
       if   (locContains('_management'))
            { document.write('<p class="naviactive"><a class="naviactive" href="' + parentDir + 'projekte_management.html" title="">' + projekteSub3 + '</a></p>'); }
       else { document.write('<p class="navi"><a class="navi" href="' + parentDir + 'projekte_management.html" title="">' + projekteSub3 + '</a></p>'); }
       if   (locContains('_andere'))
            { document.write('<p class="naviactive"><a class="naviactive" href="' + parentDir + 'projekte_andere.html" title="">' + projekteSub4 + '</a></p>'); }
       else { document.write('<p class="navi"><a class="navi" href="' + parentDir + 'projekte_andere.html" title="">' + projekteSub4 + '</a></p>'); }
       document.write('</div>');
     }
}


/* ----------------------------------------------------- */
/* Add footer to main content column                     */
/* - You can add additional text in the html page, but   */
/*   without <p>, i.e. write only the text after calling */
/*   Footer(spacing)                                     */
/* - spacing=0 complies to margin-top=85px (default)     */
/* ----------------------------------------------------- */

function Footer(spacing)
{ 
  if   (locContains('/en/')) /* note 12 */
       { var copyrightLink = 'Legal Notices and Terms; Privacy Statement'; }
  else { var copyrightLink = 'Rechtliche Hinweise und Datenschutz'; }
  /* spacing (standard is 85px) | legal notice | Hot-Links */
  if (spacing == 0) spacing = 85;
  document.write('<p class="smallgray" style="line-height:2.0; margin-top:' + spacing + 'px; text-align:center"><a href="' + parentDir + 'copyright.html" onmouseover="window.status=\'\'; return true;">' + copyrightLink + '</a>&nbsp;&nbsp;|&nbsp;&nbsp;<a href="marketing_news.html">Marketing News</a>');
}

/* ----------------------------------------------------- */
/* Closes main content cell                              */
/* And opens small content column if needed              */
/* ----------------------------------------------------- */

function SmallColumn()
{ 
  /* 3. TR - 5.-7. TD: close main content cell and if 2-columns for text: add spacer and open sub content cell */
  document.write('</p>');
  document.write('</td>');
  if   (columnspan == '') /* note 10 */
       { document.write('<td width="40" height="100%" valign="top">&nbsp;</td>');
         document.write('<td width="178" height="100%" valign="top"><p class="normalblack" style="height:224px">&nbsp;</p>');
       }
}

/* ----------------------------------------------------- */
/* Closes website                                        */
/* ----------------------------------------------------- */

function EndOfWebsite()
{ 
  /* 3. TR - 7.+8. TD: if 2-columns for text, close sub content cell | spacer */
  if   (columnspan == '') { document.write('</td>'); } /* note 10 */
  document.write('<td width="16" height="100%" valign="top">&nbsp;</td></tr>');
  /* 4. TR: small empty row | close table and website */
  document.write('<tr><td height="5" colspan="8"></td></tr>'); /* note 9 */
  document.write('</table></body></html>');
}


/* ----------------------------------------------------- */
/* Global variables and utilities                        */
/* ----------------------------------------------------- */

var preloadFlag = false;
var parentDir; /* note 5 */
var columnspan; /* note 10 */

function newImage(arg)
{ if (document.images)
     { rslt = new Image();
       rslt.src = arg;
       return rslt;
     }
}

function changeImages()
{ if (document.images && (preloadFlag == true))
     { for (var i=0; i<changeImages.arguments.length; i+=2)
           { document[changeImages.arguments[i]].src = changeImages.arguments[i+1]; }
     }
}

/* Does URL contains certain string (=strSubstr)? */
function locContains(strSubstr)
{
  var strHREF = new String(window.location.href);
  strHREF = strHREF.toLowerCase();
  if   (strHREF.indexOf(strSubstr) != -1)
       { return true; }
  else { return false; }
}

/* Preload navigation buttons */
function preloadImages()
{ 
  if   (locContains('/kunden/') || locContains('/glossar/')) { parentDir = "../../"; }
  else { parentDir = ""; }

  if (document.images)
     { 
       m_unternehmen_over = newImage("' + parentDir + 'images/m_unternehmen-over.gif");
       m_unternehmen_down = newImage("' + parentDir + 'images/m_unternehmen-down.gif");
       m_leistungen_over = newImage("' + parentDir + 'images/m_leistungen-over.gif");
       m_leistungen_down = newImage("' + parentDir + 'images/m_leistungen-down.gif");
       m_staerken_over = newImage("' + parentDir + 'images/m_staerken-over.gif");
       m_staerken_down = newImage("' + parentDir + 'images/m_staerken-down.gif");
       m_projekte_over = newImage("' + parentDir + 'images/m_projekte-over.gif");
       m_projekte_down = newImage("' + parentDir + 'images/m_projekte-down.gif");
       m_kunden_over = newImage("' + parentDir + 'images/m_kunden-over.gif");
       m_kunden_down = newImage("' + parentDir + 'images/m_kunden-down.gif");
       m_drucken_over = newImage("' + parentDir + 'images/m_drucken-over.gif");
       m_drucken_down = newImage("' + parentDir + 'images/m_drucken-down.gif");
       preloadFlag = true;
     }
}


/* ----------------------- */
/* Notes to implementation */
/* ----------------------- */
/*
Note 1:  document.write('<body onload="preloadImages()">'); would not work, 
         because the body statement will only be written in HTML file, i.e. 
         function would not be called
Note 2:  Only necessary for NS (top of page)
Note 3:  Table width = 1004 px (+ scrollbar 20px = 1024px).
         If set to 100% and screen resolution is different
         to 1024, then content will be pressed or stretched
Note 4:  Design with 8 columns: 
         spacer 16px + menu 142px + picture-stripe 82px + spacer 50px + 
         main content 480px + spacer 40px + sub content 178px + spacer 16px = 1004px 
         Proof with alert(document.body.offsetWidth);
Note 5:  Variable parentDir set in first called statement = preloadImages 
         Necessary for the lower customer directories
Note 6:  Set "menuLink" instead of "menu" if you don't want to 
         show submenu when certain submenu item is clicked
Note 7:  Indent of sub menus made with "&nbsp", because margin-left 
         in css doesn't work with IE 6
Note 8:  If error: See whether div=name is defined and closed (</div>)
Note 9:  should be "colspan=7" (instead of 8) because picture-stripe has rowspan=2 (?)
Note 10: Web page is standardized programmed with 2-columns for text -- 
         call function "DesignOfWebsite(2)".
         For special pages a 1-column page is possible (DesignOfWebsite(1)) 
         -- this is programmed with the help of "colspan".
Note 11: Logo with transparent space on the left side is only used for pages 
         with only 1 text column (otherwise logo would be at the right border). 
         Logo 2px smaller (478 instead 480) to be sure not to stretch 
         text column.
Note 12: Optimiert f&uuml;r 1024&times;768 Pixel und den Microsoft IE ab Version 4.x.
         Optimized for 1024x768 pixels and Microsoft IE version 4.x and later.
*/
