// ***************************************************************
// Add page to to external bookmarks like del.icio.us or Reddit
// ***************************************************************
function addToExternalBookmarks()
{
  document.write
  (
    '<div class="additionalBookmarks">'

    // del.icio.us
    + '<a href="http:\/\/del.icio.us\/post?url='
    + document.location.href
    + '&title='
    + document.title
    + '" target="_blank" title="Diese Seite zu del.icio.us hinzufügen"><img src="graphics\/delicious.png" width="16" height="16" \/> del.icio.us<\/a>'
    // Digg
    + '<a href="http:\/\/digg.com\/submit?phase=2&url='
    + document.location.href
    + '" target="_blank" title="Diese Seite zu Digg hinzufügen"><img src="graphics\/digg.png" width="16" height="16" \/> Digg<\/a>'
    // LinkARENA
    + '<a href="http:\/\/linkarena.com\/bookmarks\/addlink\/?url='
    + document.location.href
    + '&title='
    + document.title
    + '" target="_blank" title="Diese Seite zu LinkARENA hinzufügen"><img src="graphics\/linkarena.gif" width="16" height="16" \/> LinkARENA<\/a>'
    // Mister Wong
    + '<a href="http:\/\/www.mister-wong.de\/index.php?action=addurl&bm_url='
    + document.location.href
    + '&bm_description='
    + document.title
    + '" target="_blank" title="Diese Seite zu Mister Wong hinzufügen"><img src="http:\/\/www.mister-wong.de\/favicon.ico" width="16" height="16" \/> Mister Wong<\/a>'
    // Reddit
    + '<a href="http:\/\/reddit.com\/submit?url='
    + document.location.href
    + '&title='
    + document.title
    + '" target="_blank" title="Diese Seite zu Reddit hinzufügen"><img src="graphics\/reddit.png" width="16" height="16" \/> Reddit<\/a>'
    // Technorati
    + '<a href="http:\/\/technorati.com\/faves\/?add='
    + document.location.href
    + '" target="_blank" title="Diese Seite zu Technorati hinzufügen"><img src="graphics\/technorati.png" width="16" height="16" \/> Technorati<\/a>'
    // YiGG
    + '<a href="http:\/\/www.yigg.de\/neu?exturl='
    + document.location.href
    + '&exttitle='
    + document.title
    + '" target="_blank" title="Diese Seite zu YiGG hinzufügen"><img src="http:\/\/static.yigg.de\/v6\/\/images\/favicon.ico" width="16" height="16" \/> YiGG<\/a>'

    + '<\/div>'
   )
}

// ***************************************************************
// Search with the help of Google on the whole Homepage
// ***************************************************************
function searchOnGoogle()
{
  document.write(
    '<form method="get" action="http:\/\/www.google.com\/custom" enctype="application\/x-www-form-urlencoded" title="Auf der Homepage mit Google suchen | Zugriffstaste: [g]">'
      + '<input '
        + 'accesskey = "g" '
        + 'class     = "text" '
        + 'maxlength = "100" '
        + 'name      = "q" '
        + 'type      = "text" '
        + 'title     = "Geben Sie ein Suchwort ein" '
        + 'value     = "Google Custom Search" '
        + 'onfocus   = "this.value = \'\';" '
        + '\/> '
      + '<input '
        + 'accesskey = "g" '
        + 'class     = "submit" '
        + 'type      = "submit" '
        + 'value     = "Google-Suche" '
        + '\/>'
      + '<input '
        + 'name      = "sitesearch" '
        + 'type      = "hidden" '
        + 'value     = "www.matthias-kammerer.de" '
        + '\/>'
    + '<\/form>'
   );
}

// ***************************************************************
// Add current page to the bookmarks
// ***************************************************************
function addToFavorites()
{
  if (window.sidebar) { // FF
    document.write('<a href="javascript:window.sidebar.addPanel(document.title, document.location.href, \'\');" title="Seite zu den Lesezeichen hinzufügen | Zugriffstaste: [L]" accesskey="l"><img src=".\/graphics\/favorites.gif" alt="Lesezeichen" width="15" height="13" \/> Lesezeichen</a>');
  } else if( window.external ) { // IE
    document.write('<a href="javascript:window.external.AddFavorite(document.location.href, document.title);" title="Seite zu den Lesezeichen hinzufügen | Zugriffstaste: [L]" accesskey="l"><img src=".\/graphics\/favorites.gif" alt="Lesezeichen" width="15" height="13" \/> Lesezeichen<\/a>');}
  else if(window.opera && window.print) { // Opera Hotlist
    return true; }
}

// ***************************************************************
// Online translation of the current page via different online services
// ***************************************************************
function translateEN()
{
  document.write
  (
   '<a href="http:\/\/translate.google.com\/translate?hl=en&ie=UTF8&sl=de&tl=en&u='
    + document.location.href
    + '" lang="en" title="Translate this page online into English via Google Translate">Google Translate<\/a>'
    + ' <a href="http:\/\/www.windowslivetranslator.com\/BV.aspx?ref=Internal&a='
    + document.location.href
    + '" lang="en" title="Translate this page online into English via Windows Live Translator">[Windows Live] Translator<\/a>'
    + ' <a href="http:\/\/babelfish.yahoo.com\/translate_url?doit=done&tt=url&intl=1&fr=bf-home&lp=de_en&btnTrUrl=Translate&trurl='
    + document.location.href
    + '" lang="en" title="Translate this page online into English via Yahoo! Babel Fish">Yahoo! Babel Fish<\/a>'
  );
}

// ***************************************************************
// Heading with document title and document location
// ***************************************************************
function heading()
{
  document.write
  (
   '<div class="doctitle">'
    + document.title
    + '<br \/>['
    + document.location.href
    + ']<\/div>'
  );
}

// ***************************************************************
// Document status (= title and last update)
// ***************************************************************
function documentStatus()
{
  document.write
  (
    'DOCUMENT: '
    + document.location.href
    + '<br \/>DOCUMENT TITLE: '
    + document.title
    + '<br \/>LAST UPDATE: '
    + document.lastModified
  );
}

// ***************************************************************
// Feedback E-Mail
// ***************************************************************
function sendFeedback() // Slashes werden mit "\" maskiert, also: "\/"!
{
  document.write(
    '<a href="mailto:Matthias%20Kammerer%20%3Ckammererm@yahoo.de%3E?subject=Feedback%20zu:%20<'
    + document.location.href
    + '>&amp;body=Hallo%20Matthias,%0D%0A%0D%0A" title="Feedback per E-Mail senden | Zugriffstaste: [9]" accesskey="9"><img src=".\/graphics\/mail.gif" alt="E-Mail" width="15" height="13" \/> E-Mail<\/a>'
  );
}

// ***************************************************************
// Check current page with Section 508
// ***************************************************************
function checkSection508()
{
  document.write(
    '| <a href="http://www.contentquality.com/mynewtester/cynthia.exe?Url1='
    + document.location.href
    + '" title="Diese Seite gegen Section 508 validieren" lang="en" xml:lang="en">U.S. Section 508<\/a>'
  );
}

// ***************************************************************
// Check current page with Web Content Accessibility Guidelines
// ***************************************************************
function checkWCAG()
{
  document.write(
    '| <a href="http://www.contentquality.com/mynewtester/cynthia.exe?Url1='
    + document.location.href
    + '&amp;rptmode=2" title="Diese Seite gegen die Web Content Accessibility Guidelines validieren" lang="en" xml:lang="en">WCAG: Priority 1–3<\/a>'
  );
}

// ***************************************************************
// Letzte Aenderungen der Datei (nicht verwendet)
// ***************************************************************
function status()
{
  if (navigator.appName == "Netscape") {
    document.getElementById("lastchanges_span").firstChild.nodeValue = document.lastModified;
  }
  document.all.lastchanges_span.innerText=document.lastModified;
}

// ***************************************************************
// Popup des Autornamens (nicht verwendet)
// ***************************************************************
function autor()
{
  alert("Author:\n\nMatthias Kammerer");
}

// ***************************************************************
// Popup des Impressums (nicht verwendet)
// ***************************************************************
function impressum()
{
  alert("I M P R E S S U M\n\nMatthias Kammerer\nGraf-Eberstein-Str. 81\n76199 Karlsruhe\nE-mail: kammererm@yahoo.de");
}

// ***************************************************************
// Ueberpruefung des verwendeten Browsers
// ***************************************************************
function browserCheck() {
  var browser = false;
  if (navigator.appName == "Microsoft Internet Explorer") {
    var versionsPosition = navigator.appVersion.indexOf("MSIE") + 5;
    if (navigator.appVersion.substring(versionsPosition,versionsPosition+1) >= "5") {
      browser = true;
    }
  }
  else {
    if (navigator.appName == "Netscape") {
      if (navigator.appVersion.substring(0,1) >= "5") {
        browser = true;
      }
    }
  }
  if (browser == false) {
    window.location.href = "Browser.htm";
  }
}

// ***************************************************************
// Anzeige eines Bildes in separatem Fenster (nicht verwendet)
// ***************************************************************
function ShowPicture(picture){
  var ScreenWin
  ScreenText = "<html><head><title>Details</title></head><body bgcolor=\"#cccccc\" title=\"Klicken, um Fenster zu schließen\" margin=\"0\" onClick=\"javascript:window.close();\"><table width=100% height=100% border=0><tr><td width=100% height=100% align=center valign=middle><img src=\""+picture+"\" border=0></td></tr></table></body></html>"
  ScreenWin = window.open("","Details","resizable=0,toolbar=0,scrollbars=0");
  ScreenWin.document.open();
  ScreenWin.document.writeln(ScreenText);
  ScreenWin.document.close();
  ScreenWin.focus();
}

// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //
// ++                                                                      ++ //
// ++ Informationsbloecke anzeigen / verbergen                             ++ //
// ++                                                                      ++ //
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ //

// ***************************************************************
// Informationsbloecke anzeigen
// ***************************************************************
// Informationsbloecke bestehen aus:
//   (1) zwei Links [id = 'ilink_'+where] ("Infos anzeigen" bzw. "Infos verbergen"), die wechselseitig angezeigt werden,
//   (2) einem Informationsblock [id = 'ibox_'+where], der angezeigt bzw. verborgen wird
function moreinfo(where) {
  ilink = "ilink_" + where; // Variable fuer die Links "Infos anzeigen" bzw. "Infos verbergen"
  ibox = "ibox_" + where; // Variable fuer den Informationsblock
  // Internet Explorer
  if (navigator.appName == "Microsoft Internet Explorer") {
    document.all(ilink).style.display="none";
    document.all(ibox).style.display="block";
  }
  // NETSCAPE
  if (navigator.appName == "Netscape") {
    document.getElementById(ilink).setAttribute("style", "display:none");
    document.getElementById(ibox).setAttribute("style", "display:block");
  }
}

// ***************************************************************
// Informationsbloecke verbergen
// ***************************************************************
function closeinfo(where) {
  ilink = "ilink_" + where; // Variable fuer die Links "Infos anzeigen" bzw. "Infos verbergen"
  ibox = "ibox_" + where; // Variable fuer den Informationsblock
  // Internet Explorer
  if (navigator.appName == "Microsoft Internet Explorer") {
    document.all(ilink).style.display="block";
    document.all(ibox).style.display="none";
  }
  if (navigator.appName == "Netscape") {
    document.getElementById(ilink).setAttribute("style", "display:block");
    document.getElementById(ibox).setAttribute("style", "display:none");
  }
}

// ***************************************************************
// Show Print Preview (only for IE)
// On the basis of http://msdn2.microsoft.com/en-us/library/ms976105.aspx#dhtmlprint_topic4
// ***************************************************************
function printPage()
{
  if (navigator.appName == "Microsoft Internet Explorer" && navigator.platform == "Win32")
  {
    document.write('<a href="javascript:SystemPrintPreview()" title="Druckvorschau anzeigen | Zugriffstaste: [D]" accesskey="d"><img src=".\/graphics\/print.gif" alt="Druckvorschau" width="15" height="13" \/> Druckvorschau<\/a>')
  } else {
    document.write('<a href="javascript:window.print()" title="Diese Seite drucken | Zugriffstaste: [D]" accesskey="d"><img src=".\/graphics\/print.gif" alt="Drucken" width="15" height="13" \/> Drucken<\/a>')
  }
}

function SystemPrintPreview()
{
  try
  {
    if(!document.getElementById("idWBPrint"))
    {
      document.body.insertAdjacentHTML("beforeEnd", "<object id='idWBPrint' width='0' height='0' classid='CLSID:8856F961-340A-11D0-A96B-00C04FD705A2'></object>");
      PreviewWindow = document.getElementById("idWBPrint");
      idWBPrint.ExecWB(7,1); // ExecWB: http://msdn2.microsoft.com/en-us/library/aa752087.aspx
      idWBPrint.outerHTML = "";
    }
  }
  catch(e)
  {
    alert("Printing failed! " + e.message);
  }
}
