/***************************************/
/* JavaScript code file                */
/*  for Heinz-Harald Frentzen Fan Page */
/* File: js_hhf.js                     */
/* Author: Ruediger Gemmrig            */
/* Created: 27-Jan-1998                */
/* Last modified: 20-Oct-2002          */
/***************************************/



/*********************/
/* Globale Variablen */
/*********************/

var site_version = "0.37";
var email_addr ="ruediger.gemmrig@gemmrig.de";
var copyright = "HTML-Code and Design &copy; 1996-2001 R&uuml;diger Gemmrig";
var first_install = "Version 0.01 established 02-Feb-1996";
var site_location = "http://www.gemmrig.de/hhf/index.html";



/*******************************************/
/* Befreit eigene Seite aus fremden Frames */
/*******************************************/
function Frame_Elimination()
{
  if (self != top)
  {
    top.location = self.location;
  }
}



/*******************************************************/
/* Zeigt Versions-Informationen fuer die HTML-Seite an */
/*******************************************************/

function Version_Information()
{
  document.write("Version " , site_version);
}



/*****************************************************/
/* Zeigt Update-Informationen fuer die HTML-Seite an */
/*****************************************************/

function Last_Modified()
{
  date = new Date(document.lastModified);
  month = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
  month = month[date.getMonth()];
  day_number = date.getDate();
  day_name = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
  day_name = day_name[date.getDay()];
  year = date.getYear();
  year = (year>=2000)?year:((year<80)?year+2000:year+1900);
  hour = date.getHours();
  hour = ((hour < 10) ? "0" + hour : hour);
  minute = date.getMinutes();
  minute = ((minute < 10) ? "0" + minute : minute);
  second = date.getSeconds();
  second = ((second < 10) ? "0" + second : second);
  timezoneoffset = date.getTimezoneOffset() / 60;
  date_output = (day_name + ", "  + month + " " + day_number + ", " + year + " " + hour + ":" + minute + ":" + second + " GMT " + timezoneoffset);
  document.write( "Last updated " , date_output , "<br />" );
}



/**************************************************/
/* Zeigt Copyright im HTML-Code einer Webseite an */
/**************************************************/

function Copyright()
{
  document.write(copyright);
}



/******************************************************/
/* Zeigt EMail-Adresse im HTML-Code einer Webseite an */
/******************************************************/

function Email_Address()
{
  document.write("E-Mail: <a href=\'mailto:" + email_addr + "\'>" + email_addr +"</a>");
}



/**************************************/
/* Zeigt Fusszeile fuer Hauptseite an */
/**************************************/

function Foot_Line_Mainpage()
{
  document.writeln("<hr size=\'1\' />");
  document.writeln("<address>");
  document.writeln("Location: ",site_location ,"<br />" );
  document.writeln("Version ", site_version );
  document.writeln(" / ", first_install, "<br />" );
  Last_Modified();
  document.writeln(copyright , "<br />");
  document.writeln("E-Mail <a href=\'mailto:" + email_addr + "?Subject=HHF:\'>" + email_addr +"</a>");
  document.writeln("</address>");
}



/************************************************/
/* Zeigt einheitliche Fusszeile fuer Website an */
/************************************************/

function Foot_Line()
{
  document.writeln("<hr size=\'1\'>");
  document.writeln("<address>");
  document.writeln("Version ", site_version, "<br />");
  Last_Modified();
  document.writeln(copyright, "<br />" );
  document.writeln("E-Mail <a href=\'mailto:" + email_addr + "?Subject=HHF:\'>" + email_addr +"</a>");
  document.writeln("</address>");
}



/********************************************************/
/* Zeigt einheitliches Navigationsmenue fuer Website an */
/********************************************************/

function Navigation_Menue()
{
  document.writeln("<center>");
  document.writeln("<table bgcolor=\'#000000\' border=\'0\' cellspacing=\'0\' cellpadding=\'5\'>");
  document.writeln("<tr class=\'tr1\'>");
  document.writeln("<td class=\'th11\' align=\'center\' colspan=\'2\' valign=\'middle\'>");
  document.writeln("Go to:");
  document.writeln("</td>");
  document.writeln("</tr>");
  document.writeln("<tr class=\'tr1\'>");
  document.writeln("<td class=\'td11\' align=\'center\' valign=\'middle\'>");
  document.writeln("<a href=\'../hhf/hhf.html\' target=\'_parent\'>H.-H. Frentzen</a><br>Startpage");
  document.writeln("</td>");
  document.writeln("<td class=\'td11\' align=\'center\' valign=\'middle\'>");
  document.writeln("<a href=\'../index.html\' target=\'_parent\'>www.gemmrig.de</a><br>Startpage");
  document.writeln("</td>");
  document.writeln("</tr>");
  document.writeln("</table>");
  document.writeln("</center>");
  document.writeln("<br>");
}



/***********************************************************/
/* Erstellt Nachrichten-Ticker im HTML-Code einer Webseite */
/***********************************************************/

// Anzuzeigender Text

var Text = "+++   Welcome to my unofficial Heinz-Harald Frentzen fan page   "
    Text += "+++   Biography, statistics, pictures, news   "
    Text += "+++   English and German   "
    Text += "+++   On the Web since 02-February-1996   "
    Text += "              "
// var Text = "+++   News on 24-Apr-1998:   "
//    Text += "+++   Official Frentzen Homepage online after qualifying session for Imola GP   "
//    Text += "+++   Address is http://www.frentzen.de/   "
//    Text += "              "

// Anfang des Textausschnittes
var Position = 0;
// Verzoegerungszeit in ms
var TickerTime = 200;
// Breite des Textelementes in Zeichen
var TickerBreite = 20;

function ticker()
{
  // Laenge des Textausschnittes
  var Laenge = TickerBreite * 2;
  // Laenge des anzuzeigenden Textes
  var TextLaenge = Text.length;
  // Endposition des Textausschnittes
  var Ende = Position + Laenge;
  // Textausschnitt
  var TickerText = Text.substring( Position, Ende );

  // Ueber das Ende des Textes hinausgegangen?
  if ( Ende > TextLaenge )
  {
    // Teil vom Textanfang anhaengen
    TickerText += Text.substring( 0, Ende - TextLaenge );
  }

    // Wert im Textelement aendern
    document.forms[0].elements[0].value = TickerText;
    // Position um ein Zeichen verschieben
    Position = ( Position + 1 ) % TextLaenge;
    // Nach der Verzoegerungszeit neuer Aufruf
    setTimeout( "ticker()", TickerTime );
  }



/*********************************************************/
/* Schreibt HTML-Quelltext fuer Ticker in die HTML-Seite */
/*********************************************************/

function writeticker_html()
{
  document.writeln("<form>");
  /* document.writeln("Latest News:<br />"); */
  document.writeln("<br />");
  document.write("<input name=\'Nachrichtenelement\' ");
  document.write("size=\'" + TickerBreite + "\'");
  document.writeln("type=\'text\'" + "/>");
  document.writeln("</form>");
}



/*********************************************************************/
/* Schreibt Weihnachts- und Neujahr-Gruesse automatisch in die Seite */
/*********************************************************************/

function christmas_greetings()
{
  datum = new Date();

  if ((datum.getDate() >= 24) && (datum.getDate() <= 31) && (datum.getMonth() +1 == 12))
  {
  document.writeln("<center>");
  document.writeln("<font face=\'ErieLight\' color=\'#ff0000\' size=\'+2\'>");
  document.writeln("<b>");
  document.writeln("I wish a Merry Christmas<br /> to all");
  document.writeln("Frentzen fans out there.<br /> I hope for a");
  document.writeln("thrilling Formula One season " + (datum.getYear()+1+1900) + ".");
  document.writeln("</b>");
  document.writeln("</font>");
  document.writeln("</center>");
  document.writeln("<br /><br />");
  }
  if ((datum.getDate() >= 1) && (datum.getDate() <= 3) && (datum.getMonth() +1 == 1))
  {
  document.writeln("<center>");
  document.writeln("<font face=\'ErieLight\' color=\'#ff0000\' size=\'+2\'>");
  document.writeln("<b>");
  document.writeln("I wish a happy New Year<br /> to all");
  document.writeln("Frentzen fans out there.<br /> I hope for a");
  document.writeln("thrilling Formula One season " + (datum.getYear()+1+1900) + ".");
  document.writeln("</b>");
  document.writeln("</font>");
  document.writeln("</center>");
  document.writeln("<br /><br />");
  }
}



/*********************************************************/
/* Schreibt Geburtstags-Gruesse automatisch in die Seite */
/*********************************************************/

function birthday_greetings()
{


  thedate = new Date();
  mm = 05;
  dd = 18;
  yy = 1967;
  mm2 = thedate.getMonth() + 1;
  dd2 = thedate.getDate();
  yy2 = thedate.getYear();
//  if (yy2 < 100)
//  {
//    yy2 = yy2 + 1900;
//
//  }
  if (document.all)
  {
    yy2 = thedate.getYear() - 1900;
  }
  else 
  {
    yy2 = thedate.getYear();
  }
  yourage = yy2 - yy;
  if (mm2 < mm)
  {
    yourage = yourage - 1;
  }
  if (mm2 == mm)
  {
    if (dd2 < dd)
    {
      yourage = yourage - 1;
    }
  }
  agestring = yourage + " ";

  /* HHF geboren am 18-May-1967 */
  if ((thedate.getDate() >= 18) && (thedate.getDate() <= 22) && (thedate.getMonth() + 1 == 05))
  {
  document.writeln("<center>");
  document.writeln("<font face=\'ErieLight\' color=\'#ff0000\' size=\'+2\'>");
  document.writeln("<b>");
  document.writeln("HAPPY BIRTHDAY, <br>HEINZ-HARALD FRENTZEN!<br>");
  document.writeln(agestring + " YEARS!");
  document.writeln("</b>");
  document.writeln("</font>");
  document.writeln("</center>");
  document.writeln("<br /><br />");
  }
}



/*******************************/
/* Berechnet Alter automatisch */
/*******************************/

function age_calcage(mm,dd,yy)
{
  thedate = new Date();
  mm2 = thedate.getMonth() + 1;
  dd2 = thedate.getDate();
  yy2 = thedate.getYear();
  if (document.all)
  {
    yy2 = thedate.getYear() - 1900;
  }
  else 
  {
    yy2 = thedate.getYear();
  }
  yy2 = yy2 + 1900;
  yourage = yy2 - yy
  if (mm2 < mm)
  {
    yourage = yourage - 1;
  }
  if (mm2 == mm)
  {
    if (dd2 < dd)
    {
      yourage = yourage - 1;
    }
  }
  agestring = yourage + " ";
  document.write(agestring);
}

      // To call the script type:
      // calcage("MM","DD","YYYY")
      // example: calcage("12","26","1971")

