window.defaultStatus = "Centimmo - der Immobilienfinanzierer";
var numbercol;
var zoom = 1;

/* ---------------------------------------------------------------------------- */
/* Defines design of website, inclusive navigation                              */
/* -- textcolumns = number of columns (1 or 2)                                  */
/* -- html-page has to use ci_body1.jpg or ci_body2.jpg                         */
/* ---------------------------------------------------------------------------- */

function DesignOfWebsite(textcolumns)
{
numbercol = textcolumns;

// see note 1c
if (screen.width < 1024) document.write('<div style="position:absolute; left:779px; top:0px"><img src="images/ci_correct.jpg" width="219" height="170" alt="" border="0"></div>');

// Header with picture (note 1a)
document.write('<table class="doNotPrint" height="170" width="100%" cellpadding="0" cellspacing="0" border="0">');
if   (locContains('zinsen'))
     document.write('<tr><td rowspan="4" background="images/ci_pic-calc.jpg" valign="top" width="264" height="170">&nbsp;</td>');
else if (locContains('referenzen'))
     document.write('<tr><td rowspan="4" background="images/ci_pic-house2.jpg" title="Foto Roland Maier, siehe Impressum" valign="top" width="264" height="170">&nbsp;</td>');
else document.write('<tr><td rowspan="4" background="images/ci_pic-house1.jpg" valign="top" width="264" height="170">&nbsp;</td>');

// Header with logo (note 1b)
document.write('<td height="158" bgcolor="#DBDEE1" background="images/ci_logo.jpg" style="background-repeat:no-repeat; cursor:hand" align="left" valign="center" title="Zur Einstiegsseite / HOME" onClick="document.location.href=\'index.html\'">&nbsp;</td></tr>');

// Header with horizontal menu: home, imprint, print and zoom (note 2)
document.write('<tr><td height="1" bgcolor="#8D97A1"></td></tr>');
document.write('<tr><td height="10" bgcolor="#B8BFC6" valign="center"><img src="images/_blank.gif" width="366" height="1" alt="" border="0">');
document.write('<a href="index.html"><img src="images/m_home.gif" width="23" height="8" border="0"></a><img src="images/_line-v.gif" width="15" height="8">');
document.write('<a href="recht_impressum.html"><img src="images/m_imprint.gif" width="50" height="8" border="0"></a><img src="images/_line-v.gif" width="15" height="8">');
document.write('<a href="javascript:print()"><img src="images/m_print.gif" width="41" height="8" border="0"></a>');
// var tooltip = '<b>F&uuml;r Menschen mit Sehschw&auml;che</b><br>[+]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Seiten stark vergr&ouml;&szlig;ern<br>[1:1]&nbsp;&nbsp;Vergr&ouml;&szlig;erung zur&uuml;cksetzen<br><br>Funktioniert <b>ab IE V5.5</b><br>Die Seiten werden zwar nicht immer<br>sch&ouml;n, aber lesbar angezeigt :-)';
// document.write('<a href="javascript:zoom_in()" class="zoom"><img src="images/m_zoom-in.gif" width="10" height="8" border="0"><span>' + tooltip + '</span></a>');
// document.write('<a href="javascript:zoom_reset()" class="zoom"><img src="images/m_zoom-reset.gif" width="12" height="8" border="0"><span>' + tooltip + '</span></a>');
document.write('</td></tr><tr><td height="1" bgcolor="#8D97A1"></td></tr>');
document.write('</table>');

// Main menus
document.write('<table width="100%" cellspacing="0" cellpadding="0" border="0">');
document.write('<tr><td class="doNotPrint" width="132" valign="top" align="left">');
document.write('<img src="images/_blank.gif" width="132" height="30">');
document.write('<a href="finanzierungsweg.html"  class="menu" name="finanzierungsweg">SO GEHT\'S</a>');
document.write('<a href="darlehenssicherung.html" class="menu" name="darlehenssicherung">ABSICHERUNG</a>');
document.write('<a href="referenzen.html" class="menu" name="referenzen">REFERENZEN</a>');
document.write('<a href="zinsen.html" class="menu" name="zinsen">AKTUELLE ZINSEN</a>');
document.write('<a href="firma.html" class="menu" name="firma">WIR &Uuml;BER UNS</a>');
document.write('<a href="kontakt.html" class="menu" name="kontakt">KONTAKT</a>');
document.write('<a href="recht_agb.html" class="menu" name="agb">AGB</a>');
document.write('</td>');

// Sub menus
document.write('<td class="doNotPrint" width="132" valign="top" align="left">');
document.write('<img src="images/_blank.gif" width="132" height="30">');

if (locContains('finanzierungsweg'))
   { // document.write('<a href="finanzierungsweg_infos.html" class="submenu" name="finanzierungsweg4">Hintergrundinfos</a>');
     document.write('<a href="finanzierungsweg_privatkunden.html" class="submenu" name="finanzierungsweg1">Privatkunden</a>');
     document.write('<a href="finanzierungsweg_selbststaendige.html" class="submenu" name="finanzierungsweg2">Selbstst&auml;ndige</a>');
     document.write('<a href="finanzierungsweg_kapitalanleger.html" class="submenu" name="finanzierungsweg3">Kapitalanleger</a>');
     document.write('<br><br>');
     ChangeClass('finanzierungsweg');
   }
if (locContains('darlehenssicherung')) ChangeClass('darlehenssicherung');
if (locContains('referenzen')) ChangeClass('referenzen');
if (locContains('zinsen'))     ChangeClass('zinsen');
if (locContains('firma'))      ChangeClass('firma');
if (locContains('kontakt'))    ChangeClass('kontakt');
if (locContains('agb'))        ChangeClass('agb');

if (locContains('referenzen')) document.write('<p class="smallgray" style="text-align:right; margin-top:53px; padding:7px;"><i>Ideen werden erst<br>dann gut, wenn sie<br>realisiert sind.<br><br>Richtig, und um es<br>mit den Worten von<br>Henry Ford zu sagen:<br><br>Zusammenkommen<br>ist der Anfang.<br>Zusammenarbeiten<br>ist der Erfolg.<br><br>Rufen Sie uns also am<br>besten heute noch an!</i></p>');
else document.write('<img src="images/ci_submenu.gif" width="131" height="452" alt="" border="0">');
if (locContains('firma') || locContains('agb') || locContains('zinsen') || locContains('copyright')) document.write('<br><br><img src="images/ci_house-submenu.gif" width="131" height="70" alt="" border="0">');

document.write('</td>');

// Content
document.write('<td width="30"><img src="images/_blank.gif" width="30" height="1" alt="" border="0"></td>');
if (numbercol == '2') document.write('<td width="480" height="100%" valign="top" align="left"><img src="images/_blank.gif" width="480" height="16" border="0">');
else document.write('<td width="700" height="100%" colspan="4" valign="top" align="left"><img src="images/_blank.gif" width="700" height="16" border="0">');

// Header for print page - will not be displayed on screen 
document.write('<h6 class="onlyForPrint">Centimmo &ndash;<br>der Immobilienfinanzierer</h6>');
}


/* ---------------------------------------------------------------------------- */
/* "Closes" main content cell and opens small content column if needed          */
/* ---------------------------------------------------------------------------- */
function SmallColumn()
{ document.write('<br><br></span></p>');
  document.write('</td>');
  if (numbercol == 2)
     { document.write('<td class="doNotPrint" width="30"><img src="images/_blank.gif" width="30" height="1" alt="" border="0"></td>');
       document.write('<td class="doNotPrint" width="20"><img src="images/_blank.gif" width="20" height="1" alt="" border="0"></td>');
       document.write('<td class="doNotPrint" width="170" valign="top"><img src="images/_blank.gif" width="170" height="1" alt="" border="0"><br>');
     }
}


/* ---------------------------------------------------------------------------- */
/* Write footer and "closes" website                                            */
/* ---------------------------------------------------------------------------- */
function EndOfWebsite(footer)
{ if (numbercol == 2) document.write('</td>');
  document.write('<td width="100%">&nbsp;</td></tr>');
  document.write('<tr> <td></td> <td></td> <td></td>');
  document.write('<td class="doNotPrint"><br><br><p class="smallgray" style="line-height:2.0; text-align:center"><span class="blueline"><a href="recht_copyright.html" class="smallgray">Rechtliche Hinweise und Datenschutz</a>');
  document.write(footer);
  document.write('</td> <td></td> <td></td> <td></td> <td></td> </tr></table>');
}


/* ---------------------------------------------------------------------------- */
/* Write Buttons for "Rueckruf", "Beratung" and "Finanzierungsanfrage"          */
/* ---------------------------------------------------------------------------- */
function ButtonsTooltip(spacing)
{ spacing = spacing + 197;
  document.write('<style type="text/css">');
  document.write('<!--');
  document.write('a.anfrage       { font-family:Verdana,Arial; color:#000000; font-size: 8pt; line-height:1.6em; margin-top: 0px; margin-bottom:18px; text-decoration:none; }');
  document.write('a.anfrage:hover { background-color:#ffffff; z-index:50; cursor:hand; }');
  document.write('a.anfrage span  { display:none; }');
  document.write('a.anfrage:hover span { border:1px solid #AA0000; background-color:#ffffff; display:block; position:absolute; left:542px; top:' + spacing + 'px; padding:10px; }');
  document.write('-->');
  document.write('</style>');
}

function ButtonsWrite(spacing)
{ var str1, str2a, str2b, str3;

  // see note 4
  document.write('<img src=\"images/_blank.gif\" width=\"170\" height=\"' + spacing + '\" alt=\"\" border=\"0\"><br>');
  spacing = spacing + 196;
  spacing1 = spacing - 16;
  str1  = '<a href=\"#\" class=\"anfrage\" onClick=\"document.location.href=\'http://www.immobilienfinanzierer.com/anfrage_anruf.php\'\" onmouseover=\"javascript:document[\'anruf\'].src=\'images/m_anruf-over.jpg\';\" onmouseout=\"javascript:document[\'anruf\'].src=\'images/m_anruf.jpg\';\">';
  str2a = '<div style=\"position:absolute; left:824px; top:' + spacing + 'px\"><img src=\"images/m_anruf.jpg\" name=\"anruf\" width=\"170\" height=\"27\" alt=\"\" border=\"0\"></div>';
  str2b = '<div style=\"position:absolute; left:804px; top:' + spacing1 + 'px; width:20px; height:50px\"></div>';
  str3  = '<span style=\"width:250px; height:85px\"><h3 style="margin-top:0px">Wir rufen Sie gerne an!</h3>Klicken Sie hier und sagen Sie uns,<br>unter welcher Nummer und wann wir<br>Sie anrufen sollen.</span></a>';
  document.write(str1 + str2a + str3);
  document.write(str1 + str2b + str3);

  spacing = spacing + 41;
  spacing1 = spacing - 7;
  str1  = '<a href=\"#\" class=\"anfrage\" onClick=\"document.location.href=\'http://www.immobilienfinanzierer.com/anfrage_beratung.php\'\" onmouseover=\"javascript:document[\'beratung\'].src=\'images/m_beratung-over.jpg\';\" onmouseout=\"javascript:document[\'beratung\'].src=\'images/m_beratung.jpg\';\">';
  str2a = '<div style=\"position:absolute; left:824px; top:' + spacing + 'px\"><img src=\"images/m_beratung.jpg\" name=\"beratung\" width=\"170\" height=\"27\" alt=\"\" border=\"0\"></div>';
  str2b = '<div style=\"position:absolute; left:804px; top:' + spacing1 + 'px; width:20px; height:41px\"></div>';
  str3  = '<span style=\"width:250px; height:85px\"><h3 style="margin-top:0px">Sie m&ouml;chten sich beraten lassen?</h3>Klicken Sie hier und sagen Sie uns,<br>um was es geht.</span></a>';
  document.write(str1 + str2a + str3);
  document.write(str1 + str2b + str3);

  spacing = spacing + 41;
  spacing1 = spacing - 7;
  str1  = '<a href=\"#\" class=\"anfrage\" onmouseover=\"javascript:document[\'antrag\'].src=\'images/m_antrag-over.jpg\';\" onmouseout=\"javascript:document[\'antrag\'].src=\'images/m_antrag.jpg\';\" style=\"cursor:default\">';
  str2a = '<div style=\"position:absolute; left:824px; top:' + spacing + 'px\"><img src=\"images/m_antrag.jpg\" name=\"antrag\" width=\"170\" height=\"27\" alt=\"\" border=\"0\"></div>';
  str2b = '<div style=\"position:absolute; left:804px; top:' + spacing1 + 'px; width:20px; height:50px\"></div>';
  str3  = '<span style=\"width:250px; height:85px\"><h3 style="margin-top:0px">Finanzierungsanfrage</h3><div class=\"linkrot\" onClick=\"document.location.href=\'http://www.immobilienfinanzierer.com/anfrage_antrag.php\'\"><img src=\"images/_arrow1.gif\" width=\"13\" height=\"13\" border=\"0\">Finanzierungsantrag online ausf&uuml;llen</div><br><div class=\"linkrot\" onClick=\"document.location.href=\'http://www.immobilienfinanzierer.com/anfrage_antrag-per-mail.php\'\"><img src=\"images/_arrow1.gif\" width=\"13\" height=\"13\" border=\"0\">Antrag offline auf Ihrem PC ausf&uuml;llen</div></span></a>';
  document.write(str1 + str2a + str3);
  document.write(str1 + str2b + str3);
}


/* ---------------------------------------------------------------------------- */
/* Utilities                                                                    */
/* ---------------------------------------------------------------------------- */

// Does URL contains certain string (=strSubstr)?
function locContains(strSubstr)
{ var strHREF = new String(window.location.href);
  if   (strHREF.indexOf(strSubstr) != -1) { return true; }
  else { return false; }
}

// If link is active, its class will be changed to highlight menu item (menu --> menu1 / submenu --> submenu1)
// ++++ If it doesn't work, see note 3 ++++
function ChangeClass(str)
{ var anzHrefs = document.getElementsByTagName("a").length;
  for (var i=0; i<=anzHrefs-1; i++)
      { if (document.getElementsByTagName("a")[i].href == document.location.href)
           { var currentClassName = document.getElementsByTagName("a")[i].className;
             var newClassName = currentClassName.replace(/menu/,"menu1");
             document.getElementsByTagName("a")[i].className = newClassName;
           }
      }
  document.getElementsByName(str)[0].className = "menu1";
}

// print email address (note: CRLF in content = %0A%0A, blank = %20)
function liame(address,re,content,tip)
{ var str = "<a href=\"mailto:";
  var domain  = "@immobilienfinanzierer.com";
  var domain1 = "@immobilienfinanzierer.org";
  var trenner = "?";
  var bcc = "";
  if (address == "info")
     { // bcc = "?bcc=info" + domain1;
       bcc = "";
       trenner = "&";
     }
  if (re != "") { var re1 = trenner + "subject=" + re; } else { var re1 = ""; }
  if (content != "") { var content1 = "&body=" + content; } else { var content1 = ""; }
  if (tip != "") { var tip1 = " title=\"" + tip + "\""; } else { var tip1 = ""; }
  document.write(str + address + domain + bcc + re1 + content1 + '"' + tip1 + '>' + address + domain + '</a>');
}

// Show tooltip
function showTooltip(file,sizeW,sizeH,fromL,fromT)
{ size1 = "width=" + sizeW + ",height=" + sizeH + ",resizable=yes,location=no,menubar=no,scrollbars=no,toolbar=no,top=" + fromT + ",left=" + fromL + ",screenX=" + fromL + ",screenY=" + fromT;
  newWindow = window.open(file,"tipp",size1);
  newWindow.focus();
}

// Gets the <div>-section which belongs to strID */
function getElement(strID)
{ var elems = document.getElementsByTagName("div");
  for (i = 0; i < elems.length; i++)
      { var elem = elems.item(i); 
        if (elem.attributes.getNamedItem("id").nodeValue == strID) { return elem; }
      }
  return null;
}

// "Barrierefreie" pages (zoom in and reset)
function zoom_in()
{ zoom += 0.1;
  this.document.body.style.zoom = zoom;
}
function zoom_reset()
{ this.document.body.style.zoom = 1;
  zoom = 1;
}
/* function zoom_out()
{ if (zoom > 0.2) { zoom -= 0.1; }
  this.document.body.style.zoom = zoom;
} */

/* ------------------------------------------- 
note 1a: table-width=100% hat den Vorteil, dass Bereich maximal moeglich nach rechts weitergefuehrt wird 
         (sofern die letzte Zelle einer Zeile keine feste Breite hat und damit nach rechts variabel ist).
         Problem entsteht bei Aufloesung von 800x600 (Menue+Logo bereits breiter als 800px!) und die Bilder werden
         weg-/zusammengedrueckt, da die Breite mit 100%=800px definiert ist. Simple Lösung wäre table-width=1004px
         - dann bleibt Design bestehen, man muss nur nach rechts scrollen. Nachteil: Der beschriebene Vorteil von 
         oben ist weg, Design hoert nach 1004px auf. Deshalb folgende Loesung:
note 1b: Logo als Hintergrundbild eingesetzt (also NICHT <td><img ...></td>) und nimmt damit nur den verfuegbaren 
         Raum ein und drueckt nichts zusammen. Kleine Unschoenheit: Die Kopfzeile wird nur bis 800px=100% weitergefuehrt.
note 1c: Deshalb Korrekturbild ci_correct.jpg absolut reinpositioniert. Anweisung muss als erstes stehen, sonst geht es nicht. Keine Ahnung warum.
note 2:  Menue als Grafiken, da solch kleine Schriften unscharf aussehen (mit Arial/Verdana und px/pt versucht)
note 3:  Wenn Verzeichnis (z.B. zum Testen lokal) Umlaut enthaelt, werden diese versch. umgesetzt und die if-Abfrage ist nie true 
note 4:  str1 : <a HREF=\"anfrage_anruf.php\" class=\"anfrage\" onmouseover=... doesn't work (HREF instead of onlick) and I don't know why 
                (I mean it worked as html statements in the resp. html file, but now it doesn't in this JScript)
         str2b: Area between button and tooltip which must have the same onmouseover/out effects. If the tooltip is close to button: No div area needed.
         To make div visible for tests: add "background-color:#aa0000;" to style definition
------------------------------------------- */
