
function test_java_enab() {
   
   return navigator.javaEnabled();
}


function Browser_Bestimmung()

{
    var browserName = navigator.appName;
    var browserVer = navigator.appVersion.substring(0,1);

    var browserVerZ = navigator.appVersion.substring(2,3);


    /* Fallunterscheidung nach Browser */
    

    switch(browserName) {


/* ============== Browser = "Netscape" ============== */
    
    case ("Netscape"):

        /* NS-Browser bis Version 3 und kleiner */

            if(browserVer < 4)
               window.top.location.href=("falscher_browser.html");
            

        /* NS-Browser nur Version 4.x */

            if(browserVer == 4)
            {
                 /* NS-Browser 4.x Check via Nachkommastelle */
                 
		 if(browserVerZ > 7)
                     window.top.location.href=("falscher_browser_NS4_7.html");

                 if(browserVerZ == 7)
	         {
			if(parseInt(navigator.appVersion.indexOf('4.72')) != -1)
                        {
                            window.top.location.href=("anfang_NS.html");
			}	
			else
	                {
                            window.top.location.href=("anfang_NS.html");
			}
           	 }
       	    }
            
            /* NS-Browser ab Version 5.0 ==> z.B. NS 6.0 */

            if(browserVer == 5)
               window.top.location.href=("anfang_NS.html");
 

        /* NS-Browser ab Version 6 und größer */

            if(browserVer > 5)
               window.top.location.href=("falscher_browser.html");



           break;



/* ============== Browser = "Microsoft Internet Explorer" ============== */


    case ("Microsoft Internet Explorer"):

        /* IE-Browser bis Version 3 und kleiner */

        if(browserVer < 4)
             window.top.location.href=("falscher_browser.html");        

        /* IE-Browser ab Version 4.0 */

        else
             window.top.location.href=("anfang_IE.html");


        break;



/* ============== unbekannter Browser ============== */

   default:
        window.top.location.href=("falscher_browser.html");        
        break;
   }

}


var name_spezial="unbekannten Websurfer"
var date_spezial="z.Z. ohne Eintrag"
var times_spezial=0

var expDays = 365;
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));


function name(n){
  
  if(n != null) {
    var name = name;
  }

  else if(GetCookie('name') != null) {
    var name = GetCookie('name');

  }

  else {
    
     var name = prompt("Wir möchten Sie gerne mit Namen begrüßen --- Geben Sie bitte dazu Ihren Vor- und Nachnamen ein ...",'');
    
     if(name == null) {
         name = null;
         window.top.location.href="name_fehlt.html";
     }
     else {
     
     var argum1 = name;
     var nlen1 = argum1.length;

         var argum2 = argum1.split(" ");
         var nlen2 = argum2.length-1;

         if (nlen1 < 1 || nlen1 == nlen2) {
              name = null;
              window.top.location.href="name_fehlt.html";
         }
         else {
              SetCookie('name',name,exp);
         }
     }
  }

  return name;
}

function time() {

  var days = new Array(7);

  days[1] = "Sonntag";
  days[2] = "Montag";
  days[3] = "Dienstag";
  days[4] = "Mittwoch";
  days[5] = "Donnerstag";
  days[6] = "Freitag";
  days[7] = "Samstag";

  var months = new Array(12);

  months[1] = "Januar";
  months[2] = "Februar";
  months[3] = "Maerz";
  months[4] = "April";
  months[5] = "Mai";
  months[6] = "Juni";
  months[7] = "Juli";
  months[8] = "August";
  months[9] = "September";
  months[10] = "Oktober";
  months[11] = "November";
  months[12] = "Dezember";

  var today = new Date();
  var day = days[today.getDay() + 1];
  var month = months[today.getMonth() + 1];
  var dat = today.getDate();


  var browserName = navigator.appName;
  browserVer = navigator.appVersion.substring(0,1);

  browserVerZ = navigator.appVersion.substring(2,3);


  /* Jahreseinstellung nach Browser-Typ */

  switch (browserName) {

     case ("Netscape"):

        /* NS-Browser bis Version 3.9 */
      
        if(browserVer < 4)
      
           var year = today.getYear();

        /* NS-Browser ab Version 4.0 */

        else {

           /* bis Version 4.4 */

           if(browserVerZ < 5)
                var year = today.getYear();

           /* ab Version 4.5 */

           else 
               var year = today.getYear()+1900;

       }
 
       break;
    
    case ("Microsoft Internet Explorer"):
 
        /* IE-Browser bis Version 3.9 */

        if(browserVer < 4)
           var year = today.getYear();       

        /* IE-Browser ab Version 4.0 */

        else
           var year = today.getYear();
 
        break;

    /* unbekannter Browser */

    default:
     
        var year = today.getYear();       
        break;

  }


  var hours = today.getHours();
  var minutes = today.getMinutes();
  var hours2  = ((hours < 10) ? "0" + hours : hours);
  var minutes2  = ((minutes < 10) ? "0" + minutes : minutes);

  var full = day + ", " + dat + " " + month + " " + year + " " + hours2 + ":" + minutes2 + " Uhr";
 
  if(GetCookie('date') != null) {

    DeleteCookie('date');
    SetCookie('date',full,exp);
    return full;
  }
  else {

   SetCookie('date',full,exp);
   return null;
  }
}


function savetime() {
 
  if(GetCookie('savedate') != null) {

    var savedate = GetCookie('date');
    
    DeleteCookie('savedate');
    SetCookie('savedate',savedate,exp);
    return savedate;
  }
  else {

   var savetext = "bisher kein Besuch";
   SetCookie('savedate',savetext,exp);
   return null;
  }
}

function amt(){

  var count = GetCookie('count');

  if(count == null) {
   
   var ncount = 1;

   SetCookie('count',ncount,exp);

   return 0;

  }
  else {

    var newcount = parseInt(count) + 1;
    DeleteCookie('count');
    SetCookie('count',newcount,exp);
    return count;
  }
}



function referenz(){

  var ref_txt = GetCookie('ref');

  if(ref_txt == null) {
   ref_txt = document.referrer;
   SetCookie('ref',ref_txt,exp);
   return 0;
  }
  else {

    var ref_txt = document.referrer;
    DeleteCookie('ref');
    SetCookie('ref',ref_txt,exp);
    return ref_txt;
  }
}


function browser(){

  var br_txt = GetCookie('browser');

  if(br_txt == null) {
   
   br_txt = navigator.appName + " " + navigator.appVersion;
   SetCookie('browser',br_txt,exp);
   return 0;
  }
  else {

    br_txt = navigator.appName + " " + navigator.appVersion;
    DeleteCookie('browser');
    SetCookie('browser',br_txt,exp);
    return br_txt;
  }
}


function host_name(){

  browserName = navigator.appName;
  browserVer = navigator.appVersion.substring(0,1);

  var host_txt = GetCookie('host_name');

  if(host_txt == null) {
    
    if(browserName == "Netscape"){
       if(browserVer >=4) {
          host_txt = java.net.InetAddress.getLocalHost().getHostName();
       }
       else {
          host_txt = java.net.InetAddress.getLocalHostName();
       }
    }
    else {
          host_add = navigator.appName + " " + navigator.appVersion + ": kein Eintrag möglich";
    }

    SetCookie('host_name',host_txt,exp);
    return 0;

  }
  else {

    if(browserName == "Netscape"){
       if(browserVer >= 4) {
          host_txt = java.net.InetAddress.getLocalHost().getHostName();
       }
       else {
          host_txt = java.net.InetAddress.getLocalHostName();
       }
    }
    else {
          host_add = navigator.appName + " " + navigator.appVersion + " ==> kein Eintrag möglich";
    }

    DeleteCookie('host_name');
    SetCookie('host_name',host_txt,exp);
    return host_txt;
  }
}


function host_adresse(){
 
  browserName = navigator.appName;
  browserVer = navigator.appVersion.substring(0,1);

  var host_add = GetCookie('host_adresse');

  if(host_add == null) {
 
    if(browserName == "Netscape"){

       if(browserVer >=4) {
          host_add = java.net.InetAddress.getLocalHost().getHostAddress();
       }
       else {
          host_add = navigator.appName + " " + navigator.appVersion + "==> kein Eintrag möglich";
       }    
    }
    
    else {
          host_add = navigator.appName + " " + navigator.appVersion + "==> kein Eintrag möglich";
    }
    
    SetCookie('host_adresse',host_add,exp);
    return 0;
  }
  else {


    if(browserName == "Netscape"){

       if(browserVer >=4) {
          host_add = java.net.InetAddress.getLocalHost().getHostAddress();
       }
       else {
          host_add = navigator.appName + " " + navigator.appVersion + "==> kein Eintrag möglich";
       }    
    }
    
    else {
          host_add = navigator.appName + " " + navigator.appVersion + "==> kein Eintrag möglich";
    }

    DeleteCookie('host_adresse');
    SetCookie('host_adresse',host_add,exp);
    return host_add;
  }
}


function drucken(what) {

  var tback = null;
  
  if(what == "name") {

    var tname = name();

/*
    var tn = tname.toUpperCase();
    if(tn == "ROBIN HOOD") {
       alert("Hallo Robin Hood --- oder besser:  klip.asca aus Kaiserslautern ! Bist Du auf der Suche nach Elementen für Deine neue Homepage ??? Kann ich helfen ??? Über eine Email (siehe <Kontakt mit uns>) würde ich mich freuen !!!");
    }
*/

    return tname;
  }
  
  else if(what == "date") {
    
   tback=time();

   if(tback == null) {
      return "kein Besuch bisher";
    }
    else {
      return tback;
    }
  }
  
  else if(what == "savedate") {
    
    tback=savetime();

    if(tback == null) {
       return "kein Besuch bisher";
    }
    else {
      return tback;
    }
 }
 else if(what == "times") {
    return amt();
 }


 else if(what == "ref") {
    return referenz();
 }


 else if(what == "browse") {
    return browser();
 }

 else if(what == "host_name") {
    return host_name();
 }

 else if(what == "host_adresse") {
    return host_adresse();
 }
}


function Durchlauf() {

  var stopTime = new Date();
  stopTime = stopTime.getTime();

  if(test_java_enab() == false) {
     window.top.location.href="java_fehlt.html";
  }  
  
  else {

     name_spezial = drucken('name');

     if(name_spezial == null) {
        /* keine Funktion */
     }
     else {
        times_spezial = drucken('times');
        sdate_spezial = drucken('savedate');
        date_spezial = drucken('date');
        ref_spezial = drucken('ref');
        browse_spezial = drucken('browse');
        hostn_spezial = drucken('host_name');
        hosta_spezial = drucken('host_adresse');

        Browser_Bestimmung();
     }
  }
}


//===== Spezielle Funktionen für Auswertungen ======
//===== auf der Willkommen-Seite incl. Meldung =====
//===== per Email über angemeldete Person     ======

function name_ohne(n){
  
  var name = GetCookie('name');

  if(name == null) {
      window.top.location.href="name_fehlt.html";
  }
  else {

      var argum1 = name;
      var nlen1 = argum1.length;

      var argum2 = argum1.split(" ");
      var nlen2 = argum2.length-1;

      if (nlen1 < 1 || nlen1 == nlen2) {
           window.top.location.href="name_fehlt.html";
      }
  }

  return name;
}


function time_ohne() {

  var aktdate = GetCookie('date');
  return aktdate;
}

function savetime_ohne() {

  var savedate = GetCookie('savedate');
  return savedate;
}

function amt_ohne(){

  var count = GetCookie('count');
  return count;
}

function referenz_ohne(){

  var ref_txt = GetCookie('ref');
  return ref_txt;
}

function browser_ohne(){

  var ref_browser = GetCookie('browser');
  return ref_browser;
}


function host_name_ohne(){

  var ref_hname = GetCookie('host_name');
  return ref_hname;
}


function host_adresse_ohne(){

  var ref_hadresse = GetCookie('host_adresse');
  return ref_hadresse;
}



function drucken_ohne(what) {

  var tback = null;
  
  if(what == "name") {
    return name_ohne();
  }
  
  else if(what == "date") {
    
   tback=time_ohne();

   if(tback == null) {
      return "kein Besuch bisher";
    }
    else {
      return tback;
    }
  }
 
 else if(what == "savedate") {
    
   tback=savetime_ohne();

   if(tback == null) {
      return "kein Besuch bisher";
    }
    else {
      return tback;
    }
 }
 else if(what == "times") {
    return amt_ohne();
 }

 else if(what == "ref") {
    return referenz_ohne();
 }
 
 else if(what == "browser") {
    return browser_ohne();
 }
 
 else if(what == "host_name") {
    return host_name_ohne();
 }
 
 else if(what == "host_adresse") {
    return host_adresse_ohne();
 }



}



